What this thread does
Do first: Enable enable_prefix_caching=True in the vLLM engine and keep the shared material at the start of each request.
Short answer
APC retains computed KV state and reuses it when another query begins with a matching prefix. Repeated document questions and later turns with the same conversation history can skip that shared prefill computation.
What to do
| Interface | Exact value / action |
|---|---|
| Python engine | enable_prefix_caching=True |
| Serving CLI | --enable-prefix-caching; use with vllm serve <model> |
| Disable in CLI reference | --disable-prefix-caching |
| Documentation mismatch | The APC guide’s ReplaySSM example instead names --no-enable-prefix-caching; the CLI reference lists --disable-prefix-caching |
| Guide example file | examples/features/automatic_prefix_caching/automatic_prefix_caching_offline.py |
| APC page date | 2026-11-12 |
Start the serving process with the enable flag:
vllm serve <model> --enable-prefix-caching
Replace the model placeholder with your served model. Keep a repeated document or shared conversation prefix unchanged across the requests intended to reuse it.
Limits and open questions
APC helps prefill only. New-token decoding still runs; generation-heavy requests or requests without matching prefixes have little benefit. Hybrid Mamba checkpoint alignment and ReplaySSM need additional configuration beyond this basic recipe. The two docs disagree on the disable-flag spelling; no runtime flag check was made. Neither cited section states a universal enabled-by-default value.
Not for: LiteLLM full-response caching or hybrid Mamba ReplaySSM tuning.
Sources
Checked
2026-11-17; read Automatic Prefix Caching, vllm serve CLI reference (prefix caching); no command was run.
Started from a post by @vLLM, packaged by the editor. Original post