AdaCode: Adaptive Lossless Compression for BFloat16 KV Cache

Changshi Li, Peiyu Liu, Liang Chen, Yuyao Zhai, Jerry Zhijian Yang


Abstract
The Key–Value (KV) cache has become a critical memory bottleneck that significantly hinders the deployment of large language models, especially under long-context inference. Existing approaches either introduce non-negligible errors through lossy compression, or are tightly coupled to specific tasks or model structures, limiting their general applicability. In this work, we first identify that the exponent values in BFloat16 KV caches are highly concentrated, and further prove theoretically that such concentration is inherent to LLMs, ensuring the broad generalizability of our method. Leveraging this insight, we propose AdaCode, a bit-exact lossless compression framework. The core idea is to encode frequent exponents with a short fixed-length code while storing rare outliers explicitly. AdaCode consists of two key components: (1) a minimal-cost optimization that selects the optimal code length and exponent range by balancing the storage overhead of short codes against that of outliers, complemented by a lightweight online adjuster to handle occasional distribution shifts without GPU overhead; and (2) a GPU-friendly byte-aligned packing format together with offline calibration for parameter precomputation. Experiments show that AdaCode achieves an average compression ratio of 71.78% on diverse LLMs and 70.26% on vision-language models, with bit-exact identical recovery and no accuracy loss, effectively alleviating the KV cache memory bottleneck. The codes are available at https://github.com/lichangshiwhu/Adacode.
Anthology ID:
2026.emnlp-main.269
Volume:
Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
EMNLP
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
6112–6130
Language:
URL:
https://aclanthology.org/2026.emnlp-main.269/
DOI:
Bibkey:
Cite (ACL):
Changshi Li, Peiyu Liu, Liang Chen, Yuyao Zhai, and Jerry Zhijian Yang. 2026. AdaCode: Adaptive Lossless Compression for BFloat16 KV Cache. In Proceedings of the 2026 Conference on Empirical Methods in Natural Language Processing, pages 6112–6130, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
AdaCode: Adaptive Lossless Compression for BFloat16 KV Cache (Li et al., EMNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.emnlp-main.269.pdf