KIVI quantizes an LLM’s key-value (KV) cache down to 2 bits with zero calibration or fine-tuning, cutting peak GPU memory (including model weights) by 2.6x, enabling 4x larger batch sizes, and delivering 2.35x to 3.47x higher serving throughput on Llama-2-7B. Zirui Liu, Jiayi Yuan, Hongye Jin, Shaochen Zhong, Zhaozhuo Xu, Vladimir Braverman, Beidi Chen, and Xia Hu found that naive 2-bit KV quantization collapses because keys and values fail along opposite tensor axes: keys must be quantized per-channel, while values must be quantized per-token.
- 5x lower key score error, 15x lower value output error: On Llama-2-13B, quantizing keys per-channel instead of per-token cut attention-score error from 47.00 to 9.60; quantizing values per-token instead of per-channel cut attention-output error from 49.89 to 3.73.
- 2-bit collapse avoided on generation and reasoning: Naive 2-bit per-token quantization (
K-T, V-T) dropped Llama-2-13B CoQA from 66.37 to 52.93 and Llama-2-7B GSM8K from 13.50% to 0.83%, while KIVI-2 preserved 66.23 CoQA and 12.74% GSM8K. - Long-context accuracy stays intact: Across eight LongBench tasks, KIVI-2 scored 44.27 vs 44.52 FP16 on Llama-2-7B, 44.69 vs 44.85 on Llama-2-13B, and 45.85 vs 46.58 on Mistral-7B, while preserving Needle-in-a-Haystack retrieval up to 27K to 30K tokens.
- 2.6x memory reduction, 3.47x throughput: On an 80GB A100 running ShareGPT workloads (161 prompt / 338 output tokens), fused CUDA
Q_MatMulkernels pushed batch capacity up 4x and throughput 2.35x to 3.47x.
Why keys and values break along different axes
In batched long-context inference, the KV cache dominates both HBM capacity and decode latency (for OPT-175B at batch 512 and 512+32 length, the KV cache alone takes 1.2 TB, 3.8x the weights, and must be loaded from HBM on every generated token). Prior systems applied uniform per-token round-to-nearest quantization because new tokens stream in along the token dimension, which holds at 4 bits but fails badly at 2 bits.
Inspecting activations across Llama-2 and Falcon revealed two distinct mechanisms behind that failure:
- Key caches have persistent channel outliers: A small subset of fixed channels exhibits very large magnitudes across every token. Grouping elements per-channel isolates each outlier to its own scale and zero-point, keeping normal channels clean and cutting relative attention-score error nearly 5x (47.00 to 9.60 on Llama-2-13B).
- Value caches rely on attention sparsity: Value tensors lack channel outliers, yet quantizing values per-channel destroys accuracy (CoQA plunges from 66.37 to 2.88). Because attention weights are roughly 84.3% sparse on Llama-2-13B, the attention output sums only a handful of critical tokens. Per-token quantization confines rounding noise inside each token so low-weight tokens never corrupt high-weight ones, cutting attention-output error nearly 15x (49.89 to 3.73).
Streaming residual cache and fused kernels
Per-token value quantization appends smoothly as tokens decode, whereas per-channel key quantization spans multiple tokens. KIVI resolves that mismatch with a two-part streaming structure using group size G = 32 and a recent full-precision residual buffer of up to R tokens (R = 128 or 32):
Because KIVI only compresses the KV cache, it composes cleanly with weight-only methods such as GPTQ and AWQ, as well as serving allocators like PagedAttention.
Caveats and builder takeaway
Three constraints define where 2-bit KIVI needs adjustment:
- Already-compressed MQA and GQA caches: On Falcon-7B (which uses single-head Multi-Query Attention), 2-bit KIVI cut CoQA from 59.83 to 57.48 and MultiNews from 11.09 to 6.78, so the authors recommend 4-bit KIVI there (59.67 CoQA, 8.78 LongBench avg vs 8.71 FP16). Even on GQA-based Llama-3-8B-Instruct, 2-bit KIVI dropped code completion on LCC (57.00 to 50.84) and RepoBench-P (51.22 to 46.65), whereas KIVI-4 matched FP16 (45.31 vs 45.21 avg).
- Group size sensitivity: Raising group size
Gfrom 64 to 128 caused Llama-2-13B GSM8K to drop from 21.00% to 17.29%, and shrinking residual lengthRfrom 128 to 32 shaved roughly 1 to 2 points off hard reasoning on Mistral-7B (36.01% to 34.34%). - Kernel overhead on short contexts: If KV cache is small relative to weights (short prompts, small batch sizes), 2-bit unpacking adds overhead for little memory gain; furthermore, KIVI had not yet fused quantization into upstream projections.
For long-context or high-concurrency serving on MHA models, KIVI-2 cuts memory enough to nearly triple throughput with negligible quality loss; on GQA/MQA models or code-heavy workloads, KIVI-4 offers a safer drop-in default.


