Each decode step loads ___ from HBM, regardless of how many tokens have already been generated
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Each decode step reads the full model weights (constant) plus the live KV cache (grows linearly with context length). Decode is bandwidth-bound, and the KV term is what makes long-context decode slow.
Imagine the model is a chef cooking one dish at a time. Every dish, the chef has to grab the entire recipe book from a shelf, that is the model weights, and it is always the same weight no matter what dish. The chef also has to read every note they wrote down from earlier dishes in the meal, that is the KV cache, and after twenty dishes the stack of notes is twenty pages. After two hundred dishes it is two hundred pages. The recipe-book trip is constant per dish, but the notes-reading trip grows. By dish number two hundred, reading the notes takes longer than reading the recipe. That is why long stories get slower to write as they get longer.
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.
3 min: name both byte terms (weights constant, KV linear in T), quantify them on a typical 70B model, explain the crossover at long context, and name the optimization that targets each term.
| Term | Per-step bytes | Scaling | Optimizations |
|---|---|---|---|
| Model weights | Param count * bytes-per-param | Constant per step | Lower-precision dtype (FP8/FP4), tensor parallelism |
| KV cache | 2 * L * H_kv * d_h * b * T | Linear in T (and in batch) | GQA / MQA / MLA, FP8/FP4 KV, sliding-window, paged attention |
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.
Saying decode only re-reads what it needs for that one new token. Wrong: each decode step reloads the entire weight matrix plus the entire current KV cache from HBM, because every output token must be computed against the full parameter set and the full attention history.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.