arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.06497cs.CVcs.MM
收藏

QuantTune:利用自适应异常值驱动的微调优化模型量化

QuantTune: Optimizing Model Quantization with Adaptive Outlier-Driven Fine Tuning

National Cheng Kung University(成功大学);Rivos Inc.(里沃斯公司)

Jiun-Man Chen, Yu-Hsuan Chao, Yu-Jie Wang, Ming-Der Shieh, Chih-Chung Hsu, Wei-Fen Lin

AI总结:

本文提出 QuantTune,通过异常激活偏差自适应调整权重并约束动态范围,以低成本微调显著降低 Transformer 模型训练后量化的精度损失。

摘要:

基于 Transformer 的模型已在计算机视觉(CV)和自然语言处理(NLP)领域获得广泛普及。然而,训练后线性量化过程中出现了重大挑战,导致推理精度明显下降。本研究聚焦于揭示这些精度下降的根本原因,并提出一种对量化友好的微调方法 QuantTune。首先,我们的分析表明,在目标基于 Transformer 的模型中,平均有 65% 的量化误差来自异常值的动态范围放大效应所造成的精度损失。其次,QuantTune 根据异常激活值的偏差调整权重,并有效约束存在问题的激活值的动态范围。因此,它成功缓解了异常值对量化模型推理精度的负面影响。最后,QuantTune 可无缝集成到微调过程的反向传播阶段,而不会给推理软件和硬件设计带来额外复杂性。我们的方法在一系列基于 Transformer 的模型(包括 ViT、Bert-base 和 OPT)上展现出训练后量化的显著改进。与顶级校准方法相比,QuantTune 在 8 比特量化时将精度下降减少 12.09%,在 7 比特量化时减少 33.8%,并且在 ViT 模型上的表现优于最先进解决方案超过 18.84%。

英文摘要:

Transformer-based models have gained widespread popularity in both the computer vision (CV) and natural language processing (NLP) fields. However, significant challenges arise during post-training linear quantization, leading to noticeable reductions in inference accuracy. Our study focuses on uncovering the underlying causes of these accuracy drops and proposing a quantization-friendly fine-tuning method, \textbf{QuantTune}. Firstly, our analysis revealed that, on average, 65\% of quantization errors result from the precision loss incurred by the dynamic range amplification effect of outliers across the target Transformer-based models. Secondly, \textbf{QuantTune} adjusts weights based on the deviation of outlier activations and effectively constrains the dynamic ranges of the problematic activations. As a result, it successfully mitigates the negative impact of outliers on the inference accuracy of quantized models. Lastly, \textbf{QuantTune} can be seamlessly integrated into the back-propagation pass in the fine-tuning process without requiring extra complexity in inference software and hardware design. Our approach showcases significant improvements in post-training quantization across a range of Transformer-based models, including ViT, Bert-base, and OPT. QuantTune reduces accuracy drops by 12.09\% at 8-bit quantization and 33.8\% at 7-bit compared to top calibration methods, outperforming state-of-the-art solutions by over 18.84\% across ViT models.

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

↑