Post-Training Quantization for Vision Transformer

By Zhenhua Liu, Yunhe Wang, Kai Han, Siwei Ma, Wen Gao. 2021

505 citations recorded by the source corpus.

Recently, transformer has achieved remarkable performance on a variety of computer vision applications. Compared with mainstream convolutional neural networks, vision transformers are often of sophisticated architectures for extracting powerful feature representations, which are more difficult to be developed on mobile devices. In this paper, we present an effective post-training quantization algorithm for reducing the memory storage and computational costs of vision transformers. Basically, the quantization task can be regarded as finding the optimal low-bit quantization intervals for weights and inputs, respectively. To preserve the functionality of the attention mechanism, we introduce a ranking loss into the conventional quantization objective that aims to keep the relative order of the self-attention results after quantization. Moreover, we thoroughly analyze the relationship between quantization loss of different layers and the feature diversity, and explore a mixed-precision quantization scheme by exploiting the nuclear norm of each attention map and output feature. The effectiveness of the proposed method is verified on several benchmark models and datasets, which outperforms the state-of-the-art post-training quantization algorithms. For instance, we can obtain an 81.29\% top-1 accuracy using DeiT-B model on ImageNet dataset with about 8-bit quantization.

Subfields: Computer Vision and Pattern Recognition, Efficiency & Compression

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Computer Vision and Pattern Recognition

  1. Dacheng Tao
  2. Yunhe Wang
  3. Luc Van Gool
  4. Lu Yuan
  5. Kai Han
  6. Jianyuan Guo
  7. Jiashi Feng
  8. Ming-Hsuan Yang

In Efficiency & Compression

  1. Yunhe Wang
  2. Ji Lin
  3. Song Han
  4. Dan Alistarh
  5. Kai Han
  6. Dacheng Tao
  7. Chunjing Xu
  8. Zi-Mei Yao

Citations in the corpus