[Paper Review] Outlier Suppression: Pushing the Limit of Low-bit Transformer Language Models
The paper introduces an outlier suppression framework with Gamma Migration and Token-Wise Clipping to improve low-bit quantization of Transformer models, achieving near full-precision accuracy at 6-bit PTQ and 4-bit QAT on models like BERT, RoBERTa, and BART.
Transformer architecture has become the fundamental element of the widespread natural language processing~(NLP) models. With the trends of large NLP models, the increasing memory and computation costs hinder their efficient deployment on resource-limited devices. Therefore, transformer quantization attracts wide research interest. Recent work recognizes that structured outliers are the critical bottleneck for quantization performance. However, their proposed methods increase the computation overhead and still leave the outliers there. To fundamentally address this problem, this paper delves into the inherent inducement and importance of the outliers. We discover that $\boldsymbol γ$ in LayerNorm (LN) acts as a sinful amplifier for the outliers, and the importance of outliers varies greatly where some outliers provided by a few tokens cover a large area but can be clipped sharply without negative impacts. Motivated by these findings, we propose an outlier suppression framework including two components: Gamma Migration and Token-Wise Clipping. The Gamma Migration migrates the outlier amplifier to subsequent modules in an equivalent transformation, contributing to a more quantization-friendly model without any extra burden. The Token-Wise Clipping takes advantage of the large variance of token range and designs a token-wise coarse-to-fine pipeline, obtaining a clipping range with minimal final quantization loss in an efficient way. This framework effectively suppresses the outliers and can be used in a plug-and-play mode. Extensive experiments prove that our framework surpasses the existing works and, for the first time, pushes the 6-bit post-training BERT quantization to the full-precision (FP) level. Our code is available at https://github.com/wimh966/outlier_suppression.
Motivation & Objective
- Investigate the root causes and impacts of structured outliers in Transformer quantization.
- Develop a plug-and-play framework to suppress outliers without increasing inference cost.
- Demonstrate improvements across BERT, RoBERTa, and BART on classification, QA, and summarization tasks.
Proposed method
- Identify that LayerNorm gamma acts as an outlier amplifier in Transformer activations.
- Propose Gamma Migration to move the gamma amplification into subsequent modules in an equivalent FP transformation.
- Introduce Token-Wise Clipping with a coarse-to-fine, token-wise pipeline to find a minimal quantization loss clipping range.
- Quantize outputs after Gamma Migration to reduce activation quantization error without extra computation.
- Use a coarse step to quickly estimate clipping ranges via token-wise representatives, followed by a fine-tuning step on the clipping parameter.
- Demonstrate plug-and-play compatibility with existing PTQ/QAT methods.
Experimental results
Research questions
- RQ1How do outliers arise in Transformer activations and how does LayerNorm gamma contribute to them?
- RQ2Can outlier amplification be migrated to later layers to improve quantization robustness without extra cost?
- RQ3How can token-wise, coarse-to-fine clipping minimize quantization loss efficiently across tokens with variable ranges?
- RQ4Do Gamma Migration and Token-Wise Clipping improve quantization performance across BERT, RoBERTa, and BART in PTQ and QAT settings?
Key findings
- Gamma Migration reduces activation quantization burden with minimal impact on weights.
- Token-Wise Clipping efficiently identifies clipping ranges with minimal final quantization loss.
- The framework improves PTQ/QAT performance across BERT, RoBERTa, and BART on multiple tasks.
- At 6-bit PTQ, the method pushes performance close to full precision; at 4-bit QAT, it achieves near-FP accuracy on several setups.
- The framework achieves state-of-the-art results for transformer quantization and enables full-precision level performance under 6-bit PTQ for some models.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.