Fast Multipole Attention: A Divide-and-Conquer Attention Mechanism for Long Sequences

要約

トランスベースのモデルは、多くの分野で最先端のパフォーマンスを実現しています。
ただし、入力長に対するセルフアテンションの 2 次複雑さにより、Transformer ベースのモデルを長いシーケンスに適用することが妨げられます。
これに対処するために、分割統治戦略を使用して、$\mathcal{O}(n^2 からの長さ $n$ のシーケンスに対するアテンションの時間とメモリの複雑さを軽減する新しいアテンション メカニズムである高速多極アテンションを提案します。
)$ を $\mathcal{O}(n \log n)$ または $O(n)$ に変換しますが、グローバルな受容野は維持されます。
階層的なアプローチでは、クエリ、キー、および値を $\mathcal{O}( \log n)$ レベルの解像度にグループ化します。ここで、距離が遠いグループほどサイズが大きくなり、グループ量を計算するための重みが学習されます。
そのため、互いに遠く離れたトークン間の相互作用は、効率的な階層的な方法で低解像度で考慮されます。
高速多極アテンションの全体的な複雑さは、クエリがダウンサンプリングされるかどうかに応じて $\mathcal{O}(n)$ または $\mathcal{O}(n \log n)$ になります。
このマルチレベルの分割統治戦略は、 $n$-body 物理学と高速多極子法からの高速総和法にインスピレーションを得ています。
自己回帰および双方向言語モデリング タスクの評価を実行し、高速多極注意モデルを中規模のデータセット上の他の効率的な注意バリアントと比較します。
高速多極変圧器は、メモリ サイズと精度の点で他の効率的な変圧器よりもはるかに優れたパフォーマンスを発揮することが経験的にわかっています。
高速多極アテンション メカニズムには、トレーニング中および長いシーケンスの生成時に、効率的かつ自然な階層的な方法で完全なコンテキストを考慮に入れて、はるかに長いシーケンス長を持つ大規模な言語モデルを強化できる可能性があります。

要約(オリジナル)

Transformer-based models have achieved state-of-the-art performance in many areas. However, the quadratic complexity of self-attention with respect to the input length hinders the applicability of Transformer-based models to long sequences. To address this, we present Fast Multipole Attention, a new attention mechanism that uses a divide-and-conquer strategy to reduce the time and memory complexity of attention for sequences of length $n$ from $\mathcal{O}(n^2)$ to $\mathcal{O}(n \log n)$ or $O(n)$, while retaining a global receptive field. The hierarchical approach groups queries, keys, and values into $\mathcal{O}( \log n)$ levels of resolution, where groups at greater distances are increasingly larger in size and the weights to compute group quantities are learned. As such, the interaction between tokens far from each other is considered in lower resolution in an efficient hierarchical manner. The overall complexity of Fast Multipole Attention is $\mathcal{O}(n)$ or $\mathcal{O}(n \log n)$, depending on whether the queries are down-sampled or not. This multi-level divide-and-conquer strategy is inspired by fast summation methods from $n$-body physics and the Fast Multipole Method. We perform evaluation on autoregressive and bidirectional language modeling tasks and compare our Fast Multipole Attention model with other efficient attention variants on medium-size datasets. We find empirically that the Fast Multipole Transformer performs much better than other efficient transformers in terms of memory size and accuracy. The Fast Multipole Attention mechanism has the potential to empower large language models with much greater sequence lengths, taking the full context into account in an efficient, naturally hierarchical manner during training and when generating long sequences.

arxiv情報

著者 Yanming Kang,Giang Tran,Hans De Sterck
発行日 2024-07-30 15:02:51+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.CL, cs.LG パーマリンク