Papers › GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM

GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM

8 Mar 2024arXiv:2403.05527archive 2025-07-28

Hao Kang, Qingru Zhang, Souvik Kundu, Geonhwa Jeong, Zaoxing Liu, Tushar Krishna, Tuo Zhao

Key-value (KV) caching has become the de-facto to accelerate generation speed for large language models (LLMs) inference. However, the growing cache demand with increasing sequence length has transformed LLM inference to be a memory bound problem, significantly constraining the system throughput. Existing methods rely on dropping unimportant tokens or quantizing all entries uniformly. Such methods, however, often incur high approximation errors to represent the compressed matrices. The autoregressive decoding process further compounds the error of each step, resulting in critical deviation in model generation and deterioration of performance. To tackle this challenge, we propose GEAR, an efficient KV cache compression framework that achieves near-lossless high-ratio compression. GEAR first applies quantization to majority of entries of similar magnitudes to ultra-low precision. It then employs a low rank matrix to approximate the quantization error, and a sparse matrix to remedy individual errors from outlier entries. By adeptly integrating three techniques, GEAR is able to fully exploit their synergistic potentials. Our experiments demonstrate that compared to alternatives, GEAR achieves near-lossless 4-bit KV cache compression with up to 2.38x throughput improvement, while reducing peak-memory size up to 2.29x. Our code is publicly available at https://github.com/HaoKang-Timmy/GEAR.

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="2403.05527")

Code

Syntology Ran 16 of 22 code samples harvested from 2 repositories linked to this paper; 6 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 2 ran · fixture could not drive it; 13 ran with no contract checked.

By repository: official repository: 19 samples from 1 repository, 13 ran; community (archive-listed): 3 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.

haokang-timmy/gear officialmentioned in papermentioned on GitHubpytorchMIT report
opengear-project/gear mentioned on GitHubpytorchMIT 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

22 samples harvested; 16 ran; 0 honoured the contract we drafted; 6 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 · our draft was wrong
2ran · fixture could not drive it
13ran
6unverified

Licence: 0 of the 22 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.

calculate_zeros_width haokang-timmy/gear/cuda_supported_gear/quant/qmodule.py official repository ran MIT (permissive) · fd8719af3db2c5ae · report
dequant_weight haokang-timmy/gear/cuda_supported_gear/quant/gemv.py official repository ran MIT (permissive) · a9baefdb784da628 · report
dequant_weight_outer haokang-timmy/gear/cuda_supported_gear/quant/gemv.py official repository ran MIT (permissive) · 4d4c20e8d1e678ef · report
extract_ans haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_bbh_cot.py official repository ran fingerprinted MIT (permissive) · 3bbfc4445eea20a9 · report
extract_ans_mmlu haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_aqua_cot.py official repository ran fingerprinted MIT (permissive) · fdbcb8662fd149ba · report
extract_bbh_ans haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_aqua_cot.py official repository ran fingerprinted MIT (permissive) · b96dbfc20b18beb7 · report
if_not_then_None haokang-timmy/gear/cuda_supported_gear/modeling_llamagear.py official repository ran fingerprinted MIT (permissive) · 3e8b5053d14e5887 · report
make_divisible haokang-timmy/gear/cuda_supported_gear/quant/qmodule.py official repository ran fingerprinted MIT (permissive) · ad85b288e9acb9c2 · report
quant_and_pack_kcache haokang-timmy/gear/cuda_supported_gear/quant/new_pack.py official repository ran MIT (permissive) · 901a3668958c9deb · report
quant_and_pack_vcache haokang-timmy/gear/cuda_supported_gear/quant/new_pack.py official repository ran MIT (permissive) · 95a9c97f6ea7d050 · report
reindent haokang-timmy/gear/cuda_supported_gear/quant/timeit_v2.py official repository ran fingerprinted MIT (permissive) · c6b9d9348efc20dc · report
repeat haokang-timmy/gear/cuda_supported_gear/quant/timeit_v2.py official repository ran MIT (permissive) · b9bb89598a35cb87 · report
test_answer_mmlu_ haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_bbh_cot.py official repository ran MIT (permissive) · c119c70eed02c785 · report
evaluate_pred_answer haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_gsm8k.py official repository unverified MIT (permissive) · b6a8148f2f12adc9 · report
load_model_tokenizer haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_aqua_cot.py official repository unverified MIT (permissive) · eb8e4a7084fe84dc · report
parse_pred_ans haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_gsm8k.py official repository unverified MIT (permissive) · d93eb10d932ff2c8 · report
test_answer haokang-timmy/gear/GenerationBench/GenerationTest/evaluation_gsm8k.py official repository unverified MIT (permissive) · b6065f749757a201 · report
timeit haokang-timmy/gear/cuda_supported_gear/quant/timeit_v2.py official repository unverified MIT (permissive) · c743c02d9c56ac78 · report
unpack_and_dequant_kcache haokang-timmy/gear/cuda_supported_gear/quant/new_pack.py official repository unverified MIT (permissive) · e493c68ae46ac587 · report
repeat_kv opengear-project/gear/GenerationBench/GenerationTest/GEARLM/Simulated/modeling_llama_ablation.py community (archive-listed) ran · fixture could not drive it fingerprinted MIT (permissive) · 30d7eec482ebf6b1 · report
apply_rotary_pos_emb opengear-project/gear/GenerationBench/GenerationTest/GEARLM/Simulated/modeling_llama_ablation.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · d61c483a3c2b3156 · report
rotate_half opengear-project/gear/GenerationBench/GenerationTest/GEARLM/Simulated/modeling_llama_ablation.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · b99eea6376d1e212 · report

Tasks

Quantization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SPEED

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