Skip to main content
QUICK REVIEW

[Paper Review] Q-ViT: Accurate and Fully Quantized Low-bit Vision Transformer

Yanjing Li, Sheng Xu|arXiv (Cornell University)|Oct 13, 2022
CCD and CMOS Imaging SensorsEngineering31 citations
TL;DR

Q-ViT introduces an Information Rectification Module (IRM) and Distribution Guided Distillation (DGD) to enable fully quantized low-bit Vision Transformers, achieving close to or surpassing full-precision accuracy on ImageNet with substantial speedups.

ABSTRACT

The large pre-trained vision transformers (ViTs) have demonstrated remarkable performance on various visual tasks, but suffer from expensive computational and memory cost problems when deployed on resource-constrained devices. Among the powerful compression approaches, quantization extremely reduces the computation and memory consumption by low-bit parameters and bit-wise operations. However, low-bit ViTs remain largely unexplored and usually suffer from a significant performance drop compared with the real-valued counterparts. In this work, through extensive empirical analysis, we first identify the bottleneck for severe performance drop comes from the information distortion of the low-bit quantized self-attention map. We then develop an information rectification module (IRM) and a distribution guided distillation (DGD) scheme for fully quantized vision transformers (Q-ViT) to effectively eliminate such distortion, leading to a fully quantized ViTs. We evaluate our methods on popular DeiT and Swin backbones. Extensive experimental results show that our method achieves a much better performance than the prior arts. For example, our Q-ViT can theoretically accelerates the ViT-S by 6.14x and achieves about 80.9% Top-1 accuracy, even surpassing the full-precision counterpart by 1.0% on ImageNet dataset. Our codes and models are attached on https://github.com/YanjingLi0202/Q-ViT

Motivation & Objective

  • Identify why fully quantized ViTs suffer large performance drops compared to full-precision counterparts.
  • Develop mechanisms to rectify information distortion in quantized self-attention (IRM).
  • Design a distillation scheme that aligns distributions between quantized and full-precision models (DGD).
  • Demonstrate that fully quantized ViTs with IRM and DGD outperform baseline quantization and approach or exceed FP performance on ImageNet.
  • Validate Q-ViT on DeiT and Swin backbones across 2–4 bit quantization regimes.

Proposed method

  • Diagnose the bottlenecks of fully quantized ViTs and quantify information distortion in the quantized self-attention map.
  • Introduce Information Rectification Module (IRM) to maximize the entropy of quantized queries and keys, restoring information content in attention.
  • Propose Distribution Guided Distillation (DGD) to align distributions via attention-based similarity matrices and patch-level semantic distillation.
  • Quantize ViT components using a quantization-aware training (QAT) framework with asymmetric activations and symmetric weights, using a straight-through estimator for backpropagation.
  • Leverage teacher–student distillation where the teacher provides distributional guidance through similarity matrices derived from quantized and full-precision activations.
  • Evaluate on ImageNet with DeiT and Swin backbones, comparing against LSQ and baseline fully quantized ViT configurations.

Experimental results

Research questions

  • RQ1Can IRM restore information content in the attention maps of low-bit quantized ViTs to match full-precision distributions?
  • RQ2Does maximizing entropy in quantized attention representations improve forward propagation performance for ViTs?
  • RQ3Can Distribution Guided Distillation effectively reduce backward-propagation distribution mismatch between quantized and full-precision ViTs?
  • RQ4How close can fully quantized ViTs with IRM and DGD come to or surpass full-precision ViTs on ImageNet?
  • RQ5Are the benefits of IRM and DGD consistent across DeiT and Swin backbones and across 2–4 bit quantization?

Key findings

  • Fully quantized ViT baselines exhibit significant performance drops, especially when key components of MHSA are quantized.
  • IRM increases attention representation entropy and improves Top-1 accuracy relative to the fully quantized baseline (e.g., gains observed across 2–4 bit regimes).
  • DGD provides further gains by aligning distributions via patch-based similarity matrices between quantized and full-precision activations.
  • Combined IRM and DGD (Q-ViT) substantially closes the gap to full-precision ViTs and, in some settings, surpasses FP performance (e.g., 4-bit Q-ViT surpassing full-precision on Swin-T).
  • Q-ViT achieves notable FLOPs reductions (e.g., up to ~21x in some configurations) with competitive or superior accuracy on ImageNet across DeiT and Swin backbones.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.