Skip to main content
QUICK REVIEW

[论文解读] Outlier Suppression: Pushing the Limit of Low-bit Transformer Language Models

Xiuying Wei, Yuncheng Zhang|arXiv (Cornell University)|Sep 27, 2022
Topic ModelingComputer Science被引用 28
一句话总结

该论文提出了一种带有 Gamma Migration 和 Token-Wise Clipping 的异常值抑制框架,以提升 Transformer 模型的低比特量化,在6-bit PTQ和4-bit QAT上对BERT、RoBERTa和BART等模型达到接近全精度的准确度。

ABSTRACT

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.

研究动机与目标

  • 研究 Transformer 量化中结构化异常值的根本原因及影响。
  • 开发一个即插即用的框架,在不增加推理成本的前提下抑制异常值。
  • 在分类、问答和摘要任务中展示在 BERT、RoBERTa 和 BART 上的改进。

提出的方法

  • 识别 LayerNorm 的 gamma 在 Transformer 激活中充当异常值放大器。
  • 提出 Gamma Migration,将 gamma 放大作用转移到后续模块中,等效为 FP 转换。
  • 引入 Token-Wise Clipping,采用粗到细、逐 token 的管线来找到最小化量化损失的 clipping 范围。
  • 在 Gamma Migration 之后对输出进行量化,以在不增加额外计算的情况下降低激活量化误差。
  • 使用粗步通过逐 token 代表来快速估计 clipping 范围,随后对 clipping 参数进行微调。
  • 展示与现有 PTQ/QAT 方法的即插即用兼容性。

实验结果

研究问题

  • RQ1Transformer 激活中的异常值如何产生,以及 LayerNorm 的 gamma 如何促成它们?
  • RQ2异常值放大是否可以迁移到后面的层以在不增加成本的情况下提高量化鲁棒性?
  • RQ3如何在不同范围的 token 上实施上述粗到细的逐 token 剪裁,以有效最小化量化损失?
  • RQ4Gamma Migration 和 Token-Wise Clipping 在 PTQ 和 QAT 设置下,是否能在 BERT、RoBERTa 和 BART 上提升量化性能?

主要发现

  • Gamma Migration 在对权重影响最小的前提下减少了激活量化负担。
  • Token-Wise Clipping 高效地识别 clipping 范围,最终量化损失最小。
  • 该框架在多项任务中提升了 BERT、RoBERTa 和 BART 的 PTQ/QAT 表现。
  • 在 6-bit PTQ 下,该方法将性能推向接近全精度;在 4-bit QAT 下,在若干设置中达到接近 FP 的准确性。
  • 该框架在变压器量化方面达到最新的最佳(state-of-the-art)结果,并在某些模型上通过 6-bit PTQ 实现接近全精度的性能。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。