NoisyQuant: Noisy Bias-Enhanced Post-Training Activation Quantization for Vision Transformers

Yijiang Liu, Huanrui Yang, Zhen Dong, Kurt Keutzer, Li Du +1 more
11/29/2022
cs.CV
transformer-attentionquantization-pruning

Official code: kriskrisliu/NoisyQuant (28 stars, Python, MIT, last commit 2024-03-13).

Abstract

The complicated architecture and high training cost of vision transformers urge the exploration of post-training quantization. However, the heavy-tailed distribution of vision transformer activations hinders the effectiveness of previous post-training quantization methods, even with advanced quantizer designs.

Show full abstract

Instead of tuning the quantizer to better fit the complicated activation distribution, this paper proposes NoisyQuant, a quantizer-agnostic enhancement for the post-training activation quantization performance of vision transformers. We make a surprising theoretical discovery that for a given quantizer, adding a fixed Uniform noisy bias to the values being quantized can significantly reduce the quantization error under provable conditions. Building on the theoretical insight, NoisyQuant achieves the first success on actively altering the heavy-tailed activation distribution with additive noisy bias to fit a given quantizer. Extensive experiments show NoisyQuant largely improves the post-training quantization performance of vision transformer with minimal computation overhead. For instance, on linear uniform 6-bit activation quantization, NoisyQuant improves SOTA top-1 accuracy on ImageNet by up to 1.7%, 1.1% and 0.5% for ViT, DeiT, and Swin Transformer respectively, achieving on-par or even higher performance than previous nonlinear, mixed-precision quantization.

View on arXivView PDF

Code Implementations(1)

MIT

An official implement of CVPR 2023 paper - NoisyQuant: Noisy Bias-Enhanced Post-Training Activation Quantization for Vision Transformers

280Python, ShellMay 25, 20232 years agoMIT

Similar Papers

Cite this paper

@article{liu2022noisyquant,
  title  = {NoisyQuant: Noisy Bias-Enhanced Post-Training Activation Quantization for Vision Transformers},
  author = {Yijiang Liu and Huanrui Yang and Zhen Dong and Kurt Keutzer and Li Du and Shanghang Zhang},
  year   = {2022},
  eprint = {2211.16056},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2211.16056}
}

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

Discussion