arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2209.13325cs.LG
收藏

Outlier Suppression:突破低比特Transformer语言模型的极限

Outlier Suppression: Pushing the Limit of Low-bit Transformer Language Models

Beihang University(北京航空航天大学);SenseTime Research(商汤科技研究院);University of Electronic Science and Technology of China(电子科技大学);Peking University(北京大学)

Xiuying Wei, Yunchen Zhang, Xiangguo Zhang, Ruihao Gong, Shanghang Zhang, Qi Zhang, Fengwei Yu, Xianglong Liu

摘要:

Transformer体系结构已成为广泛使用的自然语言处理~(NLP)模型的基本元素。随着大型NLP模型的发展趋势,不断增加的内存和计算成本阻碍了它们在资源有限的设备上的有效部署。因此,Transformer量子化引起了广泛的研究兴趣。最近的工作认识到,结构化离群值是量化性能的关键瓶颈。然而,他们提出的方法增加了计算开销,仍然留下了离群值。为了从根本上解决这一问题,本文深入探讨了异常值的内在诱因和重要性。我们发现LayerNorm(LN)中的$\boldsymbol γ$充当离群值的罪恶放大器,并且离群值的重要性变化很大,其中一些标记提供的离群值覆盖了很大的区域,但可以在没有负面影响的情况下被急剧剪切。基于这些发现,我们提出了一个离群值抑制框架,包括两个组件:Gamma迁移和令牌裁剪。Gamma Migration将离群值放大器迁移到等效转换中的后续模块,从而在没有任何额外负担的情况下为更量化友好的模型做出贡献。Token-Wise Clipping利用了令牌范围的大方差,并设计了一个令牌级的粗到精流水线,以有效的方式获得具有最小最终量化损失的裁剪范围。该框架有效地抑制了异常值,并且可以在即插即用模式中使用。大量的实验证明,我们的框架超越了现有的工作,并首次将6位后训练BERT量化到全精度(FP)水平。我们的代码可在https://github.com/wimh966/outlier_suppression上获得。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑