SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.19258 · 2024

Not All Heads Matter: A Head-Level KV Cache Compression Method with Integrated Retrieval and Reasoning

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 5 failures of our instrument; 3 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2410.19258.json · badge: /api/ran/2410.19258.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
fyyfu/headkv canonical (classifier label)
classifier basis: census
6 ran · 3 no recorded run
FunctionStatusWhere it lives
repeat_kv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
fyyfu/headkv/headkv/snapkv_utils.py
pointer only (licence: NONE) · get_code("3c76e52815c5401d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

build_chat Ran
ran; our contract draft was wrong, not the code
fyyfu/headkv/run_longbench.py
pointer only (licence: NONE) · get_code("3ddd62fbad41e698")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

count_score Ran
ran, honoured the contract we drafted
fyyfu/headkv/metrics.py
pointer only (licence: NONE); the stored copy get_code serves, from borealisai/radar-decoding, is pointer only (licence: LGPL-3.0) · get_code("b349b79d9cc2934b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

normalize_answer Ran
ran; our contract draft was wrong, not the code
fyyfu/headkv/metrics.py
pointer only (licence: NONE); the stored copy get_code serves, from borealisai/radar-decoding, is pointer only (licence: LGPL-3.0) · get_code("e7e75981cb464788")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

normalize_zh_answer Ran
ran; our contract draft was wrong, not the code
fyyfu/headkv/metrics.py
pointer only (licence: NONE); the stored copy get_code serves, from borealisai/radar-decoding, is pointer only (licence: LGPL-3.0) · get_code("8c5c581f9264c810")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

parse_args Ran
ran; our contract draft was wrong, not the code
fyyfu/headkv/eval_babilong.py
pointer only (licence: NONE) · get_code("db4b28c72d99c354")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

fixed_LlamaModel_forward Not yet run
unverified (harvested, no recorded run)
fyyfu/headkv/headkv/fixed_llama_hijack.py
pointer only (licence: NONE) · get_code("1ff384226516c0cb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

fixed_MistralModel_forward Not yet run
unverified (harvested, no recorded run)
fyyfu/headkv/headkv/fixed_mistral_hijack.py
pointer only (licence: NONE) · get_code("ea5369d01a779749")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

get_cuda_bare_metal_version Not yet run
unverified (harvested, no recorded run)
fyyfu/headkv/csrc/build.py
pointer only (licence: NONE) · get_code("f678f94474df1f5a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, fyyfu/headkv when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 6 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 4 the same month, 6 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
repeat_kv 243 other papers
119 dated earlier, 24 the same month, 96 later, 2 same year, order not determinable, 2 undated · 22 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2203.08913 (2022-03)
Memorizing Transformers
2305.17888 (2023-05)
LLM-QAT: Data-Free Quantization Aware Training for Large Language Models
and 240 more not named here
normalize_answer 133 other papers
93 dated earlier, 5 the same month, 34 later, 1 undated · 1 only as an assembly brick
1508.06615 (2015-08)
Character-Aware Neural Language Models
1606.05250 (2016-06)
SQuAD: 100,000+ Questions for Machine Comprehension of Text
1608.07905 (2016-08)
Machine Comprehension Using Match-LSTM and Answer Pointer
and 130 more not named here
normalize_zh_answer 28 other papers
17 dated earlier, 2 the same month, 7 later, 1 same year, order not determinable, 1 undated
2311.04934 (2023-11)
Prompt Cache: Modular Attention Reuse for Low-Latency Inference
2311.09198 (2023-11)
Never Lost in the Middle: Mastering Long-Context Question Answering with Position-Agnostic Decompositional Training
2024.findings-emnlp.230 (2024 (year only))
CLongEval: A Chinese Benchmark for Evaluating Long-Context Large Language Models
and 25 more not named here
count_score 24 other papers
14 dated earlier, 2 the same month, 7 later, 1 undated
2311.04934 (2023-11)
Prompt Cache: Modular Attention Reuse for Low-Latency Inference
2311.09198 (2023-11)
Never Lost in the Middle: Mastering Long-Context Question Answering with Position-Agnostic Decompositional Training
2402.02750 (2024-02)
KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache
and 21 more not named here
build_chat 3 other papers
3 later
2025.findings-emnlp.429 (2025 (year only))
More Tokens, Lower Precision: Towards the Optimal Token-Precision Trade-off in KV Cache Compression
2505.23416 (2025-05)
KVzip: Query-Agnostic KV Cache Compression with Context Reconstruction
2506.08373 (2025-06)
Draft-based Approximate Inference for LLMs
get_cuda_bare_metal_version 2 other papers
1 dated earlier, 1 later
2312.00752 (2023-12)
Mamba: Linear-Time Sequence Modeling with Selective State Spaces
2505.23416 (2025-05)
KVzip: Query-Agnostic KV Cache Compression with Context Reconstruction

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Key-Value (KV) caching is a common technique to enhance the computational efficiency of Large Language Models (LLMs), but its memory overhead grows rapidly with input length. Prior work has shown that not all tokens are equally important for text generation, proposing layer-level KV cache compression to selectively retain key information. Recognizing the distinct roles of attention heads in generation, we propose HeadKV, a head-level KV cache compression method, and HeadKV-R2, which leverages a novel contextual reasoning ability estimation for compression. Our approach operates at the level of individual heads, estimating their importance for contextual QA tasks that require both retrieval and reasoning capabilities. Extensive experiments across diverse benchmarks (LongBench, LooGLE), model architectures (e.g., Llama-3-8B-Instruct, Mistral-7B-Instruct), and long-context abilities tests demonstrate that our head-level KV cache compression significantly outperforms strong baselines, particularly in low-resource settings (KV size = 64 & 128). Notably, our method retains just 1.5% of the KV cache while achieving 97% of the performance of the full KV cache on the contextual question answering benchmark. Codes are available at https://github.com/FYYFU/HeadKV

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.19258")
get_code_for_paper("2410.19258")
have("2410.19258")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2410.19258.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2410.19258.svg)](https://syntology.ai/paper/2410.19258)

Connect an agent — have() is free.