ARCHOS 525 BLUEPRINT · /d/dgm_llm-attention-and-kv-cache
Attention and the KV cache (LLM serving memory)
10 COMPONENTS · 13 FLOWS · UPDATED 2026-11-21
GITHUB README / PR PREVIEW CARD
[](https://archos.sageideas.dev/d/dgm_llm-attention-and-kv-cache) *Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_llm-attention-and-kv-cache)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_llm-attention-and-kv-cache" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Attention and the KV cache (LLM serving memory) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
client_0[("API Client")]
lb_1["Layer 7 load balancer"]
gw_2["API gateway"]
engine_3["Inference server"]
paged_4["PagedAttention"]
kv_5[("KV cache")]
secrets_6[("Secrets manager")]
tsdb_7[("Time-series database (TSDB)")]
alerting_8[("Alerting")]
capacity_9["Capacity Estimate"]
client_0 -->|"1. Calls with a JWT · HTTPS"| lb_1
lb_1 -->|"2. Forwards (mTLS) · HTTP/2"| gw_2
gw_2 -->|"3. Sends prompt (mTLS) · HTTP/2"| engine_3
engine_3 -->|"4. Plans KV blocks · method call"| paged_4
paged_4 -->|"5. Writes keys, values · method call"| kv_5
kv_5 -->|"6. Returns keys, values · method call"| paged_4
paged_4 -->|"7. Returns next token · method call"| engine_3
engine_3 -->|"8. Streams tokens (mTLS) · HTTP/2"| gw_2
gw_2 -->|"9. Replies or 429 · HTTP/2"| lb_1
lb_1 -->|"10. Relays reply · HTTPS"| client_0
secrets_6 -->|"Supplies certificates · HTTPS"| engine_3
tsdb_7 -->|"Scrapes signals · HTTP"| engine_3
tsdb_7 -->|"Notifies · HTTP"| alerting_8COMPONENT STACK (9)
- API ClientSTATEFULCalls the model API from an untrusted network
- Layer 7 load balancerSTATELESSEnds TLS, stamps a trace id, spreads requests
- API gatewaySTATELESSChecks the JWT; answers HTTP 429 over its cap
- Inference serverSTATELESSContinuous batching; admits by free KV blocks
- PagedAttentionSTATELESSAttends over KV blocks found by a block table
- KV cacheSTATEFULKeys and values per token, in GPU memory blocks
- Secrets managerSTATEFULHolds the server TLS certificates
- Time-series database (TSDB)STATEFULStores KV cache usage, queue depth, first-token time
- AlertingSTATEFULPages on-call when KV cache fills or requests wait
REQUEST & DATA FLOW (13)
- API Client → Layer 7 load balancer (Calls with a JWT)[HTTPS]
- Layer 7 load balancer → API gateway (Forwards (mTLS))[HTTP/2]
- API gateway → Inference server (Sends prompt (mTLS))[HTTP/2]
- Inference server → PagedAttention (Plans KV blocks)[method call]
- PagedAttention → KV cache (Writes keys, values)[method call]
- KV cache → PagedAttention (Returns keys, values)[method call]
- PagedAttention → Inference server (Returns next token)[method call]
- Inference server → API gateway (Streams tokens (mTLS))[HTTP/2]
- API gateway → Layer 7 load balancer (Replies or 429)[HTTP/2]
- Layer 7 load balancer → API Client (Relays reply)[HTTPS]
- Secrets manager → Inference server (Supplies certificates)[HTTPS]
- Time-series database (TSDB) → Inference server (Scrapes signals)[HTTP]
- Time-series database (TSDB) → Alerting (Notifies)[HTTP]