Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Chunked prefill splits a long prompt's prefill into scheduler-sized pieces so they can interleave with decode steps from other requests in the same batch.
Picture a restaurant kitchen where one chef just got a 20-step gourmet order and the other diners are waiting for their drinks refilled. If the chef finishes the entire 20-step meal before pouring anyone a glass of water, the other tables get angry. Chunked prefill is like the rule that says: do two steps of the big meal, then refill some drinks, then two more steps, then more drinks. The big meal still gets done; the other tables stop waiting. In LLM serving the big meal is a long prompt's prefill and the drink refills are quick decode steps from other users.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
6 min: prefill vs decode regimes, why naive scheduling stalls, how chunking enables hybrid scheduler iterations, chunk_size tuning, TTFT vs ITL trade-off, mixed-batch kernel requirement, distinction from PagedAttention and KV quantization.
| Property | Without chunked prefill | With chunked prefill |
|---|---|---|
| Long-prefill behavior | Blocks all decode users in the batch | Interleaves with decode at chunk granularity |
| GPU utilization | Alternates compute-bound and bandwidth-bound phases | Hybrid: tensor cores + HBM bandwidth saturated simultaneously |
| Tail decode latency | Spikes to length of longest prefill | Bounded by chunk_size processing time |
| Prefill TTFT for the prefilling request | Lower (no chunk overhead) | Slightly higher (chunk boundary cost) |
| What it requires | Standard scheduler | Paged KV + mixed-batch attention kernel |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Confusing chunked prefill with PagedAttention or with sparse attention. Chunked prefill is scheduler-side: it changes when prefill work happens, not the FLOP count or the memory layout.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.