ZeroQuant-FP: A Leap Forward in LLMs Post-Training W4A8 Quantization Using Floating-Point Formats

Xiaoxia Wu, Zhewei Yao, Yuxiong HearXiv 2023 · DOI

Introduction: The Challenge of Activation Outliers

As Large Language Models (LLMs) scale to hundreds of billions of parameters, efficient deployment becomes a critical challenge. Quantization—reducing the precision of weights and activations—is the standard approach to reduce memory footprint and accelerate inference. While weight-only quantization (e.g., INT4) is well-established, quantizing activations remains difficult due to the presence of significant outliers.

In LLMs, certain activation values in internal layers are orders of magnitude larger than the rest. In a traditional uniform integer quantization system (like INT8), these outliers force a wide quantization scale, causing the majority of "normal" values to lose precision as they are compressed toward zero.

Activation distributions across different layers showing significant outliers that complicate uniform quantization.

Methods: ZeroQuant-FP

ZeroQuant-FP addresses these limitations by shifting from integer formats to floating-point (FP) formats, specifically FP8 for activations and FP4 for weights.

1. Floating-Point Quantization (ExMy)

Unlike linear integer scales, floating-point formats use an exponent-mantissa structure. This provides a non-linear distribution with a higher dynamic range, allowing the model to capture both small, frequent values and large, rare outliers more effectively than a linear integer scale.

Comparison of original values against INT8 and FP8 quantization, illustrating FP8's superior ability to represent a wide dynamic range.

2. Low Rank Compensation (LoRC)

Smaller models are often more sensitive to the noise introduced by quantization. To mitigate this, ZeroQuant-FP employs Low Rank Compensation (LoRC). By applying Singular Value Decomposition (SVD) to the quantization error matrix, the authors extract a low-rank correction that is added back to the weights, recovering accuracy with negligible computational overhead.

3. Hardware-Friendly Scaling

To ensure high performance on modern hardware like the NVIDIA H100, the authors introduced power-of-2 scaling constraints. This allows the necessary alignment between 4-bit weights and 8-bit activations to be performed using fast bit-shifting operations rather than expensive floating-point divisions.

Key Results and Insights

The researchers evaluated ZeroQuant-FP on the LLaMA and OPT model families across benchmarks like WikiText-2, PTB, and C4.

  • Near-Lossless W4A8: For larger models (LLaMA-13B and 30B), the W4A8 floating-point scheme achieved near-lossless performance compared to the FP16 baseline.
  • FP8 vs. INT8: In W8A8 configurations, shifting from INT to FP quantization reduced perplexity (PPL) by 0.25 for LLaMA-7B. In the more aggressive W4A8 setup, the FP approach showed a 0.4 PPL improvement over integer baselines.
  • Scaling Efficiency: The use of power-of-2 scaling proved that high accuracy can be maintained without introducing latency bottlenecks during the FP4-to-FP8 conversion process.

Conclusion

ZeroQuant-FP demonstrates that floating-point formats are inherently better suited for the activation distributions of LLMs than traditional integer formats. By combining FP8/FP4 quantization with Low Rank Compensation and optimized hardware scaling, the authors provide a path toward highly efficient, near-lossless W4A8 inference on next-generation hardware.

Summary updated

BibTeX
@misc{wu2023zeroquant,
  author = {Xiaoxia Wu and Zhewei Yao and Yuxiong He},
  title = {{ZeroQuant-FP: A Leap Forward in LLMs Post-Training W4A8 Quantization Using Floating-Point Formats}},
  year = {2023},
  eprint = {2307.09782},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.09782},
}
Figure