Walk through how a prefix-cache hit changes the work that chunked prefill has to do
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
A continuous-batching scheduler (vLLM / SGLang) supports both prefix caching and chunked prefill. Walk through what happens to a new request whose first 5,000 tokens hit the prefix cache, when the total prompt is 7,000 tokens and the chunk size is 1,024. Explain how the two optimizations stack within one scheduler iteration.
Prefix cache reuses 5K tokens of existing KV, that prefill is skipped entirely.
Picture a teacher who needs to read a 7-page essay before grading. With prefix caching, she realizes she already read the first 5 pages last week and has notes, she just attaches those notes and starts fresh on page 6. Now she has 2 pages to read. Chunked prefill is her policy of never sitting down for a long uninterrupted read. She reads roughly a page (1,024 tokens), then briefly checks in with five other students' work in progress, then reads the rest of the second page, then checks in again. Every student gets a steady stream of attention instead of waiting an hour while she finishes one essay.
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.
3 min: prefix caching as KV-block reuse + chunked prefill as head-of-line-blocking fix + the specific 5K/2K/1024 walkthrough + how they batch into iterations + the orthogonality argument.
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.
Believing the cache hit just speeds up prefill, it skips it entirely for the hit region. Or believing chunked prefill helps the cached portion, it doesn't; it only shapes the remaining work.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.