Introduction
Large Language Models (LLMs) like LLaMA-70B require substantial VRAM, often exceeding the capacity of consumer-grade hardware. Quantization to 2-bit or 4-bit formats is a standard mitigation strategy, but "extreme" 2-bit quantization typically results in significant performance loss. This degradation is primarily driven by outliers—a small number of high-magnitude activation values that dominate the dynamic range, forcing the quantization grid to be so wide that the majority of "normal" values lose all precision.
The Challenge of Layer Heterogeneity
Current state-of-the-art techniques for outlier suppression, such as QuIP and QuaRot, utilize "rotation-based" quantization. These methods apply fixed orthogonal matrices (e.g., Hadamard transforms) to activations to redistribute outlier energy across channels. However, these approaches suffer from two main limitations: they are data-agnostic and fail to account for layer heterogeneity. LLM layers exhibit diverse outlier patterns; for instance, attention layers and MLP layers may have outliers in different regions of their distributions. A fixed, "one-size-fits-all" rotation is inherently suboptimal for such varied architectures.
Methodology: Learnable Butterfly Transforms
ButterflyQuant addresses these limitations by replacing fixed rotations with learnable butterfly transforms. This method factorizes a large orthogonal matrix into $\log_2 n$ sparse layers, each composed of independent $2 \times 2$ Givens rotations.
Key features of the ButterflyQuant approach include:
- Differentiability: By parameterizing rotations with continuous angles ($\theta$), the transform becomes fully differentiable, allowing for optimization via gradient descent.
- Guaranteed Orthogonality: The butterfly structure ensures the matrix remains orthogonal by construction, preserving the model's output integrity without the need for expensive orthogonalization steps.
- Uniformity Regularization: A KL-divergence loss is employed to encourage rotated activations to distribute uniformly across quantization bins, maximizing information entropy and minimizing reconstruction error.
- Computational Efficiency: The method maintains $O(n \log n)$ complexity, matching the efficiency of the Fast Hadamard Transform (FHT) and remaining compatible with optimized CUDA kernels.
Key Insights and Efficiency
A critical discovery in the development of ButterflyQuant was the importance of initialization. Starting from an Identity matrix and allowing the model to learn its way toward an optimal rotation proved superior to starting with random or Hadamard matrices. Furthermore, the authors demonstrated that butterfly transforms are a strict superset of fixed methods, capable of exactly representing Hadamard, DFT, and DCT matrices.
The optimization process is remarkably lightweight, requiring only 128 samples from the WikiText-2 dataset and converging in 5–10 minutes on a single NVIDIA H100 GPU. This adaptivity allows the model to minimize mutual coherence—a measure of how well the transform spreads energy—across diverse layers.
Results
ButterflyQuant establishes a new state-of-the-art for 2-bit (W2A16) quantization:
- Perplexity: On LLaMA-2-7B, it achieved a WikiText-2 perplexity of 15.40, significantly outperforming both fixed methods like QuIP (37.32) and other learned baselines like SpinQuant (16.43).
- Reasoning: The method retains approximately 88% of the original FP16 accuracy on zero-shot reasoning tasks, a substantial improvement over the 65–73% typically seen in other 2-bit methods.
- Outlier Suppression: Activation kurtosis was reduced from 8.2 to 3.1, effectively transforming the distribution into a near-Gaussian state ideal for uniform quantization.
Conclusion and Future Work
ButterflyQuant demonstrates that learnable, structured orthogonal transforms can effectively mitigate the impact of outliers in ultra-low-bit quantization. While the method introduces a slight arithmetic overhead due to the use of Fused Multiply-Adds (FMAs) compared to simple additions in Hadamard transforms, its performance gains are decisive. Future research will focus on extending this framework to 2-bit activation and KV cache quantization, as well as developing hand-tuned CUDA kernels for production-level inference speed.
Summary updated