Papers › KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache

KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache

5 Feb 2024arXiv:2402.02750archive 2025-07-28

Zirui Liu, Jiayi Yuan, Hongye Jin, Shaochen Zhong, Zhaozhuo Xu, Vladimir Braverman, Beidi Chen, Xia Hu

Efficiently serving large language models (LLMs) requires batching of many requests to reduce the cost per request. Yet, with larger batch sizes and longer context lengths, the key-value (KV) cache, which stores attention keys and values to avoid re-computations, significantly increases memory demands and becomes the new bottleneck in speed and memory usage. Additionally, the loading of the KV cache causes the computational core to be idle, which limits the inference speed. A straightforward and effective solution to reduce KV cache size is quantization, which decreases the total bytes taken by KV cache. However, there is a lack of in-depth studies that explore the element distribution of KV cache to understand the hardness and limitation of KV cache quantization. To fill the gap, we conducted a comprehensive study on the element distribution in KV cache of popular LLMs. Our findings indicate that the key cache should be quantized per-channel, i.e., group elements along the channel dimension and quantize them together. In contrast, the value cache should be quantized per-token. From this analysis, we developed a tuning-free 2bit KV cache quantization algorithm named KIVI. With hardware-friendly implementation, KIVI can enable Llama, Falcon, and Mistral models to maintain almost the same quality while using 2.6× less peak memory (including model weight). This reduction in memory usage enables up to 4× larger batch size, bringing 2.35×∼3.47× throughput on real LLM inference workload. The source code is available at https://github.com/jy-yuan/KIVI.

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

Code

Syntology Ran 15 of 18 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · violated contract; 3 ran · our draft was wrong; 10 ran with no contract checked.

By repository: official repository: 18 samples from 1 repository, 15 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

jy-yuan/kivi officialmentioned in papermentioned 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

18 samples harvested; 15 ran; 1 honoured the contract we drafted; 3 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 · honoured contract
1ran · violated contract
3ran · our draft was wrong
10ran
3unverified

Licence: 0 of the 18 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 jy-yuan/kivi. “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.

build_chat jy-yuan/kivi/pred_long_bench.py official repository ran MIT (permissive) · ef82bf5af4441329 · report
calculate_zeros_width jy-yuan/kivi/quant/qmodule.py official repository ran MIT (permissive) · fd8719af3db2c5ae · report
count_score jy-yuan/kivi/metrics.py official repository ran · honoured contract fingerprinted MIT (permissive) · b349b79d9cc2934b · report
dequant_weight jy-yuan/kivi/quant/gemv.py official repository ran MIT (permissive) · a9baefdb784da628 · report
dequant_weight_outer jy-yuan/kivi/quant/gemv.py official repository ran MIT (permissive) · 4d4c20e8d1e678ef · report
make_divisible jy-yuan/kivi/quant/qmodule.py official repository ran fingerprinted MIT (permissive) · ad85b288e9acb9c2 · report
normalize_answer jy-yuan/kivi/metrics.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · e7e75981cb464788 · report
normalize_zh_answer jy-yuan/kivi/metrics.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 8c5c581f9264c810 · report
parse_args jy-yuan/kivi/eval_long_bench.py official repository ran · our draft was wrong MIT (permissive) · ca066a4c088c8cf5 · report
post_process jy-yuan/kivi/pred_long_bench.py official repository ran · violated contract fingerprinted MIT (permissive) · 4489113b536ca6eb · report
process_input jy-yuan/kivi/models/utils_quant.py official repository ran fingerprinted MIT (permissive) · d54a29178ce3203f · report
quant_and_pack_kcache jy-yuan/kivi/quant/new_pack.py official repository ran MIT (permissive) · 901a3668958c9deb · report
quant_and_pack_vcache jy-yuan/kivi/quant/new_pack.py official repository ran MIT (permissive) · 95a9c97f6ea7d050 · report
quantize_and_pack jy-yuan/kivi/models/utils_quant.py official repository ran MIT (permissive) · 4ed267d57146753e · report
repeat_kv_quant jy-yuan/kivi/models/mistral_kivi.py official repository ran fingerprinted MIT (permissive) · fa013be990ccedab · report
dequantize_and_unpack jy-yuan/kivi/models/utils_quant.py official repository unverified MIT (permissive) · 1297b7d82f48928d · report
get_pred jy-yuan/kivi/pred_long_bench.py official repository unverified MIT (permissive) · 1b63810f36de324d · report
unpack_and_dequant_kcache jy-yuan/kivi/quant/new_pack.py official repository unverified MIT (permissive) · e493c68ae46ac587 · 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