Homogeneous Keys, Heterogeneous Values: Exploiting Local KV Cache Asymmetry for Long-Context LLMs

Wanyun Cui, Mingwei Xu
6/4/2025
cs.CL

Official code: the-scale-lab/Asymkv (9 stars, Apache-2.0, last commit 2025-11-25).

Abstract

Recent advances in Large Language Models (LLMs) have highlighted the critical importance of extending context length, yet the quadratic complexity of attention mechanisms poses significant challenges for efficient long-context modeling. KV cache compression has emerged as a key approach to address this challenge. Through extensive empirical analysis, we reveal a fundamental yet previously overlooked asymmetry in KV caches: while adjacent keys receive similar attention weights ({\it local homogeneity}), adjacent values demonstrate distinct {\it heterogeneous} distributions. This key-value asymmetry reveals a critical limitation in existing compression methods that treat keys and values uniformly. To address the limitation, we propose a training-free compression framework (AsymKV) that combines homogeneity-based key merging with a mathematically proven lossless value compression. Extensive experiments demonstrate that AsymKV consistently outperforms existing long-context methods across various tasks and base models. For example, on LLaMA3.1-8B, AsymKV achieves an average score of 43.95 on LongBench, surpassing SOTA methods like H$_2$O (38.89) by a large margin.Our code can be found in this link:https://github.com/the-scale-lab/Asymkv.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

This is the repository for [Homogeneous Keys, Heterogeneous Values: Exploiting Local KV Cache Asymmetry for Long-Context LLMs](https://arxiv.org/html/2506.05410v1),presented at NeurIPS 2025.

91Python, Jupyter NotebookOct 22, 202511 months agoApache-2.0

Similar Papers

Cite this paper

@article{cui2025homogeneous,
  title  = {Homogeneous Keys, Heterogeneous Values: Exploiting Local KV Cache Asymmetry for Long-Context LLMs},
  author = {Wanyun Cui and Mingwei Xu},
  year   = {2025},
  eprint = {2506.05410},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.05410v2}
}

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/2506.05410.svg)](https://codeofpaper.com/paper/2506.05410)

Discussion