Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer

要約

Transformer アーキテクチャは、複数の研究ドメインで目覚ましいパフォーマンスを示し、多くのニューラル ネットワーク モデルのバックボーンとなっています。
ただし、それがどのように機能するかについては理解が限られています。
特に、単純な予測損失の場合、勾配 \emph{トレーニング ダイナミクス} からどのように表現が現れるのかは謎のままです。
この論文では、1 つのセルフ アテンション層と 1 つのデコーダ層を備えた 1 層トランスフォーマーについて、数学的に厳密な方法で次のトークン予測タスクの SGD トレーニング ダイナミクスを分析します。
私たちは、自己注意層が入力トークンをどのように組み合わせるかという動的プロセスのブラック ボックスを開き、根底にある誘導バイアスの性質を明らかにします。
より具体的には、(a) 位置エンコーディングなし、(b) 長い入力シーケンス、(c) デコーダ層の学習速度がセルフ アテンション層よりも速いという前提で、セルフ アテンションが \emph{識別スキャンとして機能することを証明します。
アルゴリズム}: 均一な注目から始めて、予測される特定の次のトークンの個別のキー トークンに徐々に注目し、異なる次のトークン間で発生する共通のキー トークンにはあまり注目しなくなります。
個別のトークンの間では、トレーニング セット内のキーとクエリ トークンの間の共起の低いものから高いものへの順序に従って、注意の重みが徐々に低下します。
興味深いことに、この手順は勝者総取りには至りませんが、2 つの層の学習率によって制御可能な \emph{位相遷移} によって減速し、(ほぼ)固定されたトークンの組み合わせが残ります。
この \textbf{\emph{スキャンとスナップ}} のダイナミクスを合成データと現実世界のデータ (WikiText) で検証します。

要約(オリジナル)

Transformer architecture has shown impressive performance in multiple research domains and has become the backbone of many neural network models. However, there is limited understanding on how it works. In particular, with a simple predictive loss, how the representation emerges from the gradient \emph{training dynamics} remains a mystery. In this paper, for 1-layer transformer with one self-attention layer plus one decoder layer, we analyze its SGD training dynamics for the task of next token prediction in a mathematically rigorous manner. We open the black box of the dynamic process of how the self-attention layer combines input tokens, and reveal the nature of underlying inductive bias. More specifically, with the assumption (a) no positional encoding, (b) long input sequence, and (c) the decoder layer learns faster than the self-attention layer, we prove that self-attention acts as a \emph{discriminative scanning algorithm}: starting from uniform attention, it gradually attends more to distinct key tokens for a specific next token to be predicted, and pays less attention to common key tokens that occur across different next tokens. Among distinct tokens, it progressively drops attention weights, following the order of low to high co-occurrence between the key and the query token in the training set. Interestingly, this procedure does not lead to winner-takes-all, but decelerates due to a \emph{phase transition} that is controllable by the learning rates of the two layers, leaving (almost) fixed token combination. We verify this \textbf{\emph{scan and snap}} dynamics on synthetic and real-world data (WikiText).

arxiv情報

著者 Yuandong Tian,Yiping Wang,Beidi Chen,Simon Du
発行日 2023-07-03 03:17:39+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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