Skip to main content
QUICK REVIEW

[論文レビュー] On the Expressive Power of Self-Attention Matrices

Valerii Likhosherstov, Krzysztof Choromański|arXiv (Cornell University)|Jun 7, 2021
Gene expression and cancer classification参考文献 40被引用数 5
ひとこと要約

本稿では、隠れ次元 $ d $ が系列長 $ L $ に対して対数的に増加するようにすることで、入力を僅かに変更するだけで、各列および各行に非ゼロ要素が有限個であるようなスパースなアテンション行列を、固定された自己注意機構が近似可能であることを示している。主な結果は、ランダム射影とジョンソン=リンデンストラスの補題を用いた構成的証明であり、高精度での入力依存スパースパターンの近似に $ d = O(\log L) $ が十分であることを示している。

ABSTRACT

Transformer networks are able to capture patterns in data coming from many domains (text, images, videos, proteins, etc.) with little or no change to architecture components. We perform a theoretical analysis of the core component responsible for signal propagation between elements, i.e. the self-attention matrix. In practice, this matrix typically exhibits two properties: (1) it is sparse, meaning that each token only attends to a small subset of other tokens; and (2) it changes dynamically depending on the input to the module. With these considerations in mind, we ask the following question: Can a fixed self-attention module approximate arbitrary sparse patterns depending on the input? How small is the hidden size $d$ required for such approximation? We make progress in answering this question and show that the self-attention matrix can provably approximate sparse matrices, where sparsity is in terms of a bounded number of nonzero elements in each row and column. While the parameters of self-attention are fixed, various sparse matrices can be approximated by only modifying the inputs. Our proof is based on the random projection technique and uses the seminal Johnson-Lindenstrauss lemma. Our proof is constructive, enabling us to propose an algorithm for finding adaptive inputs and fixed self-attention parameters in order to approximate a given matrix. In particular, we show that, in order to approximate any sparse matrix up to a given precision defined in terms of preserving matrix element ratios, $d$ grows only logarithmically with the sequence length $L$ (i.e. $d = O(\log L)$).

研究の動機と目的

  • トランスフォーマーにおける自己注意行列の表現力の理解を深め、特にスパarsityと動的入力依存性といった実用的制約下での挙動を明らかにすること。
  • 固定された自己注意モジュールが任意のスパースなアテンションパターンを近似するために必要な最小の隠れ次元 $ d $ を特定すること。
  • 近似精度と系列長依存性に関する理論的限界を、入力依存スパースパターンに焦点を当てて確立すること。
  • 所望のスパースなアテンション行列を実現する入力と固定された注意パラメータを求めるための構成的アルゴリズムを提供すること。

提案手法

  • 入力トークンを低次元空間に埋め込むことで、アテンションパターンを近似可能なようにするランダム射影技術を用いる。
  • ジョンソン=リンデンストラスの補題を適用し、射影下でもトークン表現間の対比較距離を保持することで、アテンション重み比の安定性を確保する。
  • 望ましいアテンションパターンから、各行および各列に有限個の非ゼロ要素を持つターゲットスパース行列 $ B $ を構築する。
  • アテンション行列を対数空間に変換することで、大きさとスパarsityを制御し、濃縮限界を可能にする。
  • すべての関連するトークンペアに対して和集合の不等式を用い、近似誤差が閾値 $ \epsilon_2 $ を超える確率をバウンドする。
  • 近似が成功する確率が $ 1 - \delta $ を超えるような $ d $ の十分条件を導出し、結果として $ d = O(\log L) $ が得られる。

実験結果

リサーチクエスチョン

  • RQ1固定された自己注意モジュールで $ d \ll L $ である場合、入力の変化によって任意のスパースなアテンション行列を近似可能か?
  • RQ2与えられた精度までに任意のスパースなアテンション行列を近似するために必要な最小の隠れ次元 $ d $ は何か?
  • RQ3入力依存スパースパターンを近似する際、必要な $ d $ は系列長 $ L $ に対してどのようにスケーリングされるか?
  • RQ4近似を構成的に行うことができ、入力およびパラメータ選択の明示的アルゴリズムが可能か?
  • RQ5ジョンソン=リンデンストラスの補題は、要素ごとの比を保持しながら、安定的かつ低次元でのアテンション行列近似を可能にするか?

主な発見

  • 固定された自己注意機構は、隠れ次元 $ d = O(\log L) $ で、任意のスパースなアテンション行列を近似可能であり、ここで $ d $ は隠れ次元、$ L $ は系列長を表す。
  • 近似は、ユーザーが定義した精度 $ \epsilon_2 $ までにアテンション重み比を保持し、確率 $ \geq 1 - \delta $ で成立する。
  • 必要な $ d $ は $ L $ に対して対数的に増加するため、線形的または多項式的スケーリングよりもはるかに効率的である。
  • 証明は構成的であり、所望のスパースなアテンション行列を実現する入力埋め込みと固定された注意パラメータを計算するアルゴリズムを可能にする。
  • この手法は、ランダム射影とジョンソン=リンデンストラス型の濃縮限界に依存しており、低次元埋め込み空間における安定性と正確性を保証する。
  • 実験的検証により、$ k=2 $ かつ $ L $ が数100程度の範囲で、$ d $ が300~1000程度で十分であることが確認され、理論的予測と整合的である。

より良い研究を、今すぐ始めましょう

論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。