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

APHQ-ViT:基于平均扰动海森矩阵重建的视觉Transformer训练后量化

APHQ-ViT: Post-Training Quantization with Average Perturbation Hessian Based Reconstruction for Vision Transformers

Beihang University(北京航空航天大学)

Zhuguanyu Wu, Jiayi Zhang, Jiaxin Chen, Jinyang Guo, Di Huang, Yunhong Wang

AI总结:

针对ViTs在超低比特PTQ下精度下降问题,提出APHQ-ViT方法,利用平均扰动海森矩阵损失改进重要性估计,并设计MLP重建方法处理post-GELU激活值量化,在3-bit和4-bit任务上显著优于现有方法。

摘要:

视觉Transformer(ViTs)已成为视觉任务中最常用的骨干网络之一。尽管其性能卓越,但在实际部署中进行量化时,尤其是在超低比特的训练后量化(PTQ)下,常会出现显著的精度下降。近期,基于重建的PTQ方法在量化卷积神经网络(CNNs)时展现出良好性能。然而,将其应用于ViTs时却会失败,主要原因是对输出重要性估计不准确,以及量化post-GELU激活值时出现严重精度退化。为解决这些问题,我们提出了APHQ-ViT,一种基于平均扰动海森矩阵(APH)重要性估计的新型PTQ方法。具体而言,我们首先深入分析了当前基于海森矩阵损失的近似方法,并提出了一种改进的平均扰动海森矩阵损失。为处理post-GELU激活值的量化,我们设计了MLP重建(MR)方法,将MLP中的GELU函数替换为ReLU,并在小型无标签校准集上利用APH损失进行重建。大量实验表明,使用线性量化器的APHQ-ViT在3比特和4比特设置下,于不同视觉任务中均以显著优势优于现有PTQ方法。源代码可在https://github.com/GoatWu/APHQ-ViT获取。

英文摘要:

Vision Transformers (ViTs) have become one of the most commonly used backbones for vision tasks. Despite their remarkable performance, they often suffer significant accuracy drops when quantized for practical deployment, particularly by post-training quantization (PTQ) under ultra-low bits. Recently, reconstruction-based PTQ methods have shown promising performance in quantizing Convolutional Neural Networks (CNNs). However, they fail when applied to ViTs, primarily due to the inaccurate estimation of output importance and the substantial accuracy degradation in quantizing post-GELU activations. To address these issues, we propose \textbf{APHQ-ViT}, a novel PTQ approach based on importance estimation with Average Perturbation Hessian (APH). Specifically, we first thoroughly analyze the current approximation approaches with Hessian loss, and propose an improved average perturbation Hessian loss. To deal with the quantization of the post-GELU activations, we design an MLP Reconstruction (MR) method by replacing the GELU function in MLP with ReLU and reconstructing it by the APH loss on a small unlabeled calibration set. Extensive experiments demonstrate that APHQ-ViT using linear quantizers outperforms existing PTQ methods by substantial margins in 3-bit and 4-bit across different vision tasks. The source code is available at https://github.com/GoatWu/APHQ-ViT.

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

↑