English

KeepKV: Achieving Periodic Lossless KV Cache Compression for Efficient LLM Inference

Machine Learning 2025-12-01 v2 Artificial Intelligence Computation and Language

Abstract

Efficient inference of large language models (LLMs) is hindered by an ever-growing key-value (KV) cache, making KV cache compression a critical research direction. Traditional methods selectively evict less important KV cache entries, which leads to information loss and hallucinations. Recently, merging-based strategies have been explored to retain more information by merging KV pairs that would be discarded; however, these existing approaches inevitably introduce inconsistencies in attention distributions before and after merging, causing degraded generation quality. To overcome this challenge, we propose KeepKV, a novel adaptive KV cache merging method designed to preserve performance under strict memory constraints, achieving single-step lossless compression and providing error bounds for multi-step compression. KeepKV introduces the Electoral Votes mechanism that records merging history and adaptively adjusts attention scores. Moreover, it further leverages a novel Zero Inference-Perturbation Merging method, compensating for attention loss resulting from cache merging. Extensive experiments on various benchmarks and LLM architectures demonstrate that KeepKV substantially reduces memory usage while successfully retaining essential context information, achieving over 2x inference throughput improvement and maintaining superior generation quality even with only 10% KV cache budgets.

Keywords

Cite

@article{arxiv.2504.09936,
  title  = {KeepKV: Achieving Periodic Lossless KV Cache Compression for Efficient LLM Inference},
  author = {Yuxuan Tian and Zihan Wang and Yebo Peng and Aomufei Yuan and Zhiming Wang and Bairen Yi and Xin Liu and Yong Cui and Tong Yang},
  journal= {arXiv preprint arXiv:2504.09936},
  year   = {2025}
}

Comments

14 pages, 20 figures

R2 v1 2026-06-28T22:57:12.710Z