KV Cache is 1 Bit Per Channel: Efficient Large Language Model Inference with Coupled Quantization

Tianyi Zhang, Jonah Wonkyu Yi, Zhaozhuo Xu, Anshumali Shrivastava

Introduction

As Large Language Models (LLMs) scale to handle massive context lengths and larger batch sizes, the memory footprint of the Key-Value (KV) cache has become a critical bottleneck. Storing activations for every token to avoid recomputation often exhausts GPU memory, leading to a "von Neumann bottleneck" where data transfer speeds limit performance. While quantization offers a solution by reducing bit-widths, traditional methods typically suffer catastrophic accuracy drops below 4 bits. This paper introduces Coupled Quantization (CQ), a novel approach that compresses the KV cache to as little as 1 bit per channel while maintaining model integrity.

Methodology: Coupled Quantization

Standard quantization techniques treat each activation channel as an independent scalar. In contrast, CQ exploits the inherent inter-dependencies between channels by grouping them and quantizing them as a single vector unit.

Comparison between standard channel-wise quantization and the proposed Coupled Quantization (CQ).

The CQ framework consists of two primary components:

  1. Channel Coupling: By treating a group of channels (e.g., 8 channels) as a single multi-dimensional vector, CQ finds an optimal "centroid" in that space. This vector quantization approach captures the joint distribution of activations more effectively than independent scalar quantization.
  2. Fisher-Guided Centroid Learning: Recognizing that not all activations are equally important, the authors employ the Fisher Information Matrix to identify salient activations. During an offline calibration phase, the algorithm prioritizes preserving these influential values, ensuring that the model's core logic remains intact even under extreme compression.

Theoretical Motivation

The effectiveness of CQ is rooted in information theory. The authors observed that the joint entropy of multiple activation channels grows significantly slower than the sum of their individual (marginal) entropies. This indicates high redundancy and strong correlations between channels. By coupling these channels, CQ leverages the low-rank structure naturally produced by deep neural networks, encoding information more efficiently than "lone wolf" channel-wise methods.

Experimental Results

The researchers evaluated CQ on several open-source models, including LLaMA-7b/13b and Mistral-7b, using benchmarks like WikiText-2 and zero-shot reasoning tasks (WinoGrande, PIQA, ARC).

Perplexity and quantization error for LLaMA-7b under various CQ configurations, showing the superiority of Fisher-guided CQ at low bit-widths.

Key findings include:

  • Superiority at Low Bit-Widths: At 2 bits per channel, CQ-4c8b (4 channels coupled into an 8-bit code) maintained a perplexity of 5.97 on LLaMA-7b, remarkably close to the FP16 baseline of 5.68. In comparison, standard 2-bit quantization produced unusable results (perplexity > 11,000).
  • The 1-Bit Milestone: CQ-8c8b successfully achieved a 1-bit-per-channel average. On LLaMA-2-13b, it reached a perplexity of 6.55, outperforming previous state-of-the-art methods like KVQuant which struggle with stability at such extreme compression levels.
  • Efficiency: The storage overhead for centroids is minimal (<1% of model weights), and the calibration process is fast, requiring only minutes on a single GPU.

Conclusion and Future Work

Coupled Quantization demonstrates that 1-bit KV caches are not only possible but practical for high-quality LLM inference. While current hardware is optimized for power-of-two bit widths, future work involving custom CUDA kernels could unlock significant speedups. Additionally, exploring dynamic quantization that adapts to real-time inputs and testing performance in million-token context scenarios remain promising avenues for further research.

Summary updated

BibTeX
@inproceedings{zhang2024kv,
  author = {Tianyi Zhang and Jonah Wonkyu Yi and Zhaozhuo Xu and Anshumali Shrivastava},
  title = {{KV Cache is 1 Bit Per Channel: Efficient Large Language Model Inference with Coupled Quantization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=pNnvzQsS4P},
}
Figure