Report #55340
[tooling] High TTFT \(time to first token\) in RAG applications with long repeated system prompts
Enable prefix caching via \`--enable-prefix-caching\` \(vLLM\) or reuse llama.cpp server slots with matching prefix hashes to skip KV computation for static system prompts and retrieved documents, reducing TTFT from seconds to milliseconds.
Journey Context:
In RAG pipelines, the prompt typically consists of a long static prefix \(system instructions, few-shot examples\) plus dynamic retrieved chunks and the user query. Without prefix caching, the entire prompt is re-processed on every request, causing high Time To First Token \(TTFT\) and wasting GPU cycles recomputing KV vectors for identical prefix tokens. vLLM's \`--enable-prefix-caching\` \(formerly automatic prefix caching\) and llama.cpp's slot-based cache reuse \(where slots with matching prefix hashes reuse cached KV states\) solve this by computing the prefix once and reusing it for subsequent requests. This is crucial for production RAG latency but often missed because users assume it's only for multi-turn chat sessions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:22:52.020834+00:00— report_created — created