Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Derive the arithmetic intensity (FLOPs per byte read from HBM) of one decode step at batch 1 and at batch B, ignoring the KV cache contribution. Use a model with N parameters in FP16. Explain what the result implies about decode's place on the roofline.
At batch 1 a decode step reads 2N weight bytes and does 2N FLOPs, so arithmetic intensity is 1 FLOP per byte. Batching to B raises it to B, sliding decode up the roofline toward compute-bound.
Imagine a chef who must walk to a giant pantry, carry back every ingredient, then cook one tiny dish. The walk is the slow part, not the cooking. Serving one customer, almost all the time is spent fetching, so the stove sits nearly idle. Now imagine forty customers ordering at once. The chef makes one trip to the pantry and cooks forty dishes from the same haul. The walk cost is shared, so the stove finally runs hot. LLM decode is the same. Reading the model weights from memory is the long walk; the math is the quick cooking. One request wastes the hardware; batching many requests pays for the trip once and keeps the chips busy.
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, derive 2N bytes and 2N FLOPs at batch 1 giving AI=1, show batching cancels to AI=B, compute the H100 critical intensity near 330, then place decode on the roofline and connect to throughput.
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.
Quoting decode cost in FLOPs and concluding the GPU is compute-limited. Decode at batch 1 uses a tiny fraction of peak FLOPs; the real bottleneck is weight bytes streamed from HBM.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.