Which statement best explains why prefill and decode hit different bottlenecks on the same GPU?
Prefill amortizes each weight read across many parallel tokens, so it is compute-bound; decode re-reads weights for one token per step, so it is memory bandwidth bound.
Imagine a chef who walks to a far-away pantry to fetch ingredients before cooking each dish. If twenty orders arrive at once, one trip to the pantry serves all twenty dishes, so the walk barely matters and the chef's hands are the limit. That is prefill: many tokens share one trip for the weights. Now imagine orders trickle in one at a time. The chef walks to the pantry, grabs ingredients, cooks one dish, then walks back for the next order. The walking dominates and the cooking is trivial. That is decode: one token per step, and fetching the model weights from far-away memory is what you wait on, not the math itself.
Detailed answer & concept explanation~8 min readEverything 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. 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.
4 min: define arithmetic intensity and the roofline ridge, then map prefill (parallel, compute-bound, TTFT) versus decode (one token, bandwidth-bound, TPOT), then the levers.
| Phase | Parallelism | Arithmetic intensity | Regime | Latency metric set |
|---|---|---|---|---|
| Prefill | Parallel over all prompt tokens | High, roughly 10 to 100 | Compute-bound | Time to first token |
| Decode (batch 1) | Sequential, one token per step | Near 1 | Memory bandwidth bound | Time per output token |
Real products, models, and research that use this idea.
- vLLM uses continuous batching to lift decode arithmetic intensity, stacking many requests so one weight read serves many tokens.
- NVIDIA TensorRT-LLM ships chunked prefill on H100 and B200, interleaving prefill chunks with decode to keep the GPU busy.
- DeepSeek V4 pairs Multi-head Latent Attention with speculative decoding to attack the decode bandwidth wall on long generations.
- Anthropic and OpenAI prompt caching warm the prefill KV state so repeated system prompts skip recomputation, cutting time to first token.
- Disaggregated serving in SGLang and TensorRT-LLM runs prefill and decode on separate GPU pools because their bottlenecks differ.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does batching raise decode arithmetic intensity but barely move prefill?
QHow does the KV cache change the decode roofline as context grows?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying decode is compute-bound because softmax or generation feels expensive. The cost is reading weights and the KV cache from HBM, not the arithmetic, which is trivial at one token per step.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.