Skip to main content
QUICK REVIEW

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

Zichang Liu, Aditya Desai|arXiv (Cornell University)|May 26, 2023
Topic ModelingComputer Science10 citations
TL;DR

The paper proposes Scissorhands, a KV cache compression method for LLM inference that leverages the persistence of importance hypothesis to keep only pivotal tokens, reducing KV cache memory up to 5× without finetuning. It also shows compatibility with 4-bit quantization and preserves model quality.

ABSTRACT

Large language models(LLMs) have sparked a new wave of exciting AI applications. Hosting these models at scale requires significant memory resources. One crucial memory bottleneck for the deployment stems from the context window. It is commonly recognized that model weights are memory hungry; however, the size of key-value embedding stored during the generation process (KV cache) can easily surpass the model size. The enormous size of the KV cache puts constraints on the inference batch size, which is crucial for high throughput inference workload. Inspired by an interesting observation of the attention scores, we hypothesize the persistence of importance: only pivotal tokens, which had a substantial influence at one step, will significantly influence future generations. Based on our empirical verification and theoretical analysis around this hypothesis, we propose Scissorhands, a system that maintains the memory usage of the KV cache at a fixed budget without finetuning the model. In essence, Scissorhands manages the KV cache by storing the pivotal tokens with a higher probability. We validate that Scissorhands reduces the inference memory usage of the KV cache by up to 5X without compromising model quality. We further demonstrate that Scissorhands can be combined with 4-bit quantization, traditionally used to compress model weights, to achieve up to 20X compression.

Motivation & Objective

  • Motivate and address the KV cache memory bottleneck in LLM inference, where KV cache memory can exceed model size and limit batch throughput.
  • Introduce the Persistence of Importance Hypothesis to identify tokens that remain influential across steps.
  • Develop a budget-conscious KV cache compression method that preserves accuracy without retraining.
  • Provide theoretical justification that compressed attention can approximate original attention outputs.
  • Demonstrate compatibility with quantization to further enhance compression.

Proposed method

  • Empirically observe repetitive attention patterns and define the Persistence of Importance Hypothesis.
  • Develop Algorithm 1 and Algorithm 2 (Scissorhands) to maintain a KV cache under a fixed budget by keeping high-attention tokens and discarding non-influential ones.
  • Use a history window to estimate token importance and a budgeted KV-cache replacement strategy inspired by reservoir sampling and LRU.
  • Provide a theoretical bound showing the expected approximation error between the original and budgeted KV-cache outputs under power-law attention score distributions (Theorem 4.1).
  • Distribute memory budgets across model layers and heads, prioritizing later layers to counteract persistence decline.

Experimental results

Research questions

  • RQ1Does the Persistence of Importance Hypothesis hold across different LLMs and layers?
  • RQ2Can KV cache memory be reduced under a fixed budget without retraining while preserving generation quality?
  • RQ3What is the theoretical and empirical impact of budgeted KV-cache on attention outputs and downstream tasks?
  • RQ4Is Scissorhands compatible with post-training quantization such as 4-bit quantization?

Key findings

  • Scissorhands reduces KV cache memory by up to 5× without degrading model quality on OPT models across language modeling and downstream tasks.
  • The persistence ratio commonly exceeds 95% across layers, indicating that earlier pivotal tokens largely determine later importance.
  • Attention-score-based token dropping preserves similar outputs to the original model, with negligible accuracy loss up to 5× compression on OPT-66B.
  • Quantization (4-bit) remains compatible with Scissorhands, maintaining performance on evaluated tasks.
  • Theoretical analysis (Theorem 3.1 and 4.1) links attention weights, MLP skip connections, and budgeted token retention to approximation behavior and error bounds.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.