Overview
Production Readiness
0.7
Novelty Score
0.45
Cost Impact Score
0.8
Citation Count
3
Why It Matters For Business
QAQ can cut the GPU memory used by KV caches by ~8–10×, enabling longer-context features or reducing GPU requirements and cost with little accuracy loss.
Summary TLDR
QAQ is a post-training quantization method for the Key-Value (KV) cache used during LLM autoregressive inference. It (1) assigns different quantization strategies to keys and values, (2) keeps rare outlier entries in full precision, and (3) uses an attention-window heuristic to avoid irreversible mistakes. On LLaMA-2 (7B/13B) and three zero-shot tasks, QAQ compresses the KV cache near 8–10× with negligible accuracy loss and ~1.6–1.8× better lossless compression than prior cache-only methods. Code is available.
Problem Statement
The KV cache (stored keys and values from past tokens) grows linearly with context length and quickly dominates GPU memory for long-context LLM inference. Prior eviction heuristics can remove needed tokens. The problem: shrink KV cache memory via quantization while keeping attention outputs (and thus generation quality) intact.
Main Contribution
QAQ: a post-training, per-token quantization formula that assigns bits separately for key and value caches based on predicted impact on attention outputs.
Mixed-precision outlier handling: keep the top/ bottom α% of KV entries at full precision and quantize the rest, reducing quantization error.
Attention-window: use the max of recent attention scores to predict future importance and avoid irreversible aggressive quantization.
Empirical results on LLaMA-2 (7B/13B) showing near 8–10× KV cache compression with small accuracy loss and improved lossless compression vs prior KV-cache methods.
Key Findings
Key vectors are more sensitive to quantization than value vectors; uniform 2-bit quantization harms keys far more than values.
QAQ compresses the KV cache up to about 10× with minimal accuracy loss on evaluated tasks.
QAQ improves lossless compression over prior KV-cache SOTA by ~1.6–1.8× on evaluated models/tasks.
Handling outliers matters: not treating outliers causes substantial accuracy drops; isolating 1% outliers keeps accuracy higher with small compression cost.
Using an attention window to predict future importance reduces wrong irreversible quantizations and raises performance.
Results
Accuracy
Accuracy
Max claimed compression with negligible loss
Outlier handling effect
Attention window effect
Who Should Care
What To Try In 7 Days
Run the authors' repo on a LLaMA-2-7B model and reproduce memory vs accuracy plots on one dataset.
Try α=1% outliers and attention window n=5; measure memory, latency, and accuracy trade-offs.
Integrate QAQ into your inference pipeline where KV cache size limits context length and measure real-world speed/transfer costs.
Optimization Features
Token Efficiency
- Per-token bit assignment based on predicted σ bounds
- Quantize low-importance tokens to fewer bits
System Optimization
- Reduces GPU memory footprint for KV cache
- Relies on CPU-GPU transfers when adjusting quantization
Inference Optimization
- Per-token adaptive bit allocation
- Mixed-precision: keep outliers at full precision
- Attention-window to predict future importance
- Re-quantization between CPU and GPU when needed
Reproducibility
Code Available
Open Source Status
- partial
Risks & Boundaries
Limitations
- Relies on the persistence-of-importance assumption; abrupt attention changes still need re-quantization.
- Evaluation limited to LLaMA-2 (7B/13B) and three zero-shot tasks; generality to other models/tasks untested.
- Requires CPU↔GPU transfers when changing per-token quantization, adding latency and system complexity.
- Hyperparameters (outlier ratio α, attention-window size) require tuning per model and workload.
When Not To Use
- On ultra-low-latency systems where CPU–GPU transfers are prohibitively expensive.
- When the model uses multi-query attention variants that already reduce KV cache size significantly.
- If you cannot store unquantized KV tokens on CPU for re-quantization (memory/policy constraints).
Failure Modes
- Underestimating future attention for a token leads to irreversible quantization and degraded output.
- Misclassifying outliers (too many or too few) either wastes memory or causes accuracy drops.
- Frequent re-quantization can increase latency and negate memory savings in practice.
Core Entities
Models
- LLaMA 2-7B
- LLaMA 2-13B
Metrics
- compression ratio (KV cache size)
- Accuracy
Datasets
- HellaSwag
- PIQA
- MathQA
Context Entities
Models
- OPT-6B
- OPT-13B
- OPT-30B

