[论文解读] LRP-QViT: Mixed-Precision Vision Transformer Quantization via Layer-wise Relevance Propagation
LRP-QViT 提出了一种基于逐层显著性传播(LRP)的混合精度后训练量化方法,用于视觉变换器(Vision Transformers),通过层重要性分配比特数,提升了固定比特和先前混合精度方法的准确率。该方法引入了截断的通道级量化机制,用于层归一化后的激活值,以减少通道间差异,从而在 ViT、DeiT 和 Swin 模型上实现了 4 位和 6 位量化下的最先进性能。
Vision transformers (ViTs) have demonstrated remarkable performance across various visual tasks. However, ViT models suffer from substantial computational and memory requirements, making it challenging to deploy them on resource-constrained platforms. Quantization is a popular approach for reducing model size, but most studies mainly focus on equal bit-width quantization for the entire network, resulting in sub-optimal solutions. While there are few works on mixed precision quantization (MPQ) for ViTs, they typically rely on search space-based methods or employ mixed precision arbitrarily. In this paper, we introduce LRP-QViT, an explainability-based method for assigning mixed-precision bit allocations to different layers based on their importance during classification. Specifically, to measure the contribution score of each layer in predicting the target class, we employ the Layer-wise Relevance Propagation (LRP) method. LRP assigns local relevance at the output layer and propagates it through all layers, distributing the relevance until it reaches the input layers. These relevance scores serve as indicators for computing the layer contribution score. Additionally, we have introduced a clipped channel-wise quantization aimed at eliminating outliers from post-LayerNorm activations to alleviate severe inter-channel variations. To validate and assess our approach, we employ LRP-QViT across ViT, DeiT, and Swin transformer models on various datasets. Our experimental findings demonstrate that both our fixed-bit and mixed-bit post-training quantization methods surpass existing models in the context of 4-bit and 6-bit quantization.
研究动机与目标
- 为解决视觉变换器中等比特宽度量化带来的次优性能问题,提出基于层重要性的混合精度量化方法。
- 通过新型截断机制减少层归一化后激活值中因通道间差异导致的性能下降。
- 开发一种高效、无需微调的后训练量化框架,以保持高准确率。
- 在图像分类、目标检测和实例分割基准上,证明该方法在性能上优于现有的固定比特和混合精度量化方法。
提出的方法
- 利用 LRP 计算各层的贡献得分,通过从输出反向传播显著性,量化每一层在分类任务中的重要性。
- 根据 LRP 推导出的层重要性得分,为各层分配比特数,将更高精度分配给更关键的层。
- 对层归一化后的激活值应用截断的通道级量化,通过调整层归一化仿射参数和后续层权重,去除异常值。
- 框架整合了 RepQ-ViT 的改进,包括用于 Softmax 后输出的 $\log\sqrt{2}$ 量化器,以及推理阶段的 $\log 2$ 重标定。
- 该方法采用后训练量化(PTQ)范式,仅需少量校准集(32 张图像),无需微调。
- 通过减少 LRP 识别出的不重要层的比特数,优化混合精度比特分配,在保持平均比特宽度约束的前提下实现性能提升。
实验结果
研究问题
- RQ1能否有效利用 LRP 推导出的层重要性得分,指导视觉变换器中的混合精度比特分配?
- RQ2对层归一化后激活值采用截断的通道级量化是否能缓解因通道间差异导致的性能下降?
- RQ3在低比特宽度下,LRP-QViT 与固定比特和现有混合精度量化方法相比,在准确率和效率方面表现如何?
- RQ4所提方法能否在多种视觉变换器架构(ViT、DeiT、Swin)和任务(分类、检测、分割)中保持高性能?
- RQ5在所提出的 PTQ 框架中,校准数据集大小、推理时间和准确率之间的权衡关系如何?
主要发现
- 在使用 32 张校准图像和 32 位校准设置下,LRP-QViT 在 ImageNet-1K 上对 Swin-S 模型实现了 81.37% 的 top-1 准确率,优于 RepQ-ViT(80.55%)和 CRL-QViT(80.55%)在相同比特宽度下的表现。
- 对于 DeiT-S 模型,在 4 位量化下,当第一二个块使用 5 位精度、其余块使用 4 位时,LRP-QViT 实现了 75.66% 的准确率,优于统一 4 位量化下的 70.78%。
- 与标准通道级量化相比,截断的通道级量化方法使 DeiT-S 的准确率提升了 0.5%;与逐层量化相比,提升了 1.7%。
- LRP-QViT 在 4 位和 6 位后训练量化中达到最先进性能,在 ViT、DeiT 和 Swin 模型的分类、检测和分割任务中均优于现有方法。
- 该方法仅需 32 张校准图像,校准时间与 FQViT(无需重建)相当,但在准确率上显著优于 FQViT(4 位量化下提升 0.10% vs. 1.1%)。
- 消融实验确认,ViT 类模型的前两个块最为关键,通过基于 LRP 的剪枝减少不重要层的比特数,可在不增加模型大小的前提下提升性能。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。