Servingcore
Prefill vs decode
Prefill reads the prompt in parallel (compute-bound); decode writes one token at a time (memory-bound).
What it is and why it exists
Prefill processes all prompt tokens at once — lots of matrix maths, bounded by GPU compute — and determines TTFT. Decode generates tokens sequentially; each step reads all weights for a little compute, bounded by memory bandwidth — and determines tokens/s. Long prompts hurt TTFT; long outputs hurt total time.
Quick prototype
—
In production, at scale
Prefix caching to skip prefill of shared prefixes, chunked prefill so long prompts don’t stall other users’ decode, and sometimes disaggregated prefill/decode on separate GPU pools.
Vendors and tools
| vLLM chunked prefill | Interleave prefill and decode |
|---|---|
| Disaggregated serving (e.g. NVIDIA Dynamo, llm-d) | Separate prefill and decode workers |
How it fails
- One 100k-token prompt freezing everyone’s streams
What the interviewer asks next
Estimate decode speed for a 16 GB model on a 3.35 TB/s GPU at batch 1.
Each token reads ~16 GB: 3,350 / 16 ≈ 200 steps/s upper bound, so maybe 100–150 tokens/s in practice.