Files
LocalAI/docs/static/images/diagrams/federated-vs-worker.html
LocalAI [bot] 7e59a5c7c5 docs: architecture & feature diagrams (blueprint style) (#10137)
* docs: add 'how LocalAI works' architecture diagram

Add a blueprint-style architecture diagram: clients -> small core (API,
router, WebUI, agents) -> gRPC -> backend processes pulled on demand as
OCI images. Place it on the overview page and replace the stale external
architecture image on the reference page.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* docs: add blueprint diagrams across feature, distributed & getting-started docs

Add 24 architecture/flow/comparison diagrams (PNG + HTML source) under
docs/static/images/diagrams/, wired into their docs pages, from an
impact-vs-effort audit of the docs. Broaden the API surface on the
overview architecture diagram (OpenAI, Anthropic, ElevenLabs, Ollama,
and LocalAI's own API) and move the gRPC boundary label clear of the arrows.

Pages: distributed mode (architecture, scheduling, ds4 layer-split),
distributed inferencing, MLX, realtime, quantization, MCP, agents,
mitm & cloud proxy, middleware, reverse-proxy TLS, VRAM, voice & face
recognition, reranker, function calling, fine-tuning (recipe + jobs),
diarization, audio transform, quickstart, model resolution.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* docs: add composable-core diagram to README hero

Commit the composable-core card (small core + on-demand backend tiles)
alongside the other diagrams and reference it from the README hero via a
repo-relative path, so it renders on GitHub.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

* docs: fix composable-core connectors/badge and federated-vs-worker layout

- composable-core: thicken the plug-in connectors so they read clearly, and
  widen the SEPARATE IMAGE badge so its text no longer overflows the box.
- federated-vs-worker: shorten the WHOLE/SPLIT REQUEST pills to fit, and
  replace the tangled node-to-node activation arrows with a clean fan-out
  (request split across all sharded nodes), mirroring the federated panel.

Assisted-by: Claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-06-02 18:43:22 +02:00

195 lines
9.7 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Archivo:wght@500;600;700&display=swap" rel="stylesheet">
<style>
:root{
--paper:#F3E8D2; --paper2:#ECDFC2; --ink:#211C14; --ink-soft:#5A5142;
--rust:#B43A2C; --rust-deep:#8F2C20; --cold:#3F6E73; --hi:#E7D6AE; --dim:#A99F88;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{width:1600px;height:900px}
body{
background:var(--paper);color:var(--ink);font-family:"Archivo",sans-serif;
position:relative;overflow:hidden;
background-image:
linear-gradient(var(--paper2) 1px,transparent 1px),
linear-gradient(90deg,var(--paper2) 1px,transparent 1px);
background-size:40px 40px;
}
.frame{position:absolute;inset:26px;border:3px solid var(--ink);}
.wrap{position:absolute;inset:26px;padding:30px 56px 26px;display:flex;flex-direction:column}
header{display:flex;align-items:flex-end;justify-content:space-between;gap:30px}
.eyebrow{font-weight:700;letter-spacing:.22em;text-transform:uppercase;font-size:17px;color:var(--rust-deep)}
.eyebrow b{color:var(--ink)}
h1{font-family:"Bricolage Grotesque",sans-serif;font-weight:800;font-size:50px;line-height:.98;letter-spacing:-.015em;margin-top:6px}
h1 em{font-style:normal;color:var(--rust)}
.stamp{border:3px solid var(--ink);padding:10px 16px 8px;transform:rotate(3deg);text-align:center;background:var(--paper);box-shadow:6px 6px 0 var(--ink);flex:none}
.stamp .k{font-family:"Bricolage Grotesque";font-weight:800;font-size:21px;letter-spacing:.04em;line-height:1.05}
.stamp .s{font-weight:700;font-size:11px;letter-spacing:.18em;text-transform:uppercase;color:var(--ink-soft);margin-top:5px}
.stage{flex:1;margin-top:8px}
svg{width:100%;height:100%;overflow:visible}
footer{display:flex;align-items:center;justify-content:space-between;margin-top:6px;gap:24px}
.note{font-weight:600;font-size:18px;color:var(--ink-soft);line-height:1.3;max-width:1080px}
.note b{color:var(--ink)}
.url{font-family:"Bricolage Grotesque";font-weight:800;font-size:22px;color:var(--rust-deep);letter-spacing:.01em;flex:none}
.url span{color:var(--ink)}
</style>
</head>
<body>
<div class="frame"></div>
<div class="wrap">
<header>
<div>
<div class="eyebrow">LocalAI <b>&middot;</b> Distributed</div>
<h1>Federated vs <em>worker</em> mode</h1>
</div>
<div class="stamp">
<div class="k">TWO</div>
<div class="s">modes</div>
</div>
</header>
<div class="stage"><svg viewBox="0 0 1480 560" id="svg"></svg></div>
<footer>
<div class="note">Federated routes whole requests to one node; worker shards one model across machines.</div>
<div class="url">localai.io<span>/features/distributed_inferencing</span></div>
</footer>
</div>
<script>
const INK="#211C14", PAPER="#F3E8D2", PAPER2="#ECDFC2", HI="#E7D6AE", SOFT="#5A5142", RUST="#B43A2C", RUSTD="#8F2C20", COLD="#3F6E73", COLDD="#2E5256", DIM="#A99F88";
function el(t,a,x){const e=document.createElementNS("http://www.w3.org/2000/svg",t);for(const k in a)e.setAttribute(k,a[k]);if(x!=null)e.textContent=x;return e;}
const svg=document.getElementById("svg");
function shadowRect(x,y,w,h,fill,stroke,sw,dash){
svg.appendChild(el("rect",{x:x+7,y:y+7,width:w,height:h,fill:INK}));
svg.appendChild(el("rect",{x,y,width:w,height:h,fill,stroke:stroke||INK,"stroke-width":sw||3.5,"stroke-dasharray":dash||"none"}));
}
function txt(x,y,s,o){o=o||{};svg.appendChild(el("text",{x,y,"font-family":o.f||"Archivo","font-weight":o.w||700,"font-size":o.sz||15,"letter-spacing":o.ls||"0","text-anchor":o.a||"start",fill:o.fill||INK},s));}
function arrow(x1,y1,x2,y2,color,dash){
const mx=(x1+x2)/2;
svg.appendChild(el("path",{d:`M ${x1} ${y1} C ${mx} ${y1}, ${mx} ${y2}, ${x2-11} ${y2}`,fill:"none",stroke:color,"stroke-width":3.5,"stroke-linecap":"round","stroke-dasharray":dash||"none"}));
const a=7;
svg.appendChild(el("path",{d:`M ${x2-11} ${y2} l -${a+4} -${a} M ${x2-11} ${y2} l -${a+4} ${a}`,fill:"none",stroke:color,"stroke-width":3.5,"stroke-linecap":"round"}));
}
// vertical arrow (top->down)
function vArrow(x1,y1,x2,y2,color,dash){
const my=(y1+y2)/2;
svg.appendChild(el("path",{d:`M ${x1} ${y1} C ${x1} ${my}, ${x2} ${my}, ${x2} ${y2-11}`,fill:"none",stroke:color,"stroke-width":3.5,"stroke-linecap":"round","stroke-dasharray":dash||"none"}));
const a=7;
svg.appendChild(el("path",{d:`M ${x2} ${y2-11} l -${a} -${a+4} M ${x2} ${y2-11} l ${a} -${a+4}`,fill:"none",stroke:color,"stroke-width":3.5,"stroke-linecap":"round"}));
}
// tag pill
function pill(x,y,w,s,col){
const h=28;
svg.appendChild(el("rect",{x,y,width:w,height:h,fill:PAPER,stroke:col,"stroke-width":2.5}));
txt(x+w/2,y+19,s,{w:700,sz:12,ls:".1em",a:"middle",fill:col});
}
// ============= LEFT PANEL : FEDERATED (cold teal) =============
const LX=20, LW=680, PY=8, PH=544;
svg.appendChild(el("rect",{x:LX,y:PY,width:LW,height:PH,fill:"none",stroke:COLD,"stroke-width":2.5,"stroke-dasharray":"2 8"}));
txt(LX+18,PY+34,"FEDERATED",{f:"Bricolage Grotesque",w:800,sz:26,fill:COLDD});
pill(LX+LW-176,PY+12,158,"WHOLE REQUEST",COLDD);
// request in
const LCEN=LX+LW/2;
shadowRect(LCEN-95,PY+58,190,52,PAPER2);
txt(LCEN,PY+91,"Request",{f:"Bricolage Grotesque",w:700,sz:22,a:"middle"});
// load balancer
const LBY=PY+150;
shadowRect(LCEN-130,LBY,260,60,HI,COLDD,3.5);
txt(LCEN,LBY+38,"Load balancer",{f:"Bricolage Grotesque",w:800,sz:24,a:"middle",fill:INK});
// three nodes
const fNodeY=PY+300, fNW=180, fNH=150;
const fCols=[LX+40, LX+LW/2-fNW/2, LX+LW-fNW-40];
const fNodes=[{busy:false},{busy:true},{busy:false}];
fNodes.forEach((n,i)=>{
const cx=fCols[i], cc=cx+fNW/2;
if(n.busy){
shadowRect(cx,fNodeY,fNW,fNH,PAPER,COLDD,4);
// header bar teal
svg.appendChild(el("rect",{x:cx,y:fNodeY,width:fNW,height:40,fill:COLD}));
svg.appendChild(el("line",{x1:cx,y1:fNodeY+40,x2:cx+fNW,y2:fNodeY+40,stroke:INK,"stroke-width":3}));
txt(cc,fNodeY+27,"Node "+(i+1),{f:"Bricolage Grotesque",w:800,sz:21,a:"middle",fill:PAPER});
} else {
svg.appendChild(el("rect",{x:cx,y:fNodeY,width:fNW,height:fNH,fill:PAPER2,stroke:DIM,"stroke-width":3.5,"stroke-dasharray":"4 7"}));
svg.appendChild(el("rect",{x:cx,y:fNodeY,width:fNW,height:40,fill:"none"}));
txt(cc,fNodeY+27,"Node "+(i+1),{f:"Bricolage Grotesque",w:800,sz:21,a:"middle",fill:SOFT});
svg.appendChild(el("line",{x1:cx,y1:fNodeY+40,x2:cx+fNW,y2:fNodeY+40,stroke:DIM,"stroke-width":2,"stroke-dasharray":"4 6"}));
}
// full model block
const my=fNodeY+58;
svg.appendChild(el("rect",{x:cx+22,y:my,width:fNW-44,height:62,fill:n.busy?HI:PAPER,stroke:n.busy?INK:DIM,"stroke-width":2.5}));
txt(cc,my+27,"FULL",{f:"Bricolage Grotesque",w:800,sz:18,a:"middle",fill:n.busy?INK:DIM});
txt(cc,my+49,"model",{w:700,sz:14,a:"middle",fill:n.busy?SOFT:DIM});
if(!n.busy) txt(cc,fNodeY+fNH+22,"idle",{w:700,sz:13,a:"middle",ls:".12em",fill:DIM});
else txt(cc,fNodeY+fNH+22,"serves the request",{w:700,sz:13,a:"middle",ls:".04em",fill:COLDD});
});
// arrows: request -> LB
vArrow(LCEN,PY+110,LCEN,LBY,INK);
// LB -> nodes (chosen one solid teal, others dashed dim)
fNodes.forEach((n,i)=>{
const cc=fCols[i]+fNW/2;
vArrow(LCEN,LBY+60,cc,fNodeY, n.busy?COLDD:DIM, n.busy?"none":"2 8");
});
// caption
txt(LCEN,PH-6,"whole request → one node, full model",{f:"Bricolage Grotesque",w:700,sz:18,a:"middle",fill:COLDD});
// ============= divider =============
svg.appendChild(el("line",{x1:740,y1:PY+8,x2:740,y2:PH-8,stroke:INK,"stroke-width":2.5,"stroke-dasharray":"3 9"}));
// ============= RIGHT PANEL : WORKER (rust) =============
const RX=760, RW=700;
svg.appendChild(el("rect",{x:RX,y:PY,width:RW,height:PH,fill:"none",stroke:RUST,"stroke-width":2.5,"stroke-dasharray":"2 8"}));
txt(RX+18,PY+34,"WORKER",{f:"Bricolage Grotesque",w:800,sz:26,fill:RUSTD});
pill(RX+RW-176,PY+12,158,"SPLIT REQUEST",RUSTD);
const RCEN=RX+RW/2;
// request in
shadowRect(RCEN-95,PY+58,190,52,PAPER2);
txt(RCEN,PY+91,"Request",{f:"Bricolage Grotesque",w:700,sz:22,a:"middle"});
// three worker nodes holding shards proportional to memory
const wNodeY=PY+200;
// memory-proportional widths
const wShards=[{lbl:"shard 1",frac:"40%",h:170,mem:"16 GB"},{lbl:"shard 2",frac:"35%",h:150,mem:"12 GB"},{lbl:"shard 3",frac:"25%",h:120,mem:"8 GB"}];
const wNW=190, wGap=20;
const wTotW=wNW*3+wGap*2;
const wStartX=RCEN-wTotW/2;
const wCols=[wStartX, wStartX+wNW+wGap, wStartX+2*(wNW+wGap)];
const wMaxH=170, wBaseY=wNodeY+wMaxH; // shards bottom-aligned
wShards.forEach((sd,i)=>{
const cx=wCols[i], cc=cx+wNW/2;
const top=wBaseY-sd.h;
shadowRect(cx,top,wNW,sd.h,PAPER,RUSTD,3.5);
// rust header
svg.appendChild(el("rect",{x:cx,y:top,width:wNW,height:38,fill:RUST}));
svg.appendChild(el("line",{x1:cx,y1:top+38,x2:cx+wNW,y2:top+38,stroke:INK,"stroke-width":3}));
txt(cc,top+26,"Node "+(i+1),{f:"Bricolage Grotesque",w:800,sz:20,a:"middle",fill:PAPER});
// shard fill
svg.appendChild(el("rect",{x:cx+18,y:top+52,width:wNW-36,height:sd.h-72,fill:HI,stroke:INK,"stroke-width":2.5}));
txt(cc,top+52+(sd.h-72)/2-4,sd.lbl,{f:"Bricolage Grotesque",w:800,sz:18,a:"middle",fill:INK});
txt(cc,top+52+(sd.h-72)/2+18,"weights "+sd.frac,{w:700,sz:13,a:"middle",fill:SOFT});
// memory tag under node
txt(cc,wBaseY+24,sd.mem+" mem",{w:700,sz:13,a:"middle",ls:".04em",fill:RUSTD});
});
// request is split across the whole sharded fleet (all nodes active)
wShards.forEach((sd,i)=>{
const cc=wCols[i]+wNW/2;
const top=wBaseY-sd.h;
vArrow(RCEN,PY+110,cc,top,RUSTD);
});
// caption
txt(RCEN,PH-6,"weights sharded across all nodes",{f:"Bricolage Grotesque",w:700,sz:18,a:"middle",fill:RUSTD});
</script>
</body>
</html>