What problem does chunked prefill solve in production LLM serving?
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.
Detailed answer & concept explanation~6 min readEverything 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. 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.
- vLLM ships chunked prefill as a default scheduler option, used in production deployments serving Llama 4 Maverick and Qwen 3.5 long-context workloads.
- TGI (Hugging Face Text Generation Inference) added chunked prefill in 2024, now standard for serving Gemma 4 and DeepSeek V4 with mixed prefill-decode batches.
- SGLang combines chunked prefill with RadixAttention prefix caching to serve agent workloads on Claude Opus 4.7 style long system prompt patterns.
- TensorRT-LLM exposes chunked prefill in its mixed-batch scheduler for enterprise GPT-5.5 deployments on Hopper and Blackwell GPUs.
- Sarathi-Serve introduced the formal study of chunked prefill scheduling, showing 2-3x throughput improvements on mixed prefill-decode workloads.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does chunk_size interact with the GPU's compute to bandwidth balance?
QWhy does chunked prefill need PagedAttention as a prerequisite?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
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.
Same topic, related formats. Practice these next.