Prefix-cache hit lands on a request: does speculative decoding still help that request?
Explain how a prefix-cache hit changes the latency profile of a request, and whether that change makes speculative decoding more, less, or equally valuable for the same request. Argue from where each technique actually saves time.
Prefix cache saves prefill, speculation saves decode. They are orthogonal, and speculation's relative win on a cache-hit request is unchanged. The two stack and you want both for long-prefix RAG.
Think of a long bus trip in two parts: a slow scenic drive to the city (prefill), then a fast highway run home (decode). A prefix cache is like a teleporter that skips the scenic drive when you have made the same trip before; it has nothing to do with how fast the highway part goes. Speculative decoding is a faster engine for the highway run; it has nothing to do with whether you teleported there or drove. If you teleport in and then drive home, the faster engine still gives you the same time savings on the highway as it would after a normal scenic drive. The two improvements affect different legs of the same trip, so they stack rather than overlap.
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.
4 min: phase decomposition + cache saves prefill + speculation saves decode + orthogonality argument + composition in RAG + monitoring each phase.
Real products, models, and research that use this idea.
- vLLM v1 ships prefix caching and speculative decoding as independent flags; the docs explicitly recommend enabling both for RAG workloads.
- Anthropic's prompt caching (Claude Opus 4.7, Sonnet 4.6) sits on top of internal speculative decoding; the documented latency improvements are additive on long-prompt routes.
- TensorRT-LLM Medusa and EAGLE-3 speculative decoding integrate with NVIDIA's KV-cache reuse layer and report stacking speedups on long-context inference.
- DeepSeek V4 uses Multi-Token Prediction speculation and prefix caching together; the cost-per-token reductions reported come from combining both rather than choosing.
- Together AI's serving stack lets users toggle prefix cache and speculation independently; their benchmarks show the two effects are roughly additive on decode-heavy traffic.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat is the formal speedup formula for speculative decoding, and which terms matter most?
QHow does prefix-cache invalidation interact with multi-tenant serving?
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.
Assuming that a cache hit reduces the value of speculation because total request time is shorter. The relative speedup of speculation is set by decode-step cost and acceptance rate, neither of which the cache touches.
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.