GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM

Hao Kang, Qingru Zhang, Souvik Kundu, Geonhwa Jeong, Zaoxing Liu, Tushar Krishna, Tuo Zhao · DOI

Introduction

As Large Language Models (LLMs) scale, the memory requirements for storing Key-Value (KV) caches during inference have become a significant bottleneck. For a 30B parameter model, the KV cache can exceed 180GB, creating a "memory wall" that limits batch sizes and sequence lengths. While quantization to 4-bit or 2-bit precision can reduce this footprint, it often introduces approximation errors that compound during complex tasks like Chain-of-Thought (CoT) reasoning. This "error accumulation" causes models to drift from logical paths, rendering outputs nonsensical.

The GEAR Framework

To address these challenges, we introduce GEAR (GEnerative inference with Approximation Error Reduction), a framework that decomposes the KV cache matrix into three synergistic components:

  1. Quantized Backbone ($D$): Compresses the majority of entries (e.g., 98%) to ultra-low precision (like 2-bit) using uniform quantization.
  2. Low-Rank Matrix ($L$): Captures systematic, coherent quantization errors using an efficient power iteration SVD solver.
  3. Sparse Matrix ($S$): Preserves high-magnitude "outlier" entries in high precision (FP16) to prevent them from distorting the quantization scale.

GEAR also employs a streaming buffer for recent tokens and a custom GPU kernel to minimize the computational overhead of managing these components.

Key Results and Analysis

GEAR achieves near-lossless performance even at 2-bit precision. On the LLaMA3-8B model using the GSM8k benchmark, GEAR maintained an accuracy of 54.59%, effectively matching the FP16 baseline of 54.21%. In contrast, previous state-of-the-art methods like KIVI saw performance drop to 30.17%.

Figure 5: Comparison of approximation error, logit drift, and final accuracy on GSM8k-CoT. GEAR significantly reduces error and logit difference compared to baselines.

Beyond accuracy, GEAR enables massive throughput gains—ranging from 2.1x to 5.07x—by allowing for larger batch sizes. It also reduces peak memory usage by up to 2.39x and increases the maximum sequence length on a single GPU from approximately 5k to over 7.2k tokens.

Orthogonality and Versatility

A key insight of this work is that GEAR is not a standalone quantization method but a recipe that can be applied to existing techniques. By augmenting backbones like KIVI or KCVT with GEAR's low-rank and sparse components, we can restore accuracy to near-lossless levels across various quantization schemes.

Figure 6: Accuracy improvement when augmenting various quantization backbones with GEAR-L and GEAR. The framework consistently restores performance to near-baseline levels.

Conclusion and Future Work

GEAR successfully mitigates the error accumulation problem in compressed KV caches, particularly for reasoning-heavy tasks. While the current implementation uses uniform rank allocation across layers, future work will explore adaptive budgeting to intelligently allocate memory to the most critical attention heads. Further low-level hardware optimizations could also reduce the minor latency overhead introduced by the multi-component addition process.

Summary updated

BibTeX
@misc{kang2024gear,
  author = {Hao Kang and Qingru Zhang and Souvik Kundu and Geonhwa Jeong and Zaoxing Liu and Tushar Krishna and Tuo Zhao},
  title = {{GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM}},
  year = {2024},
  eprint = {2403.05527},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.05527},
}
Figure