Learned Prefix Caching (LPC) is the first machine-learning-based eviction policy designed specifically for Large Language Model (LLM) serving. By using a lightweight neural network to predict whether a conversation is likely to continue based on its content, LPC reduces required cache sizes by 18–47% compared to standard LRU policies while boosting prefilling throughput by 11%.
The Problem: Why LRU Fails for LLMs
When interacting with an LLM in a multi-turn conversation, the system must process the entire history (the "prefix") every time a new message is sent. To speed this up, servers use prefix caching, which stores the internal mathematical states (Key-Value or KV caches) of previous turns so they don't have to be recomputed.
However, GPU memory is incredibly expensive and limited. When the cache is full, the system must decide which old conversation to "evict" or delete. Currently, almost every system uses Least-Recently-Used (LRU)—simply kicking out the conversation that hasn't been touched for the longest time.
The authors argue that LRU is fundamentally flawed for LLMs. A user might pause for five minutes to read a complex technical explanation before replying; LRU might evict that valuable context just seconds before the user sends a follow-up. Because of this, there is a massive performance gap between LRU and an optimal "Oracle" policy that has perfect knowledge of the future. LPC aims to bridge that gap.
The LPC Approach
LPC introduces a "learned" approach to cache management consisting of two main components:
- The LPC Predictor: This lightweight module runs in parallel with the LLM. It takes the text of the current and previous user prompts (the last $N=4$ turns) and passes them through a small embedding model (
multilingual-e5-small) and a 3-layer Multi-Layer Perceptron (MLP). It outputs a probability score ($p$) representing how likely the conversation is to continue. - The Eviction Algorithm: Instead of relying on a simple timestamp, LPC uses a min-heap based on a "time-decayed" probability. The system applies an exponential decay function to the initial prediction score as time passes. If a conversation was predicted to be highly likely to continue but has been idle for a very long time, its priority eventually drops, making it a candidate for eviction.
Crucially, the predictor only uses user prompts, not the LLM's own responses. The authors found that the user's intent is the primary signal for whether a thread will continue, and excluding long model responses keeps the system's overhead negligible.
Key Insights
- Content is King: The semantic content of a prompt is a better predictor of future reuse than mere recency. A conversation about a complex, unresolved coding task is statistically more likely to continue than a brief, closed-ended exchange.
- Predictive Decay: A static prediction isn't enough. By combining a neural prediction with a temporal decay function, LPC handles the "human element"—users who walk away from a conversation they intended to finish.
- Minimalist Design: By using a tiny 118M parameter embedding model and ignoring LLM outputs, the authors ensured the cache manager doesn't steal significant resources from the LLM it's supposed to be helping.
- Shared Block Logic: Many conversations share the same initial system instructions. LPC uses a "max-pooling" approach for shared blocks, ensuring a popular system prompt isn't evicted just because one specific user stopped talking.
Results and Performance
The researchers evaluated LPC using three massive, real-world conversational datasets: LMSys, ShareGPT, and Chatbot-Arena. Because these public datasets lack real-world timing information, the authors developed a two-phase simulation strategy to model realistic "user think time" and server load.
LPC demonstrates significant efficiency gains across the board:
- Cache Efficiency: To achieve the same "hit ratio" (how often the system finds the prefix in the cache), LPC requires 18% to 47% less memory than LRU.
- Throughput: In emulated environments, LPC improved LLM prefilling throughput by 11%.
- Latency: For requests that "hit" the cache, the Time-To-First-Token (TTFT) was reduced by 42% to 75%.
- Low Overhead: The predictor uses only about 1GB of GPU memory (roughly 1.25% of an H100's capacity) and can process 1,000 predictions per second.
Limitations and Future Work
While impressive, the authors note a few areas for improvement. First, because public datasets don't record exactly when users hit "enter," the results rely on simulated timing; real-world production traces might yield different behavioral patterns. Second, the current evaluation focused on the Qwen3 model family, and performance might vary across different architectures. Finally, as LLMs move toward native audio and video processing, the text-only predictor will need to evolve to handle multi-modal inputs.
Summary updated