Adaptive Quantization Error Reconstruction for LLMs with Mixed Precision

Lin Ou, Jinpeng Xia, Yuewei Zhang, Chuzhan Hao, Hao Henry WangCOLM 2024

TL;DR

AMLQ (Adaptive Mixed Precision and Low-Rank Quantization Error Reconstruction) is a new post-training quantization framework that compresses Large Language Models (LLMs) to ultra-low bit-widths (2–3 bits) with minimal accuracy loss. By adaptively searching for the optimal bit-precision for each layer and using low-rank matrices to correct errors in output activations, it achieves over 3× inference speedup compared to FP16 and significantly outperforms existing methods like AWQ and OmniQuant at low bitrates.

What Problem Does This Paper Address?

As LLMs grow to hundreds of billions of parameters, their memory and computational demands become prohibitive for real-world deployment. Quantization—reducing the precision of model weights from 16-bit floating point (FP16) to lower-bit integers (like INT4 or INT2)—is the primary solution.

However, current Post-Training Quantization (PTQ) methods face two major hurdles:

  1. Uniformity Bias: They often apply the same bit-width to every layer, ignoring the fact that some layers are far more sensitive to precision loss than others.
  2. The "Low-Bit Cliff": When pushing down to 2 or 3 bits, model accuracy typically collapses. While some methods use complex "codebooks" to maintain accuracy, these are often too slow for practical inference.

Methods

The authors propose a two-pronged approach called AMLQ:

1. Adaptive Mixed Precision

Rather than a "one size fits all" approach, AMLQ treats quantization as an optimization problem. It defines a candidate set of bit-precisions (from 2 to 16 bits) and uses an activation-induced greedy search to find the best bit-width for each layer. This ensures that "sensitive" layers (often the deeper ones) keep more bits, while less critical layers are compressed more aggressively to meet a target average Bit-Per-Weight (BPW).

2. Low-Rank Quantization Error Reconstruction

To fix the errors introduced by quantization, the authors introduce a correction mechanism. The key "aha!" moment here is that while the errors in the weights themselves are high-rank (hard to compress), the errors in the output activations are surprisingly low-rank.

Figure 1: Motivation of our proposed AMLQ. (a) The varying quantization error sensitivity of different layer weights in LLMs. We observe that the deep layers are more sensitive than others in quantization bit precision. (b) The introduction of the low-rank approximation quantization error reconstruction can mitigate the significant degradation of model perfor- mance at low-bit precision. (c) The output activation errors decomposed by our approach are low-rank, while the layer weight errors are not low-rank.

By applying Principal Component Analysis (PCA) to these activation errors, AMLQ adds two very small, low-rank matrices ($A$ and $B$) to each quantized layer. These matrices act as a "correction term," significantly reducing the output error with negligible memory overhead (adding only about 0.2 bits to the average BPW).

Datasets

The researchers evaluated AMLQ across a wide variety of models (LLaMA, LLaMA-2, Qwen) and benchmarks:

  • Language Modeling: Perplexity (PPL) measured on the WikiText-2 dataset.
  • Zero-shot Downstream Tasks: ARC (Easy & Challenge), PIQA, WinoGrande, and HellaSwag.
  • Comprehensive Benchmarks: MMLU (knowledge), GSM8K (math), HumanEval (coding), and C-Eval (Chinese language).

Key Insights and Ideas

  • Sensitivity is Non-Uniform: Deep layers in LLMs are significantly more sensitive to quantization than earlier layers. An adaptive strategy that allocates bits where they matter most is far more efficient than global quantization.
  • Activation Error is the Key: Previous attempts to use low-rank decomposition failed because they focused on weight matrices. By focusing on the output of the layer (activations), the authors found a low-rank structure that is much easier to exploit for error correction.
  • Orthogonality: The low-rank reconstruction module is "plug-and-play." It can be added to other quantization methods like AWQ or OmniQuant to further boost their performance at low bitrates.

Key Results

AMLQ demonstrates a superior balance between accuracy and speed:

  • Accuracy at Low Bits: In 2-bit and 3-bit settings, AMLQ consistently outperforms AWQ and OmniQuant. For example, on LLaMA-2-7b at ~2.5 BPW, AMLQ achieved a perplexity of 7.68, while standard mixed precision (AMQ) without the low-rank correction collapsed to 15.03.
  • Inference Speed: By using a custom CUDA operator, AMLQ achieves a 3× speedup over FP16. Notably, it is about 6× faster than Quip#, the current state-of-the-art for 2-bit accuracy, which suffers from slow inference due to its complex codebook approach.
Table 1: Perplexity comparison on WikiText-2. AMLQ shows significant gains over baselines, especially in the 2-bit and 3-bit ranges.
Table 2: A comparison of five downstream task % accuracy (↑) with INT4 quantization on LLaMA-2 models. Bold text indicates the best results. Compared with the strong baselines, AMLQ achieves the best average accuracy.

Limitations and Future Work

  • Greedy Search: The current adaptive search uses a greedy strategy. While fast, it may not find the absolute global optimum for bit-allocation across the entire model.
  • Hardware Dependency: The 3× speedup relies on specialized CUDA kernels. Porting these benefits to other hardware (like CPUs or mobile NPUs) would require additional engineering.
  • Extreme Ranks: The authors noted that their search strategy sometimes prefers extreme ranks (either 0 or 128) for the correction matrices, suggesting there might be room to refine the rank-selection logic.

Summary updated

BibTeX
@inproceedings{ou2024adaptive,
  author = {Lin Ou and Jinpeng Xia and Yuewei Zhang and Chuzhan Hao and Hao Henry Wang},
  title = {{Adaptive Quantization Error Reconstruction for LLMs with Mixed Precision}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=T5pGDydMkS},
}
Figure