TL;DR
Aggressive 1-bit KV-cache quantization drastically reduces the memory footprint of long-context LLMs but severely degrades generation quality. This paper reveals that the primary culprit is "structured local misranking" of top token candidates, and introduces DGAP—a lightweight, plug-and-play layer that detects high-risk decoding steps and restores the local top-K distribution on the fly. DGAP recovers nearly all lost accuracy (e.g., boosting Llama-3.1-8B RULER score from 47.8% to 83.2%) with a negligible 6% latency overhead.
What Problem Does This Paper Address?
As large language models (LLMs) handle increasingly long documents, the Key-Value (KV) cache becomes a massive memory bottleneck, scaling linearly with context length and batch size. Quantizing this cache to ultra-low bitwidths (like 1-bit) drastically cuts memory costs but usually destroys model performance. For instance, 1-bit quantization (K1V1) drops Llama-3.1-8B's accuracy on the RULER benchmark from 84.2% to a dismal 47.8%.
The authors tackle a fundamental question: Why exactly does low-bit KV quantization degrade model quality so sharply, and can we fix it at decode time without losing the memory benefits of low-bit storage?
Methods
The authors propose DGAP (Disagreement-Guided Adaptive Precision), an add-on layer that operates entirely during decoding without requiring base-model retraining or attention-kernel modifications.
Instead of trying to fix the entire KV cache or the full vocabulary distribution, DGAP uses a two-stage detector-corrector framework:
- Distribution-Risk Detector: A tiny Multi-Layer Perceptron (MLP) analyzes the shape statistics of the quantized logits (such as entropy, probability mass concentration, and local gaps) at each decoding step. It predicts whether the current step is "at risk" of severe distribution distortion.
- Selective Top-K Corrector: If the predicted risk exceeds a calibrated threshold ($\tau$), a second MLP predicts sparse logit updates only for a compact top-$K$ candidate region. Stable steps bypass this corrector entirely, saving compute.
The framework is trained offline using paired decoding traces (comparing full-precision FP16 against quantized KV states) and leverages a specialized pairwise rank-consistency loss to ensure the relative ordering of top tokens is preserved.
Datasets
- Training & Calibration: Paired decoding traces were generated using the PG-19 dataset, selected because its naturally long documents are ideal for simulating long-context KV-cache behavior without overlapping with downstream evaluation benchmarks.
- Evaluation: The method was validated across several diverse benchmarks:
- LongBench: For practical long-context tasks.
- RULER: For controlled long-context evaluation.
- MMLU: For general knowledge and reasoning.
- WikiText-2: For language modeling perplexity.
Key Insights and Ideas
- It's the Ranking, Not the Magnitude: Conventional wisdom assumes quantization error is primarily driven by absolute logit-magnitude shifts. However, the authors' controlled analysis revealed that imposing a 1-bit quantized token ranking on full-precision scores causes a massive 31.8-point accuracy drop, whereas changing score magnitudes while preserving the correct ranking stays within 1.2 points of the FP16 baseline (see Figure 1).
- Structured Local Misranking: When ultra-low bit quantization causes errors, the correct high-probability tokens are rarely erased entirely; instead, they are simply shuffled around within a compact top-K candidate window (see Figure 2). This means local restoration of a tiny slice of the vocabulary is sufficient to recover performance.
- Adaptive Gating Saves Compute: Correcting the vocabulary at every single step is too expensive for autoregressive generation. By decoupling risk detection from correction, DGAP only activates its corrector on truly unstable steps (e.g., ~15% of the time in 1-bit settings), keeping runtime overhead minimal.
Key Results
- Near-Lossless Accuracy Recovery: On Llama-3.1-8B under the RULER benchmark, DGAP-1bit dramatically recovers accuracy from 47.8% back up to 83.2% (approaching the FP16 baseline of 84.2%). Similar strong recoveries were observed for Mistral-7B and Qwen2.5-14B.
- Preserved 1-Bit Footprint: Because DGAP only modifies the output logits at decode time, it maintains the exact same 14.2× KV-cache memory compression achieved by a standard 1-bit baseline.
- Negligible Overhead: DGAP introduces a tiny runtime overhead of approximately 1.06× relative decode latency, translating to a throughput drop of less than 6%.
Limitations and Future Work
- Offline Calibration: DGAP currently relies on offline-calibrated thresholds and recovery windows derived from training traces. The authors note that future extensions could explore online calibration to adapt dynamically to deployment-specific workloads.
- System-Level Optimization: The current implementation is purely algorithmic. The authors suggest that kernel-level optimizations (such as Triton or CUDA fusion) could integrate the detector-corrector steps directly into the serving pipeline, reducing the remaining 6% overhead even further.
Summary updated