arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.11243cs.CV
收藏

LRP-QViT:基于层级相关性传播的混合精度 Vision Transformer 量化

LRP-QViT: Mixed-Precision Vision Transformer Quantization via Layer-wise Relevance Propagation

Rochester Institute of Technology(罗切斯特理工学院)

Navin Ranjan, Andreas Savakis

AI总结:

本文提出 LRP-QViT,利用 LRP 衡量各层对分类的相关性以分配混合精度,并结合截断逐通道量化,在 ViT、DeiT 和 Swin 上实现优于现有方法的 4/6 比特 PTQ。

摘要:

Vision Transformer(ViT)已在多种视觉任务上展现出卓越性能。然而,ViT 模型需要大量计算和内存资源,这使其难以部署在资源受限平台上。量化是减小模型尺寸的常用方法,但多数研究主要关注整个网络的等比特宽度量化,从而导致次优解。尽管已有少量关于 ViT 混合精度量化(MPQ)的工作,但它们通常依赖基于搜索空间的方法,或任意地采用混合精度。本文提出 LRP-QViT,这是一种基于可解释性的方法,根据不同层在分类过程中的重要性为其分配混合精度比特位。具体而言,为衡量每一层在预测目标类别时的贡献分数,我们采用层级相关性传播(Layer-wise Relevance Propagation,LRP)方法。LRP 在输出层分配局部相关性,并将其通过所有层传播,持续分配相关性直至到达输入层。这些相关性分数用作计算层贡献分数的指标。此外,我们提出了一种截断的逐通道量化,旨在消除 LayerNorm 后激活值中的异常值,以缓解严重的通道间差异。为验证和评估该方法,我们在多个数据集上对 ViT、DeiT 和 Swin Transformer 模型应用 LRP-QViT。实验结果表明,在 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.

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

↑