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

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Devoto, Alessio, Jeblick, Maximilian, Jégou, Simon
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866918152369078272
author Devoto, Alessio
Jeblick, Maximilian
Jégou, Simon
author_facet Devoto, Alessio
Jeblick, Maximilian
Jégou, Simon
contents 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}$.
format Preprint
id arxiv_https___arxiv_org_abs_2510_00636
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Expected Attention: KV Cache Compression by Estimating Attention from Future Queries Distribution
Devoto, Alessio
Jeblick, Maximilian
Jégou, Simon
Artificial Intelligence
Computation and Language
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}$.
title Expected Attention: KV Cache Compression by Estimating Attention from Future Queries Distribution
topic Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2510.00636