On this page
How it works
- Prefill processes all input tokens together.
- Decode generates each token by reading the model's weights, limited mostly by memory bandwidth.
Full lesson: AI numbers: serving, cost and latency.
The numbers
- Total time ≈ time to first token + output tokens × time per token.
Why it matters, by role
- AI Infrastructure PMProduct Manager. Decides what a product should do, for whom, and why. Read the full explanation: Latency targets.
- AI Product Engineer: Streaming and context trimming.
- Applied AI PM: Perceived speed.
How interviews test it
Common confusions
- Streaming doesn't shorten total time; it shortens the wait before anything appears.
- Long outputs slow things more than long inputs, per token.
Related concepts
Sources
- Leviathan et al. (2023), "Fast Inference from Transformers via Speculative Decoding"
- Explained from standard practice; taught in full in the AI numbers: serving, cost and latency module.