arXiv:2504.02508cs.CV2025-04CVPR被引 21

针对视觉Transformer量化后精度下降问题,提出基于平均扰动海森的重建方法。

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

  • 用平均扰动海森损失改进重要性估计,提升量化精度。
  • 3比特和4比特下在多个任务上显著优于现有方法。
  • 适合需要低比特部署视觉Transformer的研究者与工程师。

视觉Transformer(ViTs)已成为视觉任务中最常用的骨干网络之一。尽管性能优异,但在实际部署中进行极低比特量化时,尤其是采用后训练量化(PTQ)时,往往出现显著的精度下降。近年来,基于重建的PTQ方法在卷积神经网络(CNNs)中表现良好,但应用于ViTs时效果不佳,主要由于输出重要性估计不准确以及后GELU激活值量化导致的严重精度损失。为此,本文提出新型PTQ方法APHQ-ViT,基于平均扰动海森(APH)的重要性估计。我们首先分析了现有海森损失近似方法,提出改进的平均扰动海森损失;针对后GELU激活值的量化问题,设计了一种基于小规模无标签校准集的MLP重建(MR)方法,将MLP中的GELU替换为ReLU,并通过APH损失进行重建。大量实验表明,使用线性量化器的APHQ-ViT在3比特和4比特下,在不同视觉任务上均显著超越现有PTQ方法。代码已开源:https://github.com/GoatWu/APHQ-ViT。

原文摘要 · Abstract (English)

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.

视觉Transformer量化后训练量化MLP重建

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。