Introduction
Large Language Models (LLMs) have revolutionized natural language processing but remain prohibitively memory-intensive for many deployment scenarios. While post-training quantization (PTQ)—reducing weight precision from 16-bit to 4-bit or lower—is the standard solution, existing methods often struggle with a "trilemma" of accuracy, compatibility, and scalability. High-accuracy methods frequently rely on non-standard formats that require specialized kernels, while scalable methods often sacrifice precision. LeanQuant addresses these challenges by introducing a highly scalable PTQ framework that optimizes quantization grids based on weight sensitivity, enabling the compression of massive models like Llama-3.1 405B on consumer-grade hardware.
The Outlier Problem in LLM Quantization
A primary limitation of standard quantization is the reliance on "min-max" grids, which set boundaries based solely on the extreme values of a weight group. However, not all weights contribute equally to model performance. LeanQuant identifies that certain weights are significantly more sensitive to quantization error than others. This sensitivity is captured by the diagonal of the inverse Hessian matrix ($1/\text{diag}(\mathbf{H}^{-1})$).
As shown in Figure 3, weight distributions across various layers exhibit extreme outliers in their sensitivity values. Standard grids ignore these outliers, leading to high loss errors when critical weights are rounded. LeanQuant shifts the focus from fixing weights post-quantization to learning an optimal grid that prioritizes these sensitive outliers.
Methodology: Loss-Error-Aware Grids
LeanQuant introduces Loss-error-aware network Quantization, which optimizes quantization grid points to minimize the expected increase in task loss.
Non-uniform Grid Learning
For formats supporting look-up tables, LeanQuant employs a weighted k-means clustering approach. Unlike standard k-means, the weights for clustering are derived from the inverse Hessian diagonals. This ensures that the learned grid points are "pulled" toward the most sensitive values, preserving the information in critical outliers. To avoid missing extreme values, the authors use a "uniformly spaced" initialization instead of traditional k-means++.
Affine Grid Learning
For standard uniform quantization (compatible with llama.cpp or vLLM), LeanQuant uses an enumerative search to identify the optimal scaling factor ($S$) and zero-point ($Z$). To maintain scalability, the authors developed fused GPU kernels that parallelize this search, achieving a 50x speedup over sequential implementations. This allows the method to integrate seamlessly with the iterative GPTQ framework while replacing its rigid grid logic with adaptive, error-aware boundaries.
Experimental Results
LeanQuant was evaluated across multiple LLM families, including Llama-2, Llama-3, and Mistral, using a variety of zero-shot benchmarks and instruction-following tasks.
Accuracy and Performance
LeanQuant consistently outperforms established baselines like GPTQ and OmniQuant. For instance, on 3-bit Llama-3-8B, LeanQuant improved average zero-shot accuracy by 18.38% over GPTQ and 17.18% over OmniQuant. Even at 2-bit precision, where most models typically fail, LeanQuant-quantized models remain functional and significantly more accurate than previous methods.
Scalability
A key strength of LeanQuant is its extreme scalability. The framework successfully quantized the Llama-3.1 405B model in just 21 hours using two 48GB GPUs. In contrast, competitive methods like OmniQuant often encounter out-of-memory (OOM) errors on models of this scale. Smaller 7B/8B models can be quantized in under an hour on a single GPU.
Conclusion
LeanQuant provides a robust solution to the quantization trilemma by leveraging Hessian-based sensitivity to inform grid learning. By prioritizing sensitive outliers and utilizing efficient GPU kernels, it achieves state-of-the-art accuracy without sacrificing scalability or compatibility with standard inference frameworks. Future work includes automating hyperparameter selection and extending the custom kernels to a wider range of hardware architectures.
Summary updated