For 1M-token context decode, which parallelism axis actually relieves KV pressure?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Only sequence / context parallelism splits along the dimension that grows with context length, so at 1M tokens it is the parallelism axis that actually shrinks the per-GPU KV cache. TP, PP, and EP shard other dimensions.
Think about which way you slice a giant pizza. The cached conversation history at 1M words is a pizza that is enormous along one specific direction: how many words long it is. Splitting the math across GPUs by columns is like slicing the pizza into thinner and thinner radial wedges; that helps with width but not length. Splitting by stacking layers across GPUs is like piling pizzas in a tower (one per layer); it does not split any single pizza at all. The right move is to cut the pizza crosswise along its length, so each diner gets a shorter section of the long pizza. Splitting a long input across helpers is the only cut that reduces how much of the long axis any one diner has to hold.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
30 sec: KV cache shape and which axis is too big at 1M (it is L). 1 min: each parallelism splits a different axis (TP heads, PP layers, EP experts, SP sequence). 1 min: only SP / CP attacks L. 1 min: explain ring attention or all to all communication during the attention op. 30 sec: production stack is TP + SP.
| Parallelism axis | What it shards | KV-cache effect at long context | When it helps |
|---|---|---|---|
| Tensor (TP) | Heads, hidden dim, projection matrices | Constant-factor shrink (by TP degree); does not scale with L | Model too large for one GPU; modest context |
| Pipeline (PP) | Layers (depth) | No help; each layer's KV still full sequence on its GPU | Very deep models; weight budget bottleneck |
| Expert (EP) | MoE FFN experts | Zero effect on attention KV | MoE FFN distribution only |
| Sequence / Context (SP / CP) | Token sequence dimension (L) | Linear shrink in L; scales with context length | Long context (the canonical answer) |
| Data (DP) | Independent samples across replicas | Zero effect on per-sample KV | Throughput scaling, not memory |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing tensor parallelism solves long-context memory. TP shards heads and projection weights, not the sequence dimension. At long context the KV per TP rank still scales linearly with context length and runs out.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.