Skip to content
TopicTracker
From HackerNewsView original
TranslationTranslation

Automatic Prefix Caching – vLLM

vLLM's Automatic Prefix Caching feature stores and reuses the key-value (KV) cache of common prefixes across requests. This avoids redundant recomputation of identical prompt prefixes, reducing latency and computational overhead, especially for shared system prompts or multi-turn conversations.

Background

- vLLM is an open-source high-throughput inference engine for large language models (LLMs), widely used in production AI systems. - **Automatic Prefix Caching (APC)** is a vLLM optimization that identifies and reuses common prompt prefixes (e.g., system instructions, conversation history) across multiple requests, avoiding redundant computation and reducing latency. - Without APC, each LLM request processes the entire input from scratch, even when many requests share identical starting text. APC stores the key-value (KV) cache of prefix tokens and reuses it for subsequent similar requests. - This is especially valuable for chatbot applications, code assistants, and RAG systems where long system prompts or context blocks are repeated for every user query. It directly reduces time-to-first-token (TTFT) and overall serving cost.