TaylorShift: Shifting the Complexity of Self-Attention from Squared to Linear (and Back) using Taylor-Softmax

要約

アテンション メカニズムの 2 次の複雑さは、Transformer を使用して長いシーケンスを処理する際の最大のハードルの 1 つです。
スパース表現またはステートフルな再帰に依存する現在の方法では、トークン間の相互作用が犠牲になり、最終的にパフォーマンスの低下につながります。
この論文では、線形時間と空間における完全なトークン間の相互作用の計算を可能にする Taylor ソフトマックスの新しい再定式化である TaylorShift を紹介します。
私たちは、テイラーシフトの採用が従来の注意よりも効率的になるクロスオーバー ポイントを分析的に決定し、経験的測定と厳密に一致させます。
具体的には、私たちの調査結果は、TaylorShift が 800 トークンという短いシーケンスのメモリ効率を向上させ、約 1700 トークン以上の入力の推論を加速することを示しています。
短いシーケンスの場合、TaylorShift はバニラ アテンションと同等にスケールします。
さらに、長いシーケンスを含む 5 つのタスクにわたる分類ベンチマークでは、TaylorShift を備えたトランスフォーマーを使用しても精度が低下しないことが明らかになりました。
再現性を高めるために、https://github.com/tobna/TaylorShift でコードへのアクセスを提供します。

要約(オリジナル)

The quadratic complexity of the attention mechanism represents one of the biggest hurdles for processing long sequences using Transformers. Current methods, relying on sparse representations or stateful recurrence, sacrifice token-to-token interactions, which ultimately leads to compromises in performance. This paper introduces TaylorShift, a novel reformulation of the Taylor softmax that enables computing full token-to-token interactions in linear time and space. We analytically determine the crossover points where employing TaylorShift becomes more efficient than traditional attention, aligning closely with empirical measurements. Specifically, our findings demonstrate that TaylorShift enhances memory efficiency for sequences as short as 800 tokens and accelerates inference for inputs of approximately 1700 tokens and beyond. For shorter sequences, TaylorShift scales comparably with the vanilla attention. Furthermore, a classification benchmark across five tasks involving long sequences reveals no degradation in accuracy when employing Transformers equipped with TaylorShift. For reproducibility, we provide access to our code under https://github.com/tobna/TaylorShift.

arxiv情報

著者 Tobias Christian Nauen,Sebastian Palacio,Andreas Dengel
発行日 2024-07-17 14:32:01+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: 68T07, cs.AI, cs.LG, I.2.10 パーマリンク