What Makes Quantization for Large Language Model Hard? An Empirical Study from the Lens of Perturbation

Zhuocheng Gong, Jiahao Liu, Jingang Wang, Xunliang Cai, Dongyan Zhao, Rui Yan

Abstract

Quantization is a critical technique for reducing the memory footprint and computational requirements of Large Language Models (LLMs). However, the process often introduces performance degradation, particularly when quantizing activations. This study investigates the mechanical causes of this "hardness" through the lens of perturbation. By analyzing how models respond to noise across different value magnitudes, we reveal a fundamental asymmetry: LLMs are highly sensitive to perturbations in small-magnitude values, while large "outlier" values are surprisingly robust to noise. Based on these findings, we propose a non-linear power-law transformation ($x^{1/3}$) to redistribute quantization error, enabling near-lossless 8-bit and 4-bit quantization on models that previously struggled with standard uniform methods.

Introduction

As Large Language Models (LLMs) grow in scale, their deployment becomes increasingly resource-intensive. Quantization—the process of mapping high-precision floating-point values to low-precision integer formats—is the primary strategy for shrinking these models. While weight quantization is relatively mature, quantizing activations remains a significant challenge. Certain model families, such as OPT, exhibit extreme sensitivity to quantization, whereas others, like LLaMA, appear more robust.

Previous research has identified the presence of "outliers" (abnormally large values) in activations as a primary source of quantization error. However, the underlying reason why these outliers—or the values surrounding them—impact model performance has remained poorly understood. This paper moves beyond simple observation to empirically study the sensitivity of LLMs to different types of numerical errors.

The Lens of Perturbation

To understand the mechanics of quantization error, we introduce a framework called the "lens of perturbation." Rather than viewing quantization as a simple rounding operation, we treat it as the injection of artificial noise into the model's tensors. This allows us to isolate and test the impact of noise on specific subsets of the data.

Magnitude-Aware Noise

We conducted experiments injecting various noise distributions (Gaussian, Uniform, Rademacher) into models like BLOOM and LLaMA. Crucially, we tested magnitude-aware perturbations:

  1. Positively-correlated: Larger values receive larger noise.
  2. Negatively-correlated: Smaller values receive larger noise.

Our analysis revealed a surprising "aha moment": LLM performance is incredibly fragile when noise is applied to small-magnitude values. Conversely, the large "outlier" values can tolerate significantly higher levels of noise without degrading the model's output. This suggests that the difficulty of quantization is not necessarily caused by the outliers themselves, but by how outliers force a uniform quantization grid to "starve" the sensitive small values of precision.

The Outlier Paradox and Non-Uniform Quantization

Standard uniform quantization uses a fixed step size across the entire range of values. When extreme outliers are present, the step size must be large to cover the full range, resulting in high rounding errors for the small values near zero.

We identified a paradox: while outliers are robust to noise (precision loss), they are extremely sensitive to clipping. If outliers are removed or truncated to improve the resolution of smaller values, the model breaks. However, if outliers are kept but represented with less precision, the model remains stable.

The $x^{1/3}$ Transformation

To address this, we implemented a non-linear mapping before quantization. By applying a power-law transformation ($f(x) = x^{1/3}$), we effectively "stretch" the distribution near zero. This redistribution gives smaller values more quantization bins (higher resolution) while allocating fewer bins to larger values. This approach prioritizes the precision of the sensitive small-magnitude values while maintaining the presence of outliers.

Experimental Results

We evaluated our non-uniform approach against standard Round-To-Nearest (RTN) quantization across several benchmarks, including Wikitext-2, C4, and MMLU.

  • Stabilizing OPT Models: The OPT-66B model is notoriously difficult to quantize. Under standard W8A8 (8-bit weight and activation) uniform quantization, the model's perplexity exploded to 2254. Using our non-linear transformation, the model stabilized at 7.38, nearly matching the full-precision baseline of 7.14.
  • Improving LLaMA: For LLaMA-7B (W4A16), our method achieved a perplexity of 20.92 on Wikitext-2, a significant improvement over the 25.05 achieved by uniform quantization, and closer to the original 19.70.
  • High-Efficiency Settings: In the challenging W4A8 configuration, our method maintained high accuracy on reasoning tasks like Lambada (e.g., 88.52% for LLaMA-7B), where standard methods often fail to maintain coherence.

Conclusion and Future Work

Our study demonstrates that the "hardness" of LLM quantization is rooted in the high sensitivity of small-magnitude values to numerical noise. By shifting the focus from outlier suppression to small-value preservation via non-linear transformations, we can achieve significantly better compression ratios.

The primary hurdle for this approach is hardware compatibility. Current GPUs are highly optimized for linear integer arithmetic, making non-linear transformations like $x^{1/3}$ computationally expensive during inference. Future research should explore hardware-friendly approximations of these mappings or investigate pre-training techniques that encourage models to develop more quantization-resilient value distributions.

Summary updated

BibTeX
@inproceedings{gong2024what,
  author = {Zhuocheng Gong and Jiahao Liu and Jingang Wang and Xunliang Cai and Dongyan Zhao and Rui Yan},
  title = {{What Makes Quantization for Large Language Model Hard? An Empirical Study from the Lens of Perturbation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i16.29765},
}
Figure