Bi-ViT: Pushing the Limit of Vision Transformer Quantization

Yanjing Li, Sheng Xu, Mingbao Lin, Xianbin Cao, Chuanjian Liu +2 more
5/21/2023
cs.CV

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

Vision transformers (ViTs) quantization offers a promising prospect to facilitate deploying large pre-trained networks on resource-limited devices. Fully-binarized ViTs (Bi-ViT) that pushes the quantization of ViTs to its limit remain largely unexplored and a very challenging task yet, due to their unacceptable performance. Through extensive empirical analyses, we identify the severe drop in ViT binarization is caused by attention distortion in self-attention, which technically stems from the gradient vanishing and ranking disorder. To address these issues, we first introduce a learnable scaling factor to reactivate the vanished gradients and illustrate its effectiveness through theoretical and experimental analyses. We then propose a ranking-aware distillation method to rectify the disordered ranking in a teacher-student framework. Bi-ViT achieves significant improvements over popular DeiT and Swin backbones in terms of Top-1 accuracy and FLOPs. For example, with DeiT-Tiny and Swin-Tiny, our method significantly outperforms baselines by 22.1% and 21.4% respectively, while 61.5x and 56.1x theoretical acceleration in terms of FLOPs compared with real-valued counterparts on ImageNet.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 2 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2023bivit,
  title  = {Bi-ViT: Pushing the Limit of Vision Transformer Quantization},
  author = {Yanjing Li and Sheng Xu and Mingbao Lin and Xianbin Cao and Chuanjian Liu and Xiao Sun and Baochang Zhang},
  year   = {2023},
  eprint = {2305.12354},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.12354v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.12354.svg)](https://codeofpaper.com/paper/2305.12354)

Discussion