Cheat sheets

Async, Hogwild and Disaggregated Inference

Share, split, route and offload the KV cache. Formulas, crossover numbers and the cases where each method loses.

  • Concepts and terms
  • Tasks and commands
  • Annotated code
  • Diagrams
  • Comparisons
  • Defaults and numbers
  • Troubleshooting
  • Questions and tips

Source

Core ideas#

Prefill
one forward over the full prompt. Compute-bound.
Decode
one token at a time. Reads all weights. Memory-bandwidth-bound.
Hogwild!
N copies of one LLM write to one shared KV cache.
Emergent coordination
reasoning models divide the work with no fine-tuning.
RoPE
positions are rotations, so shared cache entries stay valid.
Disaggregation
prefill pool and decode pool. KV moves between them.
Cache-aware routing
send the request to the replica that holds its prefix.
KV offloading
KV cache leaves the GPU for CPU DRAM, then disk.

From Lesson 10.22, Lesson 17.17, Lesson 17.11, Lesson 17.18

Four methods side by side#

FactorHogwild!DisaggregationCache-aware routingLMCache
What it doesN workers, one shared KV cachePrefill and decode on separate poolsRoute on prefix-hash matchCross-engine KV on CPU DRAM + disk
Wins whenLong reasoning, high pPrompts >512 tokens + outputs >200 tokensPrefixes repeat across replicasKV exceeds HBM
Loses whenShort interactive chatSmall cluster (< 4 GPUs)Cross-region RTT beats saved prefillShort contexts (<1K tokens)
Number1.8x at p = 0.7, N = 4~6x DeepSeek-R1 on GB200 NVL72~80 ms hit vs ~800 ms miss3-5% overhead at low pressure
StatusResearch, April 2026Dynamo 1.0 GA, llm-d 0.5vLLM Router, llm-d routervLLM 0.11.0 async path

From Lesson 10.22, Lesson 17.17, Lesson 17.11, Lesson 17.18

Disaggregated serving stack#

promptprompt onlyKV over NIXLunused KVtokensclientClientrequestprocessRoutercache-aware, KV eventsgpuPrefill poolcompute-heavygpuDecode poolmemory-heavystoreLMCacheCPU DRAM + Ceph/S3promptprompt onlyKV over NIXLunused KVtokensclientClientrequestprocessRoutercache-aware, KVeventsgpuPrefill poolcompute-heavygpuDecode poolmemory-heavystoreLMCacheCPU DRAM + Ceph/S3

From Lesson 17.17, Lesson 17.18, Lesson 17.11

One Hogwild! step#

1Prompttells each worker it is one of N instances andto avoid redundant work.2Workerreads the whole shared cache, including tokensof other workers.3Workersees work already done and picks a differentsub-goal.4Workerwrites one token at the next cache position.5Cacheorder comes from write arrival time. There is noper-worker index.6Other workerssee the token at once on their next step.

From Lesson 10.22, 10.22 code/main.py

Constants in the simulators#

SettingDefaultNote
CACHE_HIT_MS80TTFT with the prefix resident
CACHE_MISS_MS800TTFT with a cold prefill
REPLICAS_PER_REGION4Three regions
PREFILL_TOK_PER_MS40.0Per GPU
KV_BYTES_PER_TOKEN_70B_FP8125_000KV size per token
NIXL_RDMA_GB_S100RDMA transfer rate
NIXL_TCP_GB_S10TCP fallback rate
KV_BLOCK_TOKENS16Tokens per KV block

From 17.11 code/main.py, 17.17 code/main.py, 17.18 code/main.py

Use X when#

  • Use Dynamo for a managed stack-above orchestrator.
  • Use llm-d for Kubernetes-native primitives.
  • Use native CPU offload when one engine has HBM pressure.
  • Use LMCache when many engines share prefixes.
  • Use Hogwild! on one node only. Cross-node is a latency disaster.
  • Push Hogwild! to N=4 only if two workers give over 1.5x.

From Lesson 17.17, Lesson 17.18, Lesson 10.22

Glossary#

NIXL
Dynamo transport for KV. RDMA/InfiniBand or TCP fallback.
RTT
round-trip time. ~75 ms US-EU, ~220 ms US-APAC.
p
the fraction of the work that can run in parallel.
c
coordination overhead in tokens for each worker.
UCCL
llm-d 0.5 networking layer.

From Lesson 17.17, Lesson 17.11, Lesson 10.22

Cost models in the code#

def expected_speedup(T_serial: int, p: float, c: int, N: int,
steps_per_worker: int) -> float:
parallel = T_serial * ((1 - p) + p / N) + c * NAmdahl plus coordination
return T_serial / parallel
def ms_disaggregated(prompt: int, output: int, use_rdma: bool = True) -> float:
prefill_ms = prompt / PREFILL_TOK_PER_MS
kv_bytes = prompt * KV_BYTES_PER_TOKEN_70B_FP8
transport = NIXL_RDMA_GB_S if use_rdma else NIXL_TCP_GB_S
transfer_ms = (kv_bytes / 1e9) / transport * 1000the transfer tax
decode_ms = output / DECODE_TOK_PER_MS_DECODE_GPUfaster decode pool
return prefill_ms + transfer_ms + decode_ms

From 10.22 code/main.py, 17.17 code/main.py

Run the simulators#

TaskCode
Hogwild! baseline, one workerrun_hogwild(n_workers=1, step_budget=200, target_per_category=100, coordination_weight=0.8)
Hogwild! with two workersrun_hogwild(n_workers=2, step_budget=200, target_per_category=100, coordination_weight=0.8)
Sweep coordinationfor cw in (0.0, 0.2, 0.5, 0.8, 1.0):
Compare three routersfor strategy in ("ROUND_ROBIN", "REGIONAL", "GLOBAL"):
Colocated request timems_colocated(prompt, output)
Disaggregated over TCPms_disaggregated(prompt, output, use_rdma=False)
Compare offload configsfor cfg in ("NATIVE_ONLY", "CPU_OFFLOAD", "LMCACHE"):

From 10.22 code/main.py, 17.11 code/main.py, 17.17 code/main.py, 17.18 code/main.py

Troubleshooting#

SymptomCauseFix
Prefix hit rate drops to 8%Round-robin ALBCache-aware router on prefix hash
Replica refuses to start after failoverNo tokenizer or quantization configThree-file DR manifest
Disaggregated is slowerShort prompts, transfer taxColocate prompts < 512 tokens
Same 2K prompt re-prefilledPreemption at 100% HBMLMCache or native CPU offload
Cross-region route raises TTFT440 ms round-tripKeep routing regional
EU request served in us-east-1Router ignores residencyPartition routers by residency
Hogwild! speedup below 1Workers duplicate workUse a reasoning model
Hogwild! gain under 1.3xCoordination dominatesRevert to single-worker

From Lesson 17.11, Lesson 17.17, Lesson 17.18, Lesson 10.22

Q&A#

KV transfer cost?
20-80 ms for 4K-prompt KV on 70B FP8 over NIXL.
Hogwild! with spec decode?
The speedups multiply. 3x and 1.8x give 5.4x.
Why minimize prefill plus network?
A cross-region route adds a 440 ms round-trip to the request. Compare it with the prefill that a cache hit saves.
What breaks DR in 32% of cases?
Missing tokenizer or quantization configs.
Colocation waste?
20-40% of GPU time on the wrong resource.

From Lesson 10.22, Lesson 17.17, Lesson 17.11