PTQ4ViT: Post-training quantization for vision transformers with twin uniform quantization
Zhihang Yuan, Chenhao Xue, Yiqi Chen, Qiang Wu, Guangyu Sun

TL;DR
This paper introduces PTQ4ViT, a post-training quantization framework for vision transformers that uses twin uniform quantization and Hessian-guided metrics to achieve near-lossless accuracy at 8-bit precision.
Contribution
The paper proposes a novel twin uniform quantization method and a Hessian-guided metric to improve post-training quantization of vision transformers, addressing previous accuracy drops.
Findings
Achieves less than 0.5% accuracy drop at 8-bit quantization on ImageNet.
Effective quantization framework with minimal calibration cost.
Addresses distribution issues of activation values in vision transformers.
Abstract
Quantization is one of the most effective methods to compress neural networks, which has achieved great success on convolutional neural networks (CNNs). Recently, vision transformers have demonstrated great potential in computer vision. However, previous post-training quantization methods performed not well on vision transformer, resulting in more than 1% accuracy drop even in 8-bit quantization. Therefore, we analyze the problems of quantization on vision transformers. We observe the distributions of activation values after softmax and GELU functions are quite different from the Gaussian distribution. We also observe that common quantization metrics, such as MSE and cosine distance, are inaccurate to determine the optimal scaling factor. In this paper, we propose the twin uniform quantization method to reduce the quantization error on these activation values. And we propose to use a…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Image and Video Retrieval Techniques · Infrared Target Detection Methodologies · Image Processing Techniques and Applications
MethodsSoftmax
