Outlier Suppression+: Accurate quantization of large language models by equivalent and optimal shifting and scaling

Xiuying Wei, Yunchen Zhang, Yuhang Li, Xiangguo Zhang, Ruihao Gong, Jinyang Guo, Xianglong Liu

TL;DR

This paper introduces Outlier Suppression+ (OS+), a novel post-training quantization (PTQ) method for large language models (LLMs). OS+ effectively handles problematic "outlier" activations by introducing channel-wise shifting and scaling, achieving near-floating-point accuracy at low bitwidths (8-bit, 6-bit, and even 4-bit) with minimal performance degradation.

What Problem Does This Paper Address?

Large language models (LLMs) have achieved remarkable performance but are computationally expensive. Quantization, a technique to reduce model size and speed up inference by using lower-precision numbers, is crucial for deploying these models. However, LLMs are particularly susceptible to "outliers" in their activations – extreme values that can cause significant accuracy drops during quantization. Previous methods often struggle with these outliers, especially when they are asymmetrically distributed across different channels within a layer. This paper tackles the challenge of accurately quantizing LLMs by specifically addressing these asymmetric and concentrated outliers.

Methods

The core of Outlier Suppression+ (OS+) lies in two novel operations:

  • Channel-wise Shifting: This technique addresses the asymmetry of outliers across channels. It shifts the activation values within each channel to center them around zero, effectively removing the bias towards positive or negative extremes. This is achieved by calculating a shift vector z based on the average of the minimum and maximum values in each channel.
  • Channel-wise Scaling: This operation tackles the concentration of outliers within specific channels. After shifting, a scaling vector s is applied to further reduce the magnitude of these outliers, bringing them within a manageable range for quantization. The scaling values are optimized to minimize the impact on the subsequent layer's weights and the overall task performance.

Crucially, OS+ ensures that these shifting and scaling operations are equivalent to the original floating-point operations. This means the effects of z and s can be "migrated" or absorbed into the weights and biases of the subsequent layers, avoiding any additional computational overhead during inference. The paper also proposes a fast and stable scheme to find optimal shifting and scaling values, using an outlier threshold t to guide the search.

Datasets

The authors evaluated their method on various standard datasets and tasks, including:

  • GLUE benchmark: Used for evaluating BERT models across tasks like CoLA, MNLI, MRPC, QNLI, QQP, RTE, SST-2, and STS-B.
  • Zero-shot tasks: Used for evaluating LLMs like OPT, BLOOM, BLOOMZ, and LLaMA. These include language modeling, multiple-choice, and commonsense reasoning tasks.
  • PIQA, Winogrande, HellaSwag, LAMBADA, WikiText2: Specific datasets used for evaluating LLMs in zero-shot settings.

Key Insights and Ideas

  • Outlier Asymmetry is Key: The paper highlights that outliers in LLM activations are not just extreme but often asymmetrically distributed across channels, which significantly degrades quantization performance.
  • Unified Shifting and Scaling: Combining channel-wise shifting (for asymmetry) and scaling (for concentration) provides a powerful, unified approach to outlier suppression.
  • Equivalent Migration: The ability to migrate the effects of shifting and scaling into subsequent layers without extra computation is a critical enabler for efficient deployment.
  • Optimizing for Task Performance: Instead of just minimizing quantization error for activations or weights independently, OS+ optimizes for the actual task loss, leading to better overall performance.
  • Outlier Thresholding for Stability: Using an outlier threshold t in the optimization process makes finding effective scaling values more stable and robust, especially for LLMs.

Key Results

  • Near-Floating-Point Performance: OS+ achieves near-FP accuracy on BERT, OPT, BLOOM, and BLOOMZ models at 8-bit and 6-bit quantization.
  • State-of-the-Art 4-bit BERT: OS+ establishes a new state-of-the-art for 4-bit BERT, showing a 15.5% improvement over previous methods.
  • LLaMA Performance: OS+ demonstrates strong performance on LLaMA models, even outperforming others by significant margins on tasks like Winogrande (10.58% improvement) and achieving lossless 6-bit quantization.
  • Minimal Latency Overhead: The equivalent migration of operations ensures that OS+ introduces negligible latency overhead, making it practical for real-world deployment.
  • Robustness on Larger Models: The paper shows that OS+ is effective even on very large models (e.g., OPT-175B), where other methods struggle.

Limitations and Future Work

  • Understanding Outlier Origins: The authors acknowledge that the underlying reasons for the emergence of outliers and their specific attributes are not fully understood. This might require deeper analysis of the training pipeline and hyperparameters.
  • Hyperparameter Tuning: While the proposed optimization is fast and stable, some hyperparameters might still require careful tuning for optimal performance across diverse models and tasks.
  • Future Work: The paper suggests that further investigation into the training pipeline and hyperparameters could benefit both FP and quantized scenarios. The authors also hint at exploring more flexible techniques for handling outlier channels and their corresponding weights.

Summary updated

Abstract

Quantization of transformer language models faces significant challenges due to the existence of detrimental outliers in activations. We observe that these outliers are asymmetric and concentrated in specific channels. To address this issue, we propose the Outlier Suppression+ framework. First, we introduce channel-wise shifting and scaling operations to eliminate asymmetric presentation and scale down problematic channels. We demonstrate that these operations can be seamlessly migrated into subsequent modules while maintaining equivalence. Second, we quantitatively analyze the optimal values for shifting and scaling, taking into account both the asymmetric property and quantization errors of weights in the next layer. Our lightweight framework can incur minimal performance degradation under static and standard post-training quantization settings. Comprehensive results across various tasks and models reveal that our approach achieves near-floating-point performance on both small models, such as BERT, and large language models (LLMs) including OPTs, BLOOM, and BLOOMZ at 8-bit and 6-bit settings. Furthermore, we establish a new state of the art for 4-bit BERT.
BibTeX
@inproceedings{wei2023outlier,
  author = {Xiuying Wei and Yunchen Zhang and Yuhang Li and Xiangguo Zhang and Ruihao Gong and Jinyang Guo and Xianglong Liu},
  title = {{Outlier Suppression+: Accurate quantization of large language models by equivalent and optimal shifting and scaling}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.102},
}
Figure