Towards Understanding the Word Sensitivity of Attention Layers: A Study via Random Features

要約

トランスフォーマーの並外れた成功の背後にある理由を理解するには、なぜアテンション レイヤーが NLP タスクに適しているのかをより良く分析する必要があります。
特に、このようなタスクでは、たとえ文が長い場合でも、多くの場合 1 つまたは少数の単語に依存する文脈上の意味を捉えるための予測モデルが必要です。
私たちの研究では、単語感度 (WS) と呼ばれるこの重要な特性を、ランダム特徴のプロトタイプ設定で研究しています。
私たちは、注意層が高い WS を享受していること、つまり、ランダムな注意特徴マップを大きく乱すベクトルが埋め込み空間に存在することを示します。
この議論は、アテンション層におけるソフトマックスの役割を批判的に利用しており、他のアクティベーション (ReLU など) と比較したその利点を強調しています。
対照的に、標準的なランダム特徴の WS は $1/\sqrt{n}$ のオーダーであり、$n$ はテキスト サンプル内の単語の数であるため、コンテキストの長さとともに減衰します。
次に、単語感度に関するこれらの結果を一般化限界に変換します。ランダムな特徴は、WS が低いため、単一の単語だけが異なる 2 つの文を区別することを学習できない可能性があります。
対照的に、ランダム アテンション特徴量は WS が高いため、汎化能力が高くなります。
imdb レビュー データセットの BERT ベースの単語埋め込みに対する実験的証拠を使用して理論的結果を検証します。

要約(オリジナル)

Understanding the reasons behind the exceptional success of transformers requires a better analysis of why attention layers are suitable for NLP tasks. In particular, such tasks require predictive models to capture contextual meaning which often depends on one or few words, even if the sentence is long. Our work studies this key property, dubbed word sensitivity (WS), in the prototypical setting of random features. We show that attention layers enjoy high WS, namely, there exists a vector in the space of embeddings that largely perturbs the random attention features map. The argument critically exploits the role of the softmax in the attention layer, highlighting its benefit compared to other activations (e.g., ReLU). In contrast, the WS of standard random features is of order $1/\sqrt{n}$, $n$ being the number of words in the textual sample, and thus it decays with the length of the context. We then translate these results on the word sensitivity into generalization bounds: due to their low WS, random features provably cannot learn to distinguish between two sentences that differ only in a single word; in contrast, due to their high WS, random attention features have higher generalization capabilities. We validate our theoretical results with experimental evidence over the BERT-Base word embeddings of the imdb review dataset.

arxiv情報

著者 Simone Bombari,Marco Mondelli
発行日 2024-05-17 15:31:34+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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