Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Time

Zichang Liu, Aditya Desai, Fangshuo Liao, Weitao Wang, Victor Xie, Zhaozhuo Xu, Anastasios Kyrillidis, Anshumali Shrivastava · DOI

Abstract

Large Language Models (LLMs) face significant deployment challenges due to the memory requirements of the Key-Value (KV) cache during inference, particularly as context windows and batch sizes scale. We present Scissorhands, a system designed to reduce the KV cache footprint by up to 5x without requiring model fine-tuning. Scissorhands leverages the "Persistence of Importance" hypothesis—the empirical observation that tokens influential in early generation steps remain influential throughout the sequence. By maintaining a fixed memory budget and pruning unimportant tokens at test time, Scissorhands enables higher inference throughput and lower hardware requirements while preserving model accuracy.

1. Introduction

While the parameter counts of models like GPT-4 and LLaMA often dominate discussions regarding model size, the operational bottleneck during inference is frequently the Key-Value (KV) cache. To avoid redundant computations, LLMs store the keys and values of all previous tokens in a sequence. As the context length grows and batch sizes increase to maximize throughput, the KV cache can exceed the size of the model weights themselves. For instance, an OPT-175B model processing a batch of 128 sequences can require nearly 1 TB of VRAM for the KV cache alone, far exceeding the capacity of modern GPUs. This memory pressure forces a trade-off: engineers must either limit context length or reduce batch sizes, both of which severely impact the cost-efficiency of LLM deployment.

2. The Persistence of Importance Hypothesis

The core innovation of Scissorhands is the discovery and exploitation of the "Persistence of Importance" hypothesis. Through empirical analysis, researchers observed that attention sparsity is not random; rather, it follows a predictable pattern. In over 90% of transformer layers, the tokens that receive high attention scores from early tokens in a sequence continue to be the primary focus for subsequent tokens.

This suggests that the model's "attention" is concentrated on a small subset of pivotal tokens. Much like a human reader skims a long text and retains only the most critical points to understand the conclusion, Scissorhands identifies these pivotal tokens early and discards the "memory fat"—tokens that contribute little to the final output.

3. The Scissorhands Framework

Scissorhands operates as a plug-and-play management system for the KV cache, functioning under a strict memory budget. Unlike traditional pruning methods that might require retraining, Scissorhands works entirely at test time. The algorithm employs a strategy similar to a "Least Recently Used" (LRU) cache, adapted for attention importance:

  1. Importance Tracking: The system monitors attention scores over a defined "history window."
  2. Recent Token Protection: To ensure the model has enough context to establish importance, a "recent window" of tokens is always preserved.
  3. Dynamic Pruning: When the memory budget is reached, Scissorhands identifies tokens that have consistently received low attention scores and prunes them from the KV cache.

This approach ensures that the most influential information is retained while the total memory footprint remains capped.

4. Experimental Evaluation

To validate the effectiveness of Scissorhands, the researchers evaluated the system across a variety of benchmarks using the OPT model family (up to OPT-66B):

  • Language Modeling: Perplexity was measured using the C4 (Colossal Clean Crawled Corpus) dataset to ensure that pruning did not degrade the model's fundamental linguistic capabilities.
  • Downstream Tasks: The system was tested on 5-shot accuracy across several reasoning benchmarks, including Hellaswag (commonsense reasoning), MathQA (mathematical reasoning), PIQA (physical interaction), and Winogrande (adversarial pronoun resolution).

5. Key Results

Scissorhands demonstrates that significant memory reduction is possible without sacrificing performance:

  • 5x Compression: The system achieves an 80% reduction in KV cache memory usage with virtually no loss in model accuracy or perplexity.
  • Increased Throughput: By reducing the memory required per sequence, Scissorhands allows for significantly larger batch sizes on existing hardware, directly increasing the number of requests a server can process per second.
  • Synergy with Quantization: Scissorhands is complementary to 4-bit quantization. When combined, these techniques allow massive models to run on consumer-grade or mid-range enterprise hardware.
  • Theoretical Robustness: The paper provides mathematical proofs (Theorems 3.1 and 4.1) demonstrating that the error introduced by pruning is bounded, particularly under the power-law attention distributions common in trained Transformers.

6. Discussion and Limitations

While Scissorhands offers a powerful solution for memory management, some limitations remain. The researchers noted that the persistence of importance is a learned trait; it does not exist in randomly initialized models, suggesting it is a product of the training process rather than the Transformer architecture itself. Additionally, while trends suggest the method scales effectively to trillion-parameter models, hardware constraints limited the current study to the OPT-66B scale. Future research may explore whether these attention patterns are linked to common generation issues, such as repetitive loops, and how pruning might mitigate or exacerbate such behaviors.

7. Conclusion

Scissorhands provides a mathematically grounded and computationally efficient method for trimming the memory overhead of LLMs. By recognizing that models do not need to remember every token to maintain high-quality generation, Scissorhands paves the way for more accessible and scalable AI inference.

Summary updated

BibTeX
@inproceedings{liu2023scissorhands,
  author = {Zichang Liu and Aditya Desai and Fangshuo Liao and Weitao Wang and Victor Xie and Zhaozhuo Xu and Anastasios Kyrillidis and Anshumali Shrivastava},
  title = {{Scissorhands: Exploiting the Persistence of Importance Hypothesis for LLM KV Cache Compression at Test Time}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=JZfg6wGi6g},
}
Figure