On the roofline model, why does single-sequence decode sit far to the left (memory-bound) while prefill sits to the right (compute-bound)?
- Decode has low arithmetic intensity: many bytes read per few FLOPs
- Decode uses a slower attention kernel than prefill by design
- Prefill runs at lower precision, raising its arithmetic intensity
- Prefill skips the KV cache, so it moves fewer bytes overall
Why
Arithmetic intensity (FLOPs per byte) is what places a kernel on the roofline: batch-1 decode reads all weights to produce one token (few FLOPs, many bytes), landing memory-bound, while prefill reuses those reads across many tokens (high intensity), landing compute-bound. Kernel choice, precision, and cache use are not the cause.