Chapter 04
Prefill vs decode
Two very different workloads.
The first step has a name: prefill. Every step after: decode. Same model, same weights, very different work.
01 / 10
The arithmetic, once
A step with tokens needs roughly FLOPs for a model with parameters, and has to read the weights ( bytes in bf16) plus the cache no matter what is:
They cross at , the accelerator’s ratio of compute to bandwidth. For an H100 that’s about tokens per step. Decode runs at per sequence.