Skip to main content
QUICK REVIEW

[論文レビュー] Bi-ViT: Pushing the Limit of Vision Transformer Quantization

Yanjing Li, Sheng Xu|arXiv (Cornell University)|May 21, 2023
Advanced Neural Network ApplicationsComputer Science被引用数 3
ひとこと要約

Bi-ViTは、直線的推定(STE)による勾配消失とマルチヘッド自己注意機構における順序の混乱を是正することで、1ビットViT量子化における顕著な性能低下を克服する完全二値化Vision Transformerを提案する。学習可能なスケーリング係数を導入し勾配を再活性化するとともに、順序を考慮した distillation 法を採用し、DeiT-Tinyで61.5倍のFLOP削減とBi-Real Net比で22.1%高いTop-1精度を達成した。

ABSTRACT

Vision transformers (ViTs) quantization offers a promising prospect to facilitate deploying large pre-trained networks on resource-limited devices. Fully-binarized ViTs (Bi-ViT) that pushes the quantization of ViTs to its limit remain largely unexplored and a very challenging task yet, due to their unacceptable performance. Through extensive empirical analyses, we identify the severe drop in ViT binarization is caused by attention distortion in self-attention, which technically stems from the gradient vanishing and ranking disorder. To address these issues, we first introduce a learnable scaling factor to reactivate the vanished gradients and illustrate its effectiveness through theoretical and experimental analyses. We then propose a ranking-aware distillation method to rectify the disordered ranking in a teacher-student framework. Bi-ViT achieves significant improvements over popular DeiT and Swin backbones in terms of Top-1 accuracy and FLOPs. For example, with DeiT-Tiny and Swin-Tiny, our method significantly outperforms baselines by 22.1% and 21.4% respectively, while 61.5x and 56.1x theoretical acceleration in terms of FLOPs compared with real-valued counterparts on ImageNet.

研究の動機と目的

  • 完全二値化Vision Transformer(Bi-ViT)における性能低下の根本的要因を特定すること。
  • 二値化されたマルチヘッド自己注意機構における勾配消失と順序の混乱を是正すること。
  • 高い精度を維持しつつ極端なモデル圧縮を可能にする、スケーラブルで効果的な1ビットViT量子化手法を開発すること。
  • ImageNetおよびCOCOベンチマークにおいて、従来のバイナリゼーション手法に比べBi-ViTの優位性を実証すること。

提案手法

  • 直線的推定(STE)による二値化の過程で消失する勾配を再活性化するため、自己注意モジュールにヘッド単位の学習可能なスケーリング係数を導入する。
  • 教師モデルと生徒モデル間の注意マップの相対的順序を保持する順序を考慮した distillation 法を提案し、二値化によって引き起こされる順序の混乱を是正する。
  • 実数値の教師ネットワークが注意マップの順序とログイットの両方を用いて、二値化された生徒ネットワークの学習をガイドする知識蒸留フレームワークを採用する。
  • 提案されたスケーリングおよび蒸留法を用いて最適化を安定化させる1ビット重みおよび活性化を用いた量子化感知学習(QAT)を適用する。
  • 完全二値化ViTの学習中に安定性を維持するため、残差接続とレイヤーナーミャライゼーションを用いる。
  • 画像分類および物体検出タスクの両方において、DeiTおよびSwin Transformerバックボーンを用いて手法の有効性を検証する。
Figure 1: Performance of real-valued and quantized DeiT [ 32 ] with varying bit-widths. We report results with (a) DeiT-Tiny and (b) DeiT-Small on ImageNet [ 17 ] , respectively. Here 8-bit DeiT is quantized with PTQ method [ 22 ] and 2/3/4 bit DeiT is trained with QAT method [ 18 ] . The binarized
Figure 1: Performance of real-valued and quantized DeiT [ 32 ] with varying bit-widths. We report results with (a) DeiT-Tiny and (b) DeiT-Small on ImageNet [ 17 ] , respectively. Here 8-bit DeiT is quantized with PTQ method [ 22 ] and 2/3/4 bit DeiT is trained with QAT method [ 18 ] . The binarized

実験結果

リサーチクエスチョン

  • RQ1既存の1ビットViT量子化手法は、フル精度モデルと比較してなぜ顕著な性能低下を示すのか?
  • RQ2二値化されたマルチヘッド自己注意機構における注意の歪みの主な要因は何か?
  • RQ3二値化ViTにおけるバックプロパゲーション中の勾配消失を効果的に緩和する方法は何か?
  • RQ4順序を考慮した蒸留法は、相対的注意マップ順序を保持することで二値化ViTの最適化を改善できるか?
  • RQ5Bi-ViTは、標準的なビジョンベンチマークにおいて、高いモデル圧縮と高い精度の両方をどの程度達成できるか?

主な発見

  • DeiT-Tinyで1ビット量子化の下で、Bi-Real Net比で22.1%高いTop-1精度を達成し、ベースラインを著しく上回った。
  • 実数値のDeiT-Tinyと比較してFLOPsを61.5倍削減し、極めて高い計算効率を示した。
  • Swin-Tinyでは、1ビットベースライン比でTop-1精度を21.4%向上させ、理論的FLOP加速は58.3倍に達した。
  • COCOにおける物体検出タスクで、Swin-Tinyを用いて29.0%のAP@[.5,.95]を達成し、Bi-Real Netを10.9%のmAP向上で上回った。
  • 実数値の対応モデルと比較してメモリ使用量を2.3倍削減しながら、性能の48.7%(20.7% vs. 43.7% AP)を維持した。
  • DeiT-Bでは、Bi-Real Net比で20.8%高いTop-1精度を達成し、FLOPは60.2倍、モデルサイズは28.6倍に圧縮された。
Figure 2: Visualization of the attention map before softmax in the first block of DeiT-Tiny [ 32 ] on ImageNet [ 17 ] . From the left to right, is the baseline method [ 26 ] , previous binarization method [ 36 ] , our Bi-ViT and real-valued counterpart.
Figure 2: Visualization of the attention map before softmax in the first block of DeiT-Tiny [ 32 ] on ImageNet [ 17 ] . From the left to right, is the baseline method [ 26 ] , previous binarization method [ 36 ] , our Bi-ViT and real-valued counterpart.

この論文を読む

Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。

Nubintでこの論文を読む

このレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。