TL;DR
This paper introduces Bidirectional Diagonal Quantization (BDQ), a mathematically grounded post-training quantization (PTQ) framework designed to tackle activation outliers in Large Language Models (LLMs). By defining a new "Flatness" metric inspired by information entropy, the authors derive a theoretically optimal matrix transformation that evenly disperses outlier magnitudes across matrix dimensions. BDQ significantly closes the performance gap in ultra-low bit settings, achieving state-of-the-art compression with minimal accuracy loss.
What Problem Does This Paper Address?
Quantizing LLMs to low bit-widths (e.g., 4-bit or 2-bit weights and activations) is essential for reducing the massive computational and storage costs of deployment. However, LLMs naturally produce "activation outliers"—features with exceptionally large magnitudes concentrated in specific channels.
When mapping continuous floating-point values to a limited discrete space (like INT4), these massive outliers force the quantization scale factor to expand. As a result, the remaining normal data gets squished into just a few quantization bins, leading to severe precision loss. While recent methods try to use linear rotations to spread out these outliers, the data often remains heavily concentrated in certain regions. Furthermore, existing approaches are largely heuristic and lack a direct mathematical link between outlier distributions and quantization errors.
Methods
The authors approach the outlier problem through rigorous mathematical modeling and introduce three core components:
- The Flatness Metric: The authors prove that the total quantization error scales quadratically with outlier magnitude. To quantify how evenly outliers are distributed, they introduce Flatness, a metric inspired by information entropy. Treating matrix element magnitudes like a probability distribution, they prove that maximizing entropy (minimizing Flatness) yields a unique, theoretically optimal solution using simple diagonal matrix scaling.
- Bidirectional Diagonal Quantization (BDQ): Based on their theoretical derivation, BDQ applies two learnable diagonal transformation pairs ($\Lambda_1, \Lambda_2$) for each fully connected layer to scale rows and columns simultaneously. This strategically redistributes outlier magnitudes across both dimensions. To handle cases with strong column correlations, they also incorporate a learnable Hadamard rotation matrix ($R$) to further smooth out the distribution.
- Recursive Cross-Entropy (RCE) Loss: PTQ methods often overfit to the small calibration datasets (e.g., 128 samples) typically used during quantization. The authors show that while standard cross-entropy loss improves validation perplexity, it actually increases matrix flatness and hurts general zero-shot accuracy. RCE loss fixes this by regularizing the optimization process, simultaneously fitting the calibration labels and the model's own highly reliable predicted token distributions.
The overall transformation pipeline and its impact on matrix flatness compared to standard rotation methods can be seen in the authors' framework diagram:
Datasets
- Calibration & Perplexity Evaluation: WikiText2 and C4 datasets.
- Downstream Zero-Shot Evaluation: Six standard benchmarks from the
lm-evaluation-harness: HellaSwag, LAMBADA, PIQA, WinoGrande, ARC-Easy, and ARC-Challenge. - Models Tested: LLaMA-2 (7B to 70B), LLaMA-3 (8B and 70B), and the DeepSeek-R1-Distill-LLaMA (8B and 70B) series.
Key Insights and Ideas
- The Quadratic Penalty: Outliers do not just add linear noise; their impact on the total matrix quantization error is quadratic. This makes outlier dispersion the absolute highest priority for low-bit quantization.
- Entropy as a Structural Guide: By framing matrix smoothing as an entropy maximization problem, the authors move away from heuristic tuning and provide a mathematically optimal form ($V = d_1 W d_2$) for outlier elimination.
- The PTQ Overfitting Trap: The paper exposes a hidden pitfall in post-training quantization: optimizing strictly for cross-entropy on small calibration sets causes the model to overfit to specific features, which actively hinders outlier mitigation on unseen data.
Key Results
- W4A4 Quantization: On the LLaMA-3-8B model, BDQ achieves less than a 1% accuracy drop compared to the unquantized FP16 baseline.
- Ultra-Low Bit (W2A4KV16): In the highly challenging 2-bit weight setting, BDQ reduces the performance gap to the baseline by 39.1% on the DeepSeek-R1-Distill-LLaMA-70B model compared to the previous state-of-the-art method (FlatQuant).
- Quantization Uniformity: As visualized below, BDQ maps values to integer levels much more uniformly than standard rotation transformations, preserving the original data space:
- Hardware Efficiency: In practical deployment, BDQ delivers up to a 3.44× speedup during the prefill phase on NVIDIA A100 GPUs and up to 3.74× memory savings on AMD MI250 GPUs.
Limitations and Future Work
- Model Scale Constraints: Due to limited computing resources, the authors did not validate their framework on ultra-large models beyond 70B parameters (such as the LLaMA-3 405B model).
- Hardware Diversity: The inference efficiency experiments were restricted to specific high-end enterprise GPUs (NVIDIA A100 and AMD MI250). Further testing across a broader variety of consumer and edge GPU architectures is needed to verify widespread practical deployment.
Summary updated