Ninth GPU Deep Dive post, and a fourth independent lever on the same cost this blog keeps returning to. PagedAttention changed how the KV cache gets allocated. Prefix caching changed whether it needs to be recomputed at all. Grouped-query attention changed how many K/V heads exist in the first place. None of those touch the actual numbers sitting in whatever cache survives all three. KV cache quantization does: store each value in 4, 3, or even 2 bits instead of 16, and do it without retraining the model.
Why this isn't just "quantize everything the same way"
The obvious approach — pick one scale factor and shove every number into 4 bits — degrades badly below 4-bit precision, and two independent 2024 papers trace this to the same underlying fact: Keys and Values don't have the same statistics. KVQuant (Hooper et al., NeurIPS 2024) finds that "the Key matrices tend to have distinct outlier channels, which have larger average magnitudes than other channels," while "the Value matrices exhibit both outlier channels as well as outlier tokens," with none of it as extreme as the Key side. KIVI (Liu et al., ICML 2024), working independently, lands on the identical split: "For key cache, there are a few fixed channels whose magnitudes are very large," but "for value cache, there is no obvious outlier pattern."
That asymmetry dictates how each should be grouped for quantization. Group Keys per channel — all tokens' values for one fixed dimension share a scale factor — because KVQuant puts it plainly: "the values within a channel are easier to quantize when grouped together" once you know a handful of channels run consistently larger than the rest. Group Values per token instead, because there's no shared channel structure to exploit; each token's own value vector is the more coherent unit. KVQuant reports this split alone is worth a 3.82 perplexity improvement on WikiText-2 for 3-bit LLaMA-7B quantization over uniform, same-granularity quantization.
KVQuant: squeezing out the last bits
Beyond the per-channel/per-token split, KVQuant stacks several more targeted fixes. One connects directly back to this blog's RoPE post: Keys get quantized before the rotary position embedding is applied, not after, because rotating each Key vector mixes its components together and smooths out the fixed-channel-magnitude structure that made per-channel quantization work in the first place — the paper reports this pre-RoPE ordering alone is worth another 0.82 perplexity improvement. On top of that: a non-uniform datatype derived from each layer's sensitivity (weighted by Fisher information, clustered with k-means) instead of uniformly-spaced quantization levels, and a sparse outlier matrix that pulls out the most extreme 1% of values to store at full precision separately — removing just that 1% brings the result "within 0.07 perplexity of the fp16 baseline."
Stacked together, KVQuant reports under 0.1 perplexity degradation with 3-bit quantization on both WikiText-2 and C4, custom CUDA kernels delivering up to ~1.7x speedup over fp16 matrix-vector multiplication, and — the headline framing in the paper's title — a 10 million token context length for LLaMA-7B, made possible across an 8-GPU system once the KV cache per token is this much smaller.
KIVI: the tuning-free version
KIVI takes the same Key-per-channel, Value-per-token insight and optimizes for a different constraint: no calibration pass, no fine-tuning, nothing that has to run before the model can be served. The paper's reasoning is practical — GPU KV cache quantization has to happen on every token, during decoding, as the cache is streaming in, so a calibration-heavy method like GPTQ is simply too expensive to run inline. KIVI instead uses plain round-to-nearest quantization, leaning entirely on the channel/token grouping split to make a cheap method accurate anyway.
At 2-bit — a more aggressive target than KVQuant's 3-bit — KIVI reports "up to 2% accuracy drop despite the KV cache being stored in 2bit," while delivering 2.6x less peak memory (model weights included), which in turn enables up to 4x larger batch size and 2.35x to 3.47x higher throughput on real inference workloads. Where KVQuant optimizes for how far quantization can push accuracy with enough engineering, KIVI optimizes for how little setup a serving system needs to get most of the benefit.
The same fact, discovered twice
What makes the Key/Value asymmetry worth trusting isn't that one paper claims it — it's that KVQuant and KIVI arrived at the identical per-channel-Key, per-token-Value split independently, using different evaluation setups and different downstream goals (maximum accuracy at 3-bit versus zero-tuning 2-bit). When two unrelated teams measure the same structural property of the same tensors and land on the same fix, that's a much stronger signal that it's a real property of how attention stores information — specific Key dimensions consistently carrying more signal than others — rather than an artifact of either paper's particular method.
A fourth lever, stacking with the other three
This blog now has four genuinely independent answers to "the KV cache is expensive": PagedAttention fixes how it's allocated, prefix caching fixes whether it gets recomputed, grouped-query attention fixes how many heads produce it, and quantization fixes how many bits each value in it costs. They compose rather than compete — a served model can use GQA to cut head count, quantize what's left to 4 bits, allocate it in PagedAttention's blocks, and still reuse matching prefixes across requests, each fix paying off independently of the other three. "Shrink the KV cache" was never one problem with one answer; it's four different knobs on the same number, and production serving stacks increasingly turn all four at once.
References
- KVQuant: Towards 10 Million Context Length LLM Inference with KV Cache Quantization — Hooper et al. (NeurIPS 2024, arXiv:2401.18079)
- KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache — Liu et al. (ICML 2024, arXiv:2402.02750)
Channel-vs-token quantization diagram above is original artwork made for this post.