FQ-ViT: Post-Training Quantization for Fully Quantized Vision Transformer
Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence. Main Track. Pages 1173-1179.
https://doi.org/10.24963/ijcai.2022/164
Keywords
- Computer Vision: Applications
- Computer Vision: Machine Learning for Vision
Abstract
Network quantization significantly reduces model inference complexity and has been widely used in real-world deployments. However, most existing quantization methods have been developed mainly on Convolutional Neural Networks (CNNs), and suffer severe degradation when applied to fully quantized vision transformers. In this work, we demonstrate that many of these difficulties arise because of serious inter-channel variation in LayerNorm inputs, and present, Power-of-Two Factor (PTF), a systematic method to reduce the performance degradation and inference complexity of fully quantized vision transformers. In addition, observing an extreme non-uniform distribution in attention maps, we propose Log-Int-Softmax (LIS) to sustain that and simplify inference by using 4-bit quantization and the BitShift operator. Comprehensive experiments on various transformer-based architectures and benchmarks show that our Fully Quantized Vision Transformer (FQ-ViT) outperforms previous works while even using lower bit-width on attention maps. For instance, we reach 84.89% top-1 accuracy with ViT-L on ImageNet and 50.8 mAP with Cascade Mask R-CNN (Swin-S) on COCO. To our knowledge, we are the first to achieve lossless accuracy degradation (~1%) on fully quantized vision transformers. The code is available at https://github.com/megvii-research/FQ-ViT.
@inproceedings{ijcai2022p164,
title = {FQ-ViT: Post-Training Quantization for Fully Quantized Vision Transformer},
author = {Lin, Yang and Zhang, Tianyu and Sun, Peiqin and Li, Zheng and Zhou, Shuchang},
booktitle = {Proceedings of the Thirty-First International Joint Conference on
Artificial Intelligence, {IJCAI-22}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {Luc De Raedt},
pages = {1173--1179},
year = {2022},
month = {7},
note = {Main Track},
doi = {10.24963/ijcai.2022/164},
url = {https://doi.org/10.24963/ijcai.2022/164},
}
TY - CPAPER TI - FQ-ViT: Post-Training Quantization for Fully Quantized Vision Transformer AU - Lin, Yang AU - Zhang, Tianyu AU - Sun, Peiqin AU - Li, Zheng AU - Zhou, Shuchang T2 - Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence, IJCAI-22 PB - International Joint Conferences on Artificial Intelligence Organization PY - 2022 SP - 1173 EP - 1179 DO - 10.24963/ijcai.2022/164 UR - https://doi.org/10.24963/ijcai.2022/164 ER -Copied
Machine-readable versions of this paper, for tools and AI agents: