arXiv reaDer
Castling-ViT: ビジョントランスフォーマー推論時の線形角度注意への切り替えによる自己注意の圧縮
Castling-ViT: Compressing Self-Attention via Switching Towards Linear-Angular Attention at Vision Transformer Inference
ビジョン トランスフォーマー (ViT) は優れたパフォーマンスを示していますが、畳み込みニューラル ネットワーク (CNN) と比較すると依然として高い計算コストを必要とします。その理由の 1 つは、ViT の注意力がグローバルな類似性を測定するため、入力トークンの数に対して 2 次の複雑さになるためです。既存の効率的な ViT は、ローカル アテンション (例: Swin) またはリニア アテンション (例: Performer) を採用していますが、これにより、グローバルまたはローカル コンテキストをキャプチャする ViT の機能が犠牲になります。この研究では、ViT は推論中により効率的にしながら、グローバルとローカルの両方のコンテキストを学習できるか?という重要な研究上の質問をします。この目的のために、我々は Castling-ViT と呼ばれるフレームワークを提案します。このフレームワークは、線形角度アテンションとマスクされたソフトマックス ベースの二次アテンションの両方を使用して ViT をトレーニングしますが、ViT 推論中に線形角度アテンションのみを使用するように切り替えます。当社の Castling-ViT は、角度カーネルを利用して、スペクトル角度を介してクエリとキー間の類似性を測定します。そして、それを 2 つの手法でさらに簡素化します。(1) 新しい線形角度注意メカニズム: 角度カーネルを線形項と高次残差に分解し、線形項のみを保持します。 (2) 高次の残差を近似するために 2 つのパラメータ化モジュールを採用します。深さ方向の畳み込みと、グローバル情報とローカル情報の両方を学習するのに役立つ補助的なマスクされたソフトマックス アテンションです。ソフトマックス アテンションのマスクは、徐々にゼロになるように正規化されているため、影響はありません。 ViT 推論時のオーバーヘッド。 3 つのタスクに関する広範な実験とアブレーション研究により、提案された Castling-ViT の有効性が一貫して検証されています。たとえば、比較した場合、同等の FLOP の下で ImageNet 分類で最大 1.8% 高い精度または 40% の MAC 削減、および COCO 検出で 1.2 高い mAP を達成しています。バニラのソフトマックスベースの注意を備えた ViT に。
Vision Transformers (ViTs) have shown impressive performance but still require a high computation cost as compared to convolutional neural networks (CNNs), one reason is that ViTs' attention measures global similarities and thus has a quadratic complexity with the number of input tokens. Existing efficient ViTs adopt local attention (e.g., Swin) or linear attention (e.g., Performer), which sacrifice ViTs' capabilities of capturing either global or local context. In this work, we ask an important research question: Can ViTs learn both global and local context while being more efficient during inference? To this end, we propose a framework called Castling-ViT, which trains ViTs using both linear-angular attention and masked softmax-based quadratic attention, but then switches to having only linear angular attention during ViT inference. Our Castling-ViT leverages angular kernels to measure the similarities between queries and keys via spectral angles. And we further simplify it with two techniques: (1) a novel linear-angular attention mechanism: we decompose the angular kernels into linear terms and high-order residuals, and only keep the linear terms; and (2) we adopt two parameterized modules to approximate high-order residuals: a depthwise convolution and an auxiliary masked softmax attention to help learn both global and local information, where the masks for softmax attention are regularized to gradually become zeros and thus incur no overhead during ViT inference. Extensive experiments and ablation studies on three tasks consistently validate the effectiveness of the proposed Castling-ViT, e.g., achieving up to a 1.8% higher accuracy or 40% MACs reduction on ImageNet classification and 1.2 higher mAP on COCO detection under comparable FLOPs, as compared to ViTs with vanilla softmax-based attentions.
updated: Mon Jun 12 2023 16:11:55 GMT+0000 (UTC)
published: Fri Nov 18 2022 22:49:04 GMT+0000 (UTC)
参考文献 (このサイトで利用可能なもの) / References (only if available on this site)
被参照文献 (このサイトで利用可能なものを新しい順に) / Citations (only if available on this site, in order of most recent)
Amazon.co.jpアソシエイト