arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2307.00331cs.LGcs.AIcs.CV
收藏

量化方差:以新视角训练低比特精度Transformer

Quantization Variation: A New Perspective on Training Transformers with Low-Bit Precision

Hong Kong University of Science and Technology(香港科技大学);Mohamed bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学)

Xijie Huang, Zhiqiang Shen, Pingcheng Dong, Kwang-Ting Cheng

AI总结:

本文揭示了Transformer低比特量化感知训练中的方差行为问题,提出一种方差感知量化方案,在视觉和语言任务上显著提升了2-bit Swin-T和二值化BERT-base的准确率。

摘要:

尽管Transformer在语言和视觉任务中均表现出色,但不断增长的计算量和模型规模增加了对高效部署的需求。为了解决计算量大和参数量多的缺点,量化作为代表性的模型压缩技术在社区中被广泛研究,并已在ConvNets上得到广泛应用。然而,由于Transformer具有独特的性质,低比特量化应用仍然有限且研究不足。在本文中,我们指出了Transformer低比特量化感知训练(QAT)的困难在于其独特的方差行为,这与ConvNets显著不同。基于全面的定量分析,我们观察到了三个层次上的变化:不同模块的量化敏感性差异、静态权重和激活分布中的异常值,以及动态参数波动中的振荡。Transformer的这些方差给量化感知训练(QAT)带来了不稳定性,并对性能产生负面影响。我们探索了在低比特Transformer QAT期间减轻方差影响的最佳实践,并针对视觉和语言Transformer提出了一种方差感知量化方案。我们进行了广泛验证,表明我们的方案能够缓解方差并提升各种模型和任务中Transformer的性能。我们的解决方案显著改进了2-bit Swin-T和二值化BERT-base,在ImageNet-1K和GLUE上分别比之前的最先进方法实现了3.35%和1.4%的准确率提升。代码和模型可在https://github.com/HuangOwen/Quantization-Variation获取。

英文摘要:

Despite the outstanding performance of transformers in both language and vision tasks, the expanding computation and model size have increased the demand for efficient deployment. To address the heavy computation and parameter drawbacks, quantization is frequently studied in the community as a representative model compression technique and has seen extensive use on ConvNets. However, due to the unique properties of transformers, the low-bit quantization applications are still limited and underexplored. In this paper, we identify the difficulty of transformer low-bit quantization-aware training on its unique variation behaviors, which significantly differ from ConvNets. Based on comprehensive quantitative analysis, we observe variation in three hierarchies: various module quantization sensitivities, outliers in static weight and activation distribution, and oscillation in dynamic parameter fluctuations. These variations of transformers bring instability to the quantization-aware training (QAT) and negatively influence the performance. We explore the best practices to alleviate the variation's influence during low-bit transformer QAT and propose a variation-aware quantization scheme for both vision and language transformers. We extensively verify and show our scheme can alleviate the variation and improve the performance of transformers across various models and tasks. Our solution substantially improves the 2-bit Swin-T and binary BERT-base, achieving a 3.35% and 1.4% accuracy improvement over previous state-of-the-art methods on ImageNet-1K and GLUE. Codes and models are available at https://github.com/HuangOwen/Quantization-Variation.

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

↑