Papers › Identify Critical KV Cache in LLM Inference from an Output Perturbation Perspective

Identify Critical KV Cache in LLM Inference from an Output Perturbation Perspective

6 Feb 2025arXiv:2502.03805archive 2025-07-28

Yuan Feng, Junlin Lv, Yukun Cao, Xike Xie, S Kevin Zhou

Large language models have revolutionized natural language processing but face significant challenges of high storage and runtime costs, due to the transformer architecture's reliance on self-attention, particularly the large Key-Value (KV) cache for long-sequence inference. Recent efforts to reduce KV cache size by pruning less critical entries based on attention weights remain empirical and lack formal grounding. This paper presents a formal study on identifying critical KV cache entries by analyzing attention output perturbation. Our analysis reveals that, beyond attention weights, the value states within KV entries and pretrained parameter matrices are also crucial. Based on this, we propose a perturbation-constrained selection algorithm that optimizes the worst-case output perturbation to identify critical entries. Evaluations on the Needle-in-a-Haystack test and Longbench benchmark show our algorithm enhances state-of-the-art cache eviction methods. Further empirical analysis confirms that our algorithm achieves lower output perturbations in over 92% attention heads in Llama model, thereby providing a significant improvement over existing methods.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2502.03805")

Code

Syntology Ran 3 of 11 code samples harvested from 2 repositories linked to this paper; 8 have no recorded run. Of those that ran: 1 ran · fixture could not drive it; 2 ran with no contract checked.

By repository: official repository: 4 samples from 1 repository, 0 ran; found in paper text by Syntology: 7 samples from 1 repository, 3 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

NVIDIA/kvpress officialmentioned in papermentioned on GitHubpytorch report
ffy0/adakv mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested; 3 ran; 0 honoured the contract we drafted; 8 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · fixture could not drive it
2ran
8unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

BasePress NVIDIA/kvpress/kvpress/presses/criticalkv_press.py official repository unverified Apache-2.0 (permissive) · 1bb41fbe40f0cb94 · report
CriticalKVPress NVIDIA/kvpress/kvpress/presses/criticalkv_press.py official repository unverified Apache-2.0 (permissive) · 05f4c9404e12f85a · report
ExpectedAttentionPress NVIDIA/kvpress/kvpress/presses/criticalkv_press.py official repository unverified Apache-2.0 (permissive) · 34a4bcd44bd02b5b · report
ScorerPress NVIDIA/kvpress/kvpress/presses/criticalkv_press.py official repository unverified Apache-2.0 (permissive) · bc245f692797739a · report
DynamicCacheSplitHeadFlatten FFY0/DefensiveKV/kvpress/presses/criticalkv_press.py found in paper text by Syntology ran Apache-2.0 (permissive) · 653f147f7dedf90f · report
MetaData FFY0/DefensiveKV/kvpress/presses/criticalkv_press.py found in paper text by Syntology ran Apache-2.0 (permissive) · 346206adb8bf5312 · report
get_prerope_query_states FFY0/DefensiveKV/kvpress/presses/criticalkv_press.py found in paper text by Syntology ran · fixture could not drive it Apache-2.0 (permissive) · 24eafaba79154752 · report
BasePress FFY0/DefensiveKV/kvpress/presses/criticalkv_press.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 7d325a6d956c95ae · report
CriticalKVPress FFY0/DefensiveKV/kvpress/presses/criticalkv_press.py found in paper text by Syntology unverified Apache-2.0 (permissive) · bbb411fe894a3c42 · report
ExpectedAttentionPress FFY0/DefensiveKV/kvpress/presses/criticalkv_press.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 77ac43dd592848b4 · report
ScorerPress FFY0/DefensiveKV/kvpress/presses/criticalkv_press.py found in paper text by Syntology unverified Apache-2.0 (permissive) · 02fb35ba14327c55 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionLLaMAPruningSoftmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections