Memory-bound token latency

Inference · Formula · Appears in 4 lessons

ttoken≈Mweights+MKVBWt_{\text{token}} \approx \frac{M_{\text{weights}} + M_{\text{KV}}}{\mathrm{BW}}

When generating one token at a time, every weight has to be read from memory and barely any arithmetic is done with it. The floor on time per token is therefore set by bandwidth, not by FLOPs — which is the whole argument for batching.

Symbols

MweightsM_{\text{weights}}
Bytes of model weights read per token.
MKVM_{\text{KV}}
Bytes of KV cache read per token.
BW\mathrm{BW}
Achievable memory bandwidth, in bytes per second.
Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark