論文の概要: Faster Neighborhood Attention: Reducing the O(n^2) Cost of Self
Attention at the Threadblock Level
- arxiv url: http://arxiv.org/abs/2403.04690v1
- Date: Thu, 7 Mar 2024 17:35:58 GMT
- ステータス: 処理完了
- システム内更新日: 2024-03-08 13:14:19.161672
- Title: Faster Neighborhood Attention: Reducing the O(n^2) Cost of Self
Attention at the Threadblock Level
- Title(参考訳): 近傍注意の高速化:スレッドブロックレベルでの自己注意のo(n^2)コスト削減
- Authors: Ali Hassani, Wen-Mei Hwu, Humphrey Shi
- Abstract要約: 近隣の注意は、それぞれのトークンの注意を隣人に限定することで、自己注意のコストを減少させる。
そこで本研究では,従来のGEMM問題と同様に,近隣の注意をバッチ化したGEMM問題として表現し,その実装を1次元,2次元の近所の注意のために行なえることを示す。
我々はまた、異なる空間軸にまたがる注意を細かく制御できる、融合したドット積アテンションカーネルの適応として、融合した近傍アテンションも展開する。
- 参考スコア(独自算出の注目度): 34.48259891221088
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: Neighborhood attention reduces the cost of self attention by restricting each
token's attention span to its nearest neighbors. This restriction,
parameterized by a window size and dilation factor, draws a spectrum of
possible attention patterns between linear projection and self attention.
Neighborhood attention, and more generally sliding window attention patterns,
have long been bounded by infrastructure, particularly in higher-rank spaces
(2-D and 3-D), calling for the development of custom kernels, which have been
limited in either functionality, or performance, if not both. In this work, we
first show that neighborhood attention can be represented as a batched GEMM
problem, similar to standard attention, and implement it for 1-D and 2-D
neighborhood attention. These kernels on average provide 895% and 272%
improvement in full precision latency compared to existing naive kernels for
1-D and 2-D neighborhood attention respectively. We find certain inherent
inefficiencies in all unfused neighborhood attention kernels that bound their
performance and lower-precision scalability. We also developed fused
neighborhood attention; an adaptation of fused dot-product attention kernels
that allow fine-grained control over attention across different spatial axes.
Known for reducing the quadratic time complexity of self attention to a linear
complexity, neighborhood attention can now enjoy a reduced and constant memory
footprint, and record-breaking half precision latency. We observe that our
fused kernels successfully circumvent some of the unavoidable inefficiencies in
unfused implementations. While our unfused GEMM-based kernels only improve half
precision performance compared to naive kernels by an average of 496% and 113%
in 1-D and 2-D problems respectively, our fused kernels improve naive kernels
by an average of 1607% and 581% in 1-D and 2-D problems respectively.
- Abstract(参考訳): 近隣の注意は、それぞれのトークンの注意を隣人に限定することで、自己注意のコストを削減する。
この制限は、ウィンドウサイズと拡張係数によってパラメータ化され、線形投影と自己注意の間の潜在的な注意パターンのスペクトルを引き出す。
近隣の注意と、より一般的なスライディングウィンドウの注意パターンは、特に上位の空間(2-dと3-d)において、インフラストラクチャによって境界化されてきた。
本研究は,まず,従来のGEMM問題と同様のバッチ化問題として近所の注意を表現できることを示し,その実装を1次元,2次元の近所の注意のために行う。
これらのカーネルは、従来の1次元および2次元の近傍注意のためのナイーブカーネルと比較して、平均で895%と272%の精度向上をもたらす。
我々は、その性能と低精度スケーラビリティを束縛する、未利用の周辺注目カーネルに固有の非効率性を見出した。
また,異なる空間軸にまたがる注意の細かな制御を可能にする,融合したドット製品アテンションカーネルを適応させた,融合した近傍アテンションを開発した。
自己注意の二次的な時間の複雑さを線形な複雑さに減らすことで知られ、近隣の注意はメモリフットプリントを減少させ、記録的な半精度のレイテンシを享受できる。
我々の融合カーネルは、未利用実装における避けられない非効率を回避できた。
GEMMをベースとしたカーネルは, 平均496%, 平均113%の1-D問題に対して, 半精度しか改善していないが, 融合カーネルは平均1607%, 平均581%の1-D問題において, それぞれ改善している。
関連論文リスト
- S2-Attention: Hardware-Aware Context Sharding Among Attention Heads [49.1454481007861]
スパースアテンションは、コンテキスト内のトークンのサブセットに選択的に出席する。
スパース・アテンションが今日の大規模言語モデルでモデルの品質を維持することができるかどうかは不明だ。
本稿では,Sparsely-Sharded(S2) attention, a Triton library that provide kernel optimization for sparse attention for sparse attention to customizable per-head and per-context-range levels。
論文 参考訳(メタデータ) (2024-07-25T00:27:07Z) - Short-Long Convolutions Help Hardware-Efficient Linear Attention to Focus on Long Sequences [60.489682735061415]
本稿では,状態空間モデルを短時間の畳み込みに置き換えたCHELAを提案する。
提案手法の有効性を示すために,Long Range Arenaベンチマークと言語モデリングタスクについて実験を行った。
論文 参考訳(メタデータ) (2024-06-12T12:12:38Z) - Lightning Attention-2: A Free Lunch for Handling Unlimited Sequence
Lengths in Large Language Models [20.78813311569383]
本稿では、線形アテンションによる理論計算の利点を実現するための最初の線形アテンション実装であるLightning Attentionを紹介する。
具体的には、従来のアテンション機構をブロック内に適用し、インターブロックに対して線形アテンションカーネルのトリックを適用する。
異なるモデルサイズとシーケンス長について様々な実験を行った。
論文 参考訳(メタデータ) (2024-01-09T16:27:28Z) - RFAConv: Innovating Spatial Attention and Standard Convolutional Operation [7.2646541547165056]
RFA(Receptive-Field Attention)と呼ばれる新しい注意機構を提案する。
RFAは受容場空間的特徴に重点を置いているが、大規模な畳み込みカーネルに対して効果的な注意重みを与える。
計算コストとパラメータのほとんど無視可能な増加を提供すると同時に、ネットワーク性能も大幅に向上する。
論文 参考訳(メタデータ) (2023-04-06T16:21:56Z) - UNETR++: Delving into Efficient and Accurate 3D Medical Image Segmentation [93.88170217725805]
本稿では,高画質なセグメンテーションマスクと,パラメータ,計算コスト,推論速度の両面での効率性を提供するUNETR++という3次元医用画像セグメンテーション手法を提案する。
我々の設計の核となるのは、空間的およびチャネル的な識別的特徴を効率的に学習する、新しい効率的な対注意ブロック(EPA)の導入である。
Synapse, BTCV, ACDC, BRaTs, Decathlon-Lungの5つのベンチマークで評価した結果, 効率と精度の両面で, コントリビューションの有効性が示された。
論文 参考訳(メタデータ) (2022-12-08T18:59:57Z) - Rethinking Query-Key Pairwise Interactions in Vision Transformers [5.141895475956681]
本稿では,問合せキーの対の相互作用を排除し,注意重みを求めるために計算効率の高い相性ゲートを用いるキーオンリーの注意を提案する。
我々は、ImageNet分類ベンチマークのパラメータ限定設定において、最先端の精度に達する新しい自己注意モデルファミリーLinGlosを開発した。
論文 参考訳(メタデータ) (2022-07-01T03:36:49Z) - Towards Joint Intent Detection and Slot Filling via Higher-order
Attention [47.78365472691051]
Intent Detection (ID) と Slot fill (SF) は、音声言語理解(SLU)における2つの主要なタスクである。
本稿では,文脈的およびチャネル的両線的アテンション分布を利用したバイリニアアテンションブロックを提案する。
我々のアプローチは最先端のアプローチと比較して改善をもたらすことを示す。
論文 参考訳(メタデータ) (2021-09-18T09:50:23Z) - Unlocking Pixels for Reinforcement Learning via Implicit Attention [61.666538764049854]
我々は最近,トランスフォーマーに非常に有効であることが示されている,新しい効率的なアテンションアルゴリズムを利用している。
これにより、注意に基づくコントローラは、より大きな視覚入力にスケールでき、より小さなパッチの使用が容易になります。
さらに,ソフトマックスの注目度をハイブリッドランダム特徴量で近似するアルゴリズムを提案する。
論文 参考訳(メタデータ) (2021-02-08T17:00:26Z) - AttentionNAS: Spatiotemporal Attention Cell Search for Video
Classification [86.64702967379709]
本稿では,時間的注意のための新しい検索空間を提案する。これにより,検索アルゴリズムはセルの様々な設計選択を柔軟に探索することができる。
検出されたアテンションセルは既存のバックボーンネットワーク(例えばI3DやS3D)にシームレスに挿入することができ、Kinetics-600とMiTのデータセットでビデオの精度を2%以上改善することができる。
論文 参考訳(メタデータ) (2020-07-23T14:30:05Z)
関連論文リストは本サイト内にある論文のタイトル・アブストラクトから自動的に作成しています。
指定された論文の情報です。
本サイトの運営者は本サイト(すべての情報・翻訳含む)の品質を保証せず、本サイト(すべての情報・翻訳含む)を使用して発生したあらゆる結果について一切の責任を負いません。