ARCHOS 525 BLUEPRINT · /d/dgm_llm-prefill-decode-and-batching
LLM serving: prefill, decode and batching
13 COMPONENTS · 14 FLOWS · UPDATED 2026-11-21
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_llm-prefill-decode-and-batching) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_llm-prefill-decode-and-batching)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_llm-prefill-decode-and-batching" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="LLM serving: prefill, decode and batching — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0[("Chat client")]
pdp_1["Policy decision point (PDP)"]
gw_2["API gateway"]
secrets_3[("Secrets manager")]
tsdb_4[("Time-series database (TSDB)")]
alerting_5[("Alerting")]
prefix_6["Prompt prefix caching"]
batch_7["Continuous batching"]
prefill_8[("Prefill step")]
kv_9["KV cache"]
decode_10[("Decode step")]
srvb_11["Inference server"]
capacity_12["Capacity Estimate"]
client_0 -->|"1. Sends JWT · HTTPS"| gw_2
gw_2 -->|"2. Forwards · HTTPS"| batch_7
batch_7 -->|"3. Looks up prefix · TCP"| prefix_6
prefix_6 -->|"4. New part · TCP"| prefill_8
prefill_8 -->|"5. Writes blocks · TCP"| kv_9
kv_9 -->|"6. Reads blocks · TCP"| decode_10
decode_10 -->|"7. Next token · TCP"| batch_7
batch_7 -->|"8. Tokens · HTTPS"| gw_2
gw_2 -->|"9. Tokens · HTTPS"| client_0
gw_2 -->|"Asks policy · HTTPS"| pdp_1
gw_2 -->|"Fetches key · HTTPS"| secrets_3
gw_2 -->|"Fallback · HTTPS"| srvb_11
tsdb_4 -->|"Scrapes engine · HTTPS"| batch_7
tsdb_4 -->|"Metrics · HTTP"| alerting_5COMPONENT STACK (12)
- Chat clientSTATEFULSends a prompt, reads streamed tokens
- Policy decision point (PDP)STATELESSWhich tenant may use which model
- API gatewaySTATELESSChecks the JWT, caps requests in flight
- Secrets managerSTATEFULHolds the gateway TLS key
- Time-series database (TSDB)STATEFULStores queue depth and KV cache usage
- AlertingSTATEFULPages on a long queue or a full KV cache
- Prompt prefix cachingSTATELESSReuses keys and values of a shared prompt start
- Continuous batchingSTATELESSAdmits and retires requests every decoding step
- Prefill stepSTATEFULProcesses the new prompt tokens in one pass
- KV cacheSTATELESSPaged blocks in GPU memory; the batch size limit
- Decode stepSTATEFULAdds one token per request each step
- Inference serverSTATELESSSecond replica; same design as zone a
REQUEST & DATA FLOW (14)
- Chat client → API gateway (Sends JWT)[HTTPS]
- API gateway → Continuous batching (Forwards)[HTTPS]
- Continuous batching → Prompt prefix caching (Looks up prefix)[TCP]
- Prompt prefix caching → Prefill step (New part)[TCP]
- Prefill step → KV cache (Writes blocks)[TCP]
- KV cache → Decode step (Reads blocks)[TCP]
- Decode step → Continuous batching (Next token)[TCP]
- Continuous batching → API gateway (Tokens)[HTTPS]
- API gateway → Chat client (Tokens)[HTTPS]
- API gateway → Policy decision point (PDP) (Asks policy)[HTTPS]
- API gateway → Secrets manager (Fetches key)[HTTPS]
- API gateway → Inference server (Fallback)[HTTPS]
- Time-series database (TSDB) → Continuous batching (Scrapes engine)[HTTPS]
- Time-series database (TSDB) → Alerting (Metrics)[HTTP]