Tail-Optimized Caching for LLM Inference

Wenxin Zhang, Yueying Li, Ciamac C. Moallemi, Tianyi Peng

Introduction

In Large Language Model (LLM) deployment, average latency is often a deceptive metric. While many users experience snappy responses, a significant "tail"—the slowest 5% of requests—often faces frustrating delays. Prompt caching, which reuses the Key-Value (KV) cache from previous turns, is the standard for reducing latency. However, the industry-standard Least Recently Used (LRU) eviction policy is surprisingly ineffective at managing this tail.

A new paper, "Tail-Optimized Caching for LLM Inference," introduces Tail-Optimized LRU (T-LRU). This simple modification to caching logic prioritizes high-latency conversations to ensure a smoother experience across the entire user base.

The Problem with Length-Oblivious Caching

GPU memory is a scarce resource, necessitating the eviction of KV caches as conversations progress. Standard LRU evicts the least recently active conversation regardless of its size. This "length-oblivious" approach is problematic for Service Level Objectives (SLOs), such as "95% of requests must start within 200ms."

LRU might retain a massive cache for a very long conversation that will inevitably exceed the latency threshold, while evicting a medium-sized cache that could have kept another user's request within the SLO.

Figure 1: Comparison of cache allocation between LRU and T-LRU. T-LRU performs partial eviction (trimming) to maintain multiple conversations in cache, whereas LRU evicts entire sequences.

The T-LRU Algorithm

The authors propose Tail-Optimized LRU (T-LRU), which minimizes Tail Excess Latency (TEL)—a metric measuring how much a request exceeds a target latency threshold ($\xi_s$).

When the cache is full, T-LRU operates in two phases:

  1. TEL-safe Trimming: It identifies conversations with "excess" cached blocks. If a conversation is so long that it will exceed the latency threshold regardless of its cache size, or if it has more cache than needed to stay under the threshold, the "extra" blocks are evicted first.
  2. Standard LRU: If more space is required, the system falls back to standard LRU eviction.

Theoretically, the researchers proved that T-LRU is online optimal for minimizing expected tail latency, while standard LRU is optimal only for average latency.

Key Insights: The "Free" Eviction

A counter-intuitive finding is that caching more isn't always better. Once a cached prefix is large enough to meet the latency target for the next turn, additional cached blocks provide zero marginal benefit toward the SLO. T-LRU reallocates this "excess" memory to other users.

Figure 3: TTFT Latency vs. Token Load for various cached loads. The linear relationship shows how caching a specific number of tokens directly offsets the processing latency of the total token load.

Furthermore, the authors found that a "single-bit" forecast—simply knowing if a conversation will continue—is a powerful performance driver. Knowing the exact length of the next prompt offers only marginal additional gains.

Results and Impact

Evaluated on the WildChat (1 million ChatGPT interactions) and ShareGPT datasets using a Vicuna-7B model, T-LRU demonstrated significant improvements:

  • Tail Latency Reduction: Up to a 23.9% reduction in P95 Time to First Token (TTFT).
  • SLO Compliance: A 38.9% decrease in SLO violations for a 200ms target.
  • Ease of Implementation: T-LRU requires only a minor modification to existing LRU engines, marking specific blocks as "infinitely old" for natural eviction.

Future Directions

While effective, T-LRU currently focuses on single-layer GPU VRAM caches. Future work could extend this logic to hierarchical caches (VRAM to CPU RAM or SSD) and integrate it with advanced request schedulers like vLLM to further optimize end-to-end performance.

Summary updated

BibTeX
@inproceedings{zhang2025tail,
  author = {Wenxin Zhang and Yueying Li and Ciamac C. Moallemi and Tianyi Peng},
  title = {{Tail-Optimized Caching for LLM Inference}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=8C8F4NmHfz},
}
Figure