atlas

Research map / Architectures and efficiency / Quantization

KVQuant: Towards 10 Million Context Length LLM Inference with KV Cache Quantization

NeurIPS 2024 · Architectures and efficiency › Quantization · approach: KV cache quantization · 51 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

KVQuant compresses the LLM KV cache to 2-4 bits via per-channel pre-RoPE key quantization, sensitivity-weighted non-uniform datatypes, per-vector dense-and-sparse outlier isolation, and attention-sink-aware fp16 first token, enabling 10M-token context on an 8-GPU system.

Problem

KV cache memory dominates inference cost at long context lengths, and existing KV cache quantization methods lose substantial accuracy below 4 bits.

Approach

Combines per-channel Key quantization applied before RoPE, offline sensitivity-weighted k-means non-uniform datatypes (nuqX), per-vector dense-and-sparse outlier isolation, and keeping the first attention-sink token in fp16 to quantize KV activations accurately at ultra-low bit widths.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use per-channel quantization for Keys and per-token quantization for Values instead of per-token quantization for both (ablation)3-bit KV cache quantization · Wikitext-2perplexity: 10.87 -> 7.05; 3.82 perplexity improvementHelped
Use per-channel quantization for Values instead of per-token quantization (ablation)3-bit KV cache quantization · Wikitext-2perplexity: 7.05 -> 223Hurt
Quantize Keys before RoPE rather than after RoPE (ablation)3-bit KVQuant · Wikitext-2perplexity: 7.05 -> 6.23; 0.82 perplexity improvementHelped
Add sensitivity weighting to the k-means objective (ablation)nuq3 KV cache quantization · Wikitext-2perplexity: 6.84 -> 6.01Helped
Account for per-channel scaling factors when deriving k-means signposts (ablation)Fisher-weighted nuq3 · Wikitext-2perplexity: 6.01 -> 5.94Helped
Add per-vector outlier thresholds instead of using a single per-matrix threshold (ablation)nuq3 KV cache quantization with 1% outliers · Wikitext-2perplexity: 5.85 -> 5.75Helped
Add attention sink-aware quantization by keeping the first token in fp16 (ablation)KVQuant across bit widths and evaluated models · Wikitext-2perplexity: 0.25 and 0.13 PPL improvements for nuq2-1% on Llama-3-8B and Llama-3-70BHelped
Use KVQuant-3bit-1% instead of KIVI-2-gs32-r128LLaMA-2-7B-32K · LongBench averagescore: 30.04 -> 31.21Helped
Use KVQuant-3bit-1% instead of KIVI-2-gs32-r128LLaMA-2-7B-32K · RULER averageaccuracy: 39.78 -> 53.65; 14% better scoreHelped

Surprising findings

Limitations

Experimental setup

Datasets: Wikitext-2 C4

Benchmarks: Wikitext-2 C4 Passkey retrieval LongBench RULER

Metrics: perplexity success rate accuracy latency (microseconds) KV cache size (GB)

Baselines: int4 nf4 ATOM FlexGen KIVI int3 nf3

Builds on: SqueezeLLM NormalFloat RoPE

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy