[Paper Review] LRP-QViT: Mixed-Precision Vision Transformer Quantization via Layer-wise Relevance Propagation
LRP-QViT proposes a mixed-precision post-training quantization method for Vision Transformers using Layer-wise Relevance Propagation (LRP) to assign bit allocations based on layer importance, improving accuracy over fixed-bit and prior mixed-precision methods. It introduces clipped channel-wise quantization for post-LayerNorm activations to reduce inter-channel variation, achieving state-of-the-art performance at 4-bit and 6-bit quantization levels across ViT, DeiT, and Swin models.
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.
Motivation & Objective
- To address the sub-optimal performance of equal-bit-width quantization in Vision Transformers by enabling mixed-precision quantization based on layer importance.
- To reduce performance degradation in post-LayerNorm activations caused by inter-channel variation through a novel clipping mechanism.
- To develop an efficient, post-training quantization framework that avoids retraining while maintaining high accuracy.
- To demonstrate superior performance over existing fixed-bit and mixed-precision quantization methods on image classification, detection, and segmentation benchmarks.
Proposed method
- LRP is used to compute layer contribution scores by back-propagating relevance from the output to each layer, quantifying each layer’s importance in classification.
- Bit allocation for each layer is determined by the LRP-derived importance scores, assigning higher precision to more critical layers.
- Clipped channel-wise quantization is applied to post-LayerNorm activations, where outliers are removed by adjusting LayerNorm affine factors and subsequent layer weights.
- The method integrates improvements from RepQ-ViT, including the $\log\sqrt{2}$ quantizer for post-Softmax and rescaling to $\log 2$ for inference.
- The framework operates under post-training quantization (PTQ), requiring only a small calibration set (32 images) and no fine-tuning.
- Mixed-precision bit allocation is optimized by reducing bits in less important layers identified via LRP, maintaining average bitwidth constraints.
Experimental results
Research questions
- RQ1Can layer importance scores derived via LRP be effectively used to guide mixed-precision bit allocation in Vision Transformers?
- RQ2Does clipped channel-wise quantization for post-LayerNorm activations mitigate performance degradation due to inter-channel variation?
- RQ3How does LRP-QViT compare to fixed-bit and existing mixed-precision quantization methods in terms of accuracy and efficiency at low bit-widths?
- RQ4Can the proposed method maintain high performance across diverse Vision Transformer architectures (ViT, DeiT, Swin) and tasks (classification, detection, segmentation)?
- RQ5What is the trade-off between calibration data size, inference time, and accuracy in the proposed PTQ framework?
Key findings
- LRP-QViT achieves 81.37% top-1 accuracy on ImageNet-1K using Swin-S with 32-bit calibration and 32 samples, outperforming RepQ-ViT (80.55%) and CRL-QViT (80.55%) at the same bitwidth.
- For DeiT-S with 4-bit quantization, LRP-QViT achieves 75.66% accuracy when 5-bit precision is assigned to the first two blocks and 4-bit to the rest, improving upon 70.78% with uniform 4-bit quantization.
- The clipped channel-wise quantization method improves DeiT-S accuracy by 0.5% over standard channel-wise quantization and 1.7% over layer-wise quantization.
- LRP-QViT achieves state-of-the-art performance in 4-bit and 6-bit post-training quantization, surpassing existing methods on ViT, DeiT, and Swin models across classification, detection, and segmentation tasks.
- The method requires only 32 calibration images and achieves calibration time comparable to FQViT (reconstruction-free), while significantly outperforming it in accuracy (0.10% vs. 1.1% improvement on 4-bit quantization).
- Ablation studies confirm that the first two blocks of ViT-based models are most critical, and reducing bits in less important layers via LRP-based pruning maintains model size while enhancing performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.