arXiv reaDer
Castling-ViT: ビジョン トランスフォーマーの推論中に線形-角度注意に切り替えることで自己注意を圧縮する
Castling-ViT: Compressing Self-Attention via Switching Towards Linear-Angular Attention During Vision Transformer Inference
ビジョン トランスフォーマー (ViT) は印象的なパフォーマンスを示していますが、グローバルな類似性測定と入力トークンの二次複雑さのために、畳み込みニューラル ネットワーク (CNN) と比較して依然として高い計算コストが必要です。既存の効率的な ViT は、ローカルの注意 (Swin など) または線形の注意 (Performer など) を採用しており、グローバルまたはローカルのコンテキストをキャプチャする ViT の機能を犠牲にしています。この作業では、重要な研究上の質問をします。ViTs はグローバル コンテキストとローカル コンテキストの両方を学習しながら、推論の効率を向上させることができるでしょうか?この目的のために、Castling-ViT と呼ばれるフレームワークを提案します。これは、線形角度注意とマスクされたソフトマックス ベースの二次注意の両方を使用して ViT をトレーニングしますが、ViT 推論中に線形角度注意のみを持つように切り替えます。当社の Castling-ViT は角度カーネルを活用して、スペクトル角度を介してクエリとキーの間の類似性を測定します。さらに、次の 2 つの手法を使用して単純化します。(1) 新しい線形角度アテンション メカニズム: 角度カーネルを線形項と高次残差に分解し、線形項のみを保持します。 (2) 2 つのパラメーター化されたモジュールを採用して、高次の残差を近似します。深さ方向の畳み込みと、グローバル情報とローカル情報の両方を学習するのに役立つ補助的なマスクされたソフトマックス アテンション。ソフトマックス アテンションのマスクは正規化されて徐々にゼロになるため、 ViT 推論中のオーバーヘッド。 3 つのタスクに関する広範な実験とアブレーション研究により、提案された Castling-ViT の有効性が一貫して検証されています。バニラソフトマックスベースの注意を払ってViTに。
Vision Transformers (ViTs) have shown impressive performance but still require a high computation cost as compared to convolutional neural networks (CNNs), due to the global similarity measurements and thus a quadratic complexity with the 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: Fri Nov 18 2022 22:49:04 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アソシエイト