Expected Attention: KV Cache Compression by Estimating Attention from Future Queries Distribution

Alessio Devoto, Maximilian Jeblick, Simon Jégou
10/1/2025
cs.AIcs.CL

No official code found. Best implementation: ModeEric/Expected-Attention-Tests (0 stars, Apache-2.0, last commit 2025-10-12).

Abstract

Memory consumption of the Key-Value (KV) cache represents a major bottleneck for efficient large language model inference. While attention-score-based KV cache pruning shows promise, it faces critical practical limitations: attention scores from future tokens are unavailable during compression, and modern implementations like Flash Attention do not materialize the full attention matrix, making past scores inaccessible. To overcome these challenges, we introduce $\textbf{Expected Attention, a training-free compression method}$ that estimates KV pairs importance by predicting how future queries will attend to them. Our approach leverages the distributional properties of LLM activations to compute expected attention scores in closed form for each KV pair. These scores enable principled ranking and pruning of KV pairs with minimal impact on the residual stream, achieving effective compression without performance degradation. Importantly, our method operates seamlessly across both prefilling and decoding phases, consistently outperforming state-of-the-art baselines in both scenarios. Finally, $\textbf{we release KVPress, a comprehensive library to enable researchers to implement and benchmark KV cache compression methods, already including more than 20 techniques}$.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

experiments on https://arxiv.org/abs/2510.00636

00Oct 12, 20251 years agoApache-2.0

Similar Papers

Cite this paper

@article{devoto2025expected,
  title  = {Expected Attention: KV Cache Compression by Estimating Attention from Future Queries Distribution},
  author = {Alessio Devoto and Maximilian Jeblick and Simon Jégou},
  year   = {2025},
  eprint = {2510.00636},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2510.00636v1}
}

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

Discussion