A Survey on Large Language Model Acceleration based on KV Cache Management

Haoyang Li, Yiming Li, Anxin Tian, Tianhao Tang, Zhanchao Xu, Xuejia Chen, Nicole Hu, Wei Dong, Li Qing, Lei Chen

Abstract

Large Language Models (LLMs) have revolutionized natural language processing, yet their inference is often bottlenecked by the memory demands of the Key-Value (KV) cache. This paper surveys optimization strategies categorized into token-level, model-level, and system-level approaches. By analyzing techniques such as token eviction, quantization, architectural innovations like Grouped-Query Attention, and system-level memory management like PagedAttention, we provide a roadmap for scaling LLMs to long-context and real-time applications.

Introduction: The KV Cache Bottleneck

LLMs generate text auto-regressively, predicting one token at a time. To maintain context, the model must "attend" to every previous token in the sequence. Recomputing the Key and Value vectors for every token at every step would result in $O(n^2)$ complexity, which is computationally prohibitive.

The standard solution is the KV Cache, which stores these vectors in memory for reuse. However, this creates a significant memory footprint that grows linearly with sequence length and the number of layers. For long-context tasks, such as analyzing extensive documents, the KV cache can easily exceed the available VRAM on modern GPUs, leading to "Out of Memory" errors or severely limiting processing throughput.

Optimization Methods

Research into mitigating the KV cache bottleneck can be categorized into a three-tiered taxonomy: token-level, model-level, and system-level optimizations.

Overview of Transformer architecture and the transition from Full to Sparse Attention.

1. Token-level Optimization

These methods focus on managing the content of the cache without altering the model's underlying architecture.

  • Selection & Eviction: Identifying "Heavy Hitters" or "Attention Sinks" (critical tokens) and discarding less important ones (e.g., H2O, StreamingLLM).
  • Quantization: Reducing the numerical precision of the cache from 16-bit floats to 4-bit or even 2-bit integers (e.g., KIVI, KVQuant).
  • Merging: Combining similar KV pairs to reduce redundancy and overall memory usage.

2. Model-level Optimization

These involve architectural innovations that often require retraining or fine-tuning.

  • Attention Grouping: Moving from Multi-Head Attention (MHA) to Multi-Query (MQA) or Grouped-Query Attention (GQA) to share KV heads across multiple query heads, drastically reducing the cache size.
  • Latent Compression: Using low-rank projections to compress the KV cache into a "latent" space, as seen in DeepSeek’s Multi-head Latent Attention (MLA).
  • Non-Transformer Architectures: Exploring alternative models like Mamba or RWKV that use fixed-size recurrent states instead of a growing KV cache.

3. System-level Optimization

These focus on the infrastructure and hardware-aware designs.

  • Memory Management: Utilizing "PagedAttention" (pioneered by vLLM) to manage GPU memory like virtual memory in an operating system, which eliminates internal fragmentation.
  • Speculative Scheduling: Predicting request memory requirements to maximize serving throughput.
  • Hardware-aware Design: Offloading the cache to CPU RAM or SSDs when GPU memory is full, allowing for much larger context windows than physically possible on the GPU alone.

Key Insights and Ideas

  • The "Attention Sink" Phenomenon: Researchers have observed that the first few tokens in a sequence receive a disproportionate amount of attention. Keeping just these "sinks" and the most recent tokens allows models to maintain performance even with a small, fixed-size cache.
Visualization of a sparse attention mask featuring an initial "sink" and a local sliding window.
  • Layer-wise Heterogeneity: Not all layers contribute equally to the cache burden. Lower layers often exhibit more uniform attention, while deeper layers focus on specific tokens. Strategies like PyramidKV exploit this by allocating more cache budget to the layers that require it most.
  • Memory-Bandwidth Bottleneck: In many inference scenarios, the GPU is "memory-bound" rather than "compute-bound." The time spent moving KV cache data from VRAM to the processor is the primary bottleneck, which is why even lossy compression like quantization can lead to massive end-to-end speedups.

Key Results and Benchmarks

The effectiveness of these strategies is evaluated using diverse benchmarks:

  • Performance Gains: System-level optimizations like vLLM can increase serving throughput by 2-4x. Quantization techniques like KIVI can compress the KV cache to 2-bit precision with negligible accuracy loss, effectively enabling 8x larger contexts.
  • Architectural Efficiency: DeepSeek-V2’s MLA reduces the KV cache size by up to 93% compared to standard transformers, representing a significant leap in efficiency.
  • Benchmarks: Text-based benchmarks like LongBench and RULER test long-context capabilities, while multi-modal benchmarks like MileBench evaluate performance on long video or high-resolution image inputs.

Future Directions

Despite significant progress, several challenges remain. Future research must address the combinatorial evaluation of stacked techniques (e.g., combining quantization with eviction), develop dynamic workloads that adapt precision in real-time, and investigate the privacy and security implications of token eviction patterns, which might inadvertently leak information about prompt content.

Summary updated

BibTeX
@article{li2025survey,
  author = {Haoyang LI and Yiming Li and Anxin Tian and Tianhao Tang and Zhanchao Xu and Xuejia Chen and Nicole HU and Wei Dong and Li Qing and Lei Chen},
  title = {{A Survey on Large Language Model Acceleration based on KV Cache Management}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=z3JZzu9EA3},
}
Figure