Quantize What Counts: More for Keys, Less for Values

Mohsen Hariri, Alan Luo, Weicong Chen, Shaochen Zhong, Tianyi Zhang +4 more
2/20/2025
14 citations
cs.LG

Official code: mohsenhariri/spectral-kv (21 stars, Python, MIT, last commit 2025-11-07).

Abstract

Large Language Models (LLMs) suffer inference-time memory bottlenecks dominated by the attention Key-Value (KV) cache, which scales with model size and context length. While KV-cache quantization alleviates this cost, bit allocation between keys and values is often tuned heuristically, lacking theoretical grounding and generalizability.

Show full abstract

This paper proposes two theorems that anchor mixed-precision KV quantization in the intrinsic geometry of Transformer models. First, key projections systematically have larger spectral and Frobenius norms than value matrices, implying higher information density along the key path. Second, for any given memory budget, prioritizing precision for keys over values strictly reduces quantization error and better preserves accuracy. Empirical evaluations across various prominent LLMs and benchmarks show that key-favored allocations (e.g., 4-bit keys, 2-bit values) retain up to 98.3\% accuracy compared to uniform allocations (e.g., 4-bit for both), while conserving memory. These results transform bit allocation from ad hoc tuning into a theoretically grounded, geometry-driven design principle for efficient LLM inference. Source code is available at https://github.com/mohsenhariri/spectral-kv.

View on arXivView PDF

Code Implementations(1)

MIT

Quantize What Counts: More for Keys, Less for Values (ACL 2026)

214Python, Jupyter NotebookFeb 27, 20251 years agoMIT

Similar Papers

Cite this paper

@article{hariri2025quantize,
  title  = {Quantize What Counts: More for Keys, Less for Values},
  author = {Mohsen Hariri and Alan Luo and Weicong Chen and Shaochen Zhong and Tianyi Zhang and Qifan Wang and Xia Hu and Xiaotian Han and Vipin Chaudhary},
  year   = {2025},
  eprint = {2502.15075},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.15075v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.15075.svg)](https://codeofpaper.com/paper/2502.15075)

Discussion