arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2407.06794cs.CV
收藏

通过误差缩减实现视觉Transformer的精确训练后量化

Towards Accurate Post-Training Quantization of Vision Transformers via Error Reduction

Xiamen University(厦门大学);Peng Cheng Laboratory(鹏城实验室)

Yunshan Zhong, You Huang, Jiawei Hu, Yuxin Zhang, Rongrong Ji

AI总结:

本文提出两步训练后量化方法ERQ,依次通过激活量化误差缩减和权重量化误差缩减,显著降低视觉Transformer的量化误差并提升精度。

摘要:

视觉Transformer(ViTs)的训练后量化(PTQ)因其数据需求极小且时间效率高,受到学术界和工业界越来越多的关注。然而,许多现有方法未能考虑量化权重与激活之间复杂的相互作用,导致显著的量化误差和次优性能。本文提出ERQ,一种创新的两步PTQ方法,专门设计用于依次减少由激活量化和权重量化引起的量化误差。第一步,激活量化误差缩减(Aqer),首先应用重参数化初始化,旨在缓解高方差激活中的初始量化误差。然后,通过构建岭回归问题进一步缓解误差,该问题使用闭式解更新保持全精度的权重。第二步,权重量化误差缩减(Wqer),首先应用双均匀量化来处理具有大量异常值的权重,这些异常值源于重参数化初始化期间的调整,从而减少初始权重量化误差。然后,采用迭代方法进一步处理误差。在每次迭代中,采用舍入细化,使用经验推导的高效代理来细化量化权重的舍入方向,并辅以岭回归求解器来减少误差。全面的实验结果表明,ERQ在各种ViTs变体和任务上均表现出优越性能。例如,ERQ在W3A4 ViT-S上的准确率显著超过最先进的GPTQ达36.81%。我们的代码可在https://github.com/zysxmu/ERQ获取。

英文摘要:

Post-training quantization (PTQ) for vision transformers (ViTs) has received increasing attention from both academic and industrial communities due to its minimal data needs and high time efficiency. However, many current methods fail to account for the complex interactions between quantized weights and activations, resulting in significant quantization errors and suboptimal performance. This paper presents ERQ, an innovative two-step PTQ method specifically crafted to reduce quantization errors arising from activation and weight quantization sequentially. The first step, Activation quantization error reduction (Aqer), first applies Reparameterization Initialization aimed at mitigating initial quantization errors in high-variance activations. Then, it further mitigates the errors by formulating a Ridge Regression problem, which updates the weights maintained at full-precision using a closed-form solution. The second step, Weight quantization error reduction (Wqer), first applies Dual Uniform Quantization to handle weights with numerous outliers, which arise from adjustments made during Reparameterization Initialization, thereby reducing initial weight quantization errors. Then, it employs an iterative approach to further tackle the errors. In each iteration, it adopts Rounding Refinement that uses an empirically derived, efficient proxy to refine the rounding directions of quantized weights, complemented by a Ridge Regression solver to reduce the errors. Comprehensive experimental results demonstrate ERQ's superior performance across various ViTs variants and tasks. For example, ERQ surpasses the state-of-the-art GPTQ by a notable 36.81% in accuracy for W3A4 ViT-S. Our codes are available at https://github.com/zysxmu/ERQ.

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

↑