FQ-ViT: Post-Training Quantization for Fully Quantized Vision Transformer

要約

ネットワーク量子化は、モデルの推論の複雑さを大幅に軽減し、実際の展開で広く使用されています。
ただし、ほとんどの既存の量子化方法は、主に畳み込みニューラル ネットワーク (CNN) で開発されており、完全に量子化されたビジョン トランスフォーマーに適用すると深刻な劣化を被ります。
この作業では、これらの問題の多くが LayerNorm 入力の重大なチャネル間変動のために発生することを実証し、完全量子化のパフォーマンスの低下と推論の複雑さを軽減する体系的な方法である 2 乗係数 (PTF) を提示します。
ビジョントランスフォーマー。
さらに、アテンション マップの極端に不均一な分布を観察し、Log-Int-Softmax (LIS) を提案してそれを維持し、4 ビット量子化と BitShift 演算子を使用して推論を簡素化します。
さまざまなトランスフォーマーベースのアーキテクチャとベンチマークに関する包括的な実験により、当社の完全量子化ビジョン トランスフォーマー (FQ-ViT) は、アテンション マップでより低いビット幅を使用しているにもかかわらず、以前の作品よりも優れていることが示されています。
たとえば、ImageNet の ViT-L で 84.89% のトップ 1 精度に達し、COCO のカスケード マスク R-CNN (Swin-S) で 50.8 mAP に達します。
私たちの知る限り、完全に量子化されたビジョン トランスフォーマーで損失のない精度低下 (~1%) を実現したのは、私たちが初めてです。
コードは https://github.com/megvii-research/FQ-ViT で入手できます。

要約(オリジナル)

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.

arxiv情報

著者 Yang Lin,Tianyu Zhang,Peiqin Sun,Zheng Li,Shuchang Zhou
発行日 2023-02-17 13:17:52+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CV パーマリンク