Large Language Models (LLMs) are increasingly tasked with processing massive contexts, from entire codebases to long-form documents. However, these models face a fundamental physical constraint: the Key-Value (KV) cache bottleneck. During autoregressive decoding, Transformers store the "Key" and "Value" vectors of all previous tokens to avoid redundant calculations. As Shuo Yang 0011 et al. and Binhang Yuan et al. observe, this cache grows linearly with sequence length. For long-context tasks, the memory footprint of the KV cache can eventually exceed the size of the model weights themselves, leading to out-of-memory errors or forcing slow data offloading to CPU memory.
To overcome this "memory wall," researchers are developing techniques to compress the KV cache by exploiting three types of redundancy: token-wise, bit-wise, and layer-wise.
Token Eviction: Identifying What Matters
Not every token in a 100,000-token prompt is equally important for generating the next word. The most common strategy for memory reduction is eviction, where less critical tokens are dropped from the cache.
Early methods relied on simple heuristics, but recent work uses more sophisticated signals to decide which tokens to keep:
- Attention Sinks and Heavy Hitters: Certain tokens, like the very first token in a sequence (the "sink") or those that frequently receive high attention scores ("heavy hitters"), are vital for stability. Kehong Yuan introduces KVSink, which identifies these stable outliers in early layers to preserve them in high precision.
- Learned Importance: Instead of heuristics, Binhang Yuan et al. propose LOCRET, which trains lightweight "retaining heads" to predict which tokens will be useful for future retrieval.
- Semantic Merging: Rather than simply deleting tokens, Ziwei He et al. propose WeightedKV, which merges the values of redundant keys into neighboring tokens using a weighted average, preserving the "contextual backdrop" of the sequence.
Quantization: Compressing the Representation
If we cannot reduce the number of tokens, we can reduce the bits used to store each one. Standard models use 16-bit floats, but the KV cache can often be compressed to 4, 2, or even 1 bit.
The challenge in low-bit quantization is maintaining accuracy despite "distribution shifts" in the data. Donghyun Son et al. address this with NSNQuant, a double-normalization approach that forces complex data distributions into a standard normal shape. Similarly, Junyan Li et al. introduce CommVQ, which designs a codebook mathematically "commutative" with Rotary Position Embeddings (RoPE), allowing for nearly lossless 2-bit compression even in long-context scenarios.
Structural Redundancy: Sharing Across Layers
Transformers are deep, but many layers perform similar operations. Researchers have found that the KV cache can be shared across different parts of the model to save space.
- Layer Sharing: Yifei Yang et al. discover a "dissimilarity paradox" with KVSharer: sharing caches between layers that are least alike actually preserves performance better than sharing similar ones. Yixuan Wang et al. further exploit this with CommonKV, which shares parameters across adjacent layers to achieve up to 60% compression.
- Head-wise Specialization: Not all attention heads need a full view of history. The authors of DuoAttention (art_ed73577bcc1d40a9aac6b7720ca31bdd) identify "Retrieval Heads" that need the full cache and "Streaming Heads" that only need a constant-length local window, enabling models to handle millions of tokens on a single GPU.
Dynamic Allocation and Architectural Shifts
Finally, the most efficient systems move away from uniform memory budgets. Meizhi Zhong et al. propose ZigZagKV, which dynamically allocates more memory to "uncertain" layers that need to retain more information.
On the architectural side, Houyi Li and Jingcheng Hu propose Multi-matrix Factorization Attention (MFA). By using low-rank matrix factorization, they decouple the number of attention heads from the KV cache size, allowing for high-performance attention with a cache footprint reduced by over 90%.
By combining these strategies—pruning unimportant tokens, quantizing the remaining ones to ultra-low precision, and sharing representations across the model hierarchy—researchers are transforming the KV cache from a linear bottleneck into a manageable, compressed resource.