TL;DR
This paper derives the mathematically optimal way to quantize two matrices individually such that the error in their product is minimized, rather than their individual reconstruction errors. For correlated Gaussian inputs, the authors discover a fascinating "phase transition" where the optimal quantization density shifts from unimodal to bimodal as the correlation between the matrices increases, significantly outperforming standard quantization methods in LLM attention layers and least-squares problems.
What Problem Does This Paper Address?
Low-precision quantization (like INT8 or FP8) is essential for running large machine learning models efficiently on modern hardware. However, standard quantization techniques (such as Lloyd-Max or uniform quantization) focus on minimizing the entrywise reconstruction error of the individual input matrices ($A$ and $B$) independently.
In reality, downstream applications only care about the error introduced after multiplication ($AB$). Because matrix multiplication filters errors in a bilinear way, optimizing for individual matrix reconstruction is sub-optimal. This paper tackles the challenge of designing scalar quantizers specifically tailored to minimize the Frobenius mean-squared error (MSE) of the final matrix product under a statistically dependent input model.
Methods
The authors leverage high-rate quantization theory (analyzing the asymptotic regime where the number of quantization levels $K \to \infty$) to decouple the matrix product MSE into two separate, weighted scalar quantization problems. These weights are driven by the conditional second moments of the matrix entries.
For the specific case of correlated bivariate Gaussian matrix pairs (with correlation $\rho$), they derive a closed-form formula for the optimal point density $\lambda^\star(u)$:
$$\lambda^\star(u) \propto \exp\left(-\frac{u^2}{6}\right)\left((1-\rho^2)+\rho^2u^2\right)^{1/3}$$
Crucially, they mathematically prove a correlation-driven phase transition based on this density shape.
Datasets
- Synthetic Data: Random matrices generated according to a correlated Gaussian model to validate the theoretical MSE scaling laws and phase transitions.
- Real-world Data: Text sequences from the WikiText-2 dataset, used to evaluate the quantization of Key ($K$) and Query ($Q$) activations across the GPT-2 family (Small, Medium, Large, XL) and Qwen3 models (0.6B, 1.7B, 8B).
Key Insights and Ideas
- Optimize the Product, Not the Inputs: Standard high-rate theory suggests a point density proportional to $f(x)^{1/3}$ for Gaussian inputs. This paper shows that for matrix multiplication, the optimal density must incorporate the conditional variance of the other matrix, leading to a completely different shape.
- The Unimodal-to-Bimodal Phase Transition: The most striking finding is that as correlation magnitude $|\rho|$ increases past $1/\sqrt{3} \approx 0.577$, the optimal strategy stops placing the most quantization levels near zero. Instead, it splits them into two symmetric peaks (bimodal). This happens because strong correlation means large values in one matrix reliably multiply large values in the other, making the extreme product tails much more critical to preserve accurately.
Key Results
- Synthetic Matrix Multiplication: The proposed method (
MatMul-Opt) consistently achieves lower relative Frobenius error compared to standard baselines like Lloyd-Max, Uniform, NF4, and NV FP4 across various correlation magnitudes.
- Quantized Least Squares: Applying the correlation-aware quantizer to solve $\min_W \|XW - Y\|_F^2$ yields significantly better rate-distortion performance (lower MSE for the same bit budget) than naive Gaussian quantization.
- LLM Activation Quantization: When applied to the $Q$ and $K$ attention matrices in transformer models, the $\rho$-tuned optimal quantizer outperformed FP8 in 100% of attention heads for all GPT-2 variants and outperformed INT8 in 96.5% to 100% of heads. For Qwen3 models, it achieved up to a 98.7% win rate against FP8.
Limitations and Future Work
- Rotary Embeddings (RoPE) Misspecification: The method's performance degraded slightly on larger Qwen3 models (e.g., losing to INT8 on Qwen3-8B). The authors attribute this to model misspecification caused by Rotary Position Embeddings (RoPE), which alter the activation distributions away from a simple correlated Gaussian model.
- Outliers: The current formulation does not explicitly handle extreme activation outliers ("feature suppression"), which is a well-known challenge in LLM quantization.
- Future Directions: The authors plan to extend the framework to explicitly accommodate rotary embeddings and integrate standard outlier-handling techniques commonly used in LLM quantization.
Summary updated