Patch-wise Mixed-Precision Quantization of Vision Transformer

Junrui Xiao, Zhikai Li, Lianwei Yang, Qingyi Gu
5/11/2023
cs.CV

No confident code implementation found for this paper. 1 possible match can be shown below.

Abstract

As emerging hardware begins to support mixed bit-width arithmetic computation, mixed-precision quantization is widely used to reduce the complexity of neural networks. However, Vision Transformers (ViTs) require complex self-attention computation to guarantee the learning of powerful feature representations, which makes mixed-precision quantization of ViTs still challenging. In this paper, we propose a novel patch-wise mixed-precision quantization (PMQ) for efficient inference of ViTs. Specifically, we design a lightweight global metric, which is faster than existing methods, to measure the sensitivity of each component in ViTs to quantization errors. Moreover, we also introduce a pareto frontier approach to automatically allocate the optimal bit-precision according to the sensitivity. To further reduce the computational complexity of self-attention in inference stage, we propose a patch-wise module to reallocate bit-width of patches in each layer. Extensive experiments on the ImageNet dataset shows that our method greatly reduces the search cost and facilitates the application of mixed-precision quantization to ViTs.

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. 1 weaker match is 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{xiao2023patchwise,
  title  = {Patch-wise Mixed-Precision Quantization of Vision Transformer},
  author = {Junrui Xiao and Zhikai Li and Lianwei Yang and Qingyi Gu},
  year   = {2023},
  eprint = {2305.06559},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.06559v1}
}

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.06559.svg)](https://codeofpaper.com/paper/2305.06559)

Discussion