Carrying over algorithm in transformers

要約

加算はおそらく考えられる最も単純な算術タスクの 1 つであり、通常は繰り越しアルゴリズムを使用して実行されます。
このアルゴリズムは、同じ位置に数字を追加することと、必要に応じて 1 を繰り越すことという 2 つのタスクで構成されます。
私たちは、変圧器モデルがこのアルゴリズムをどのように実装するか、また前述の 2 つのタスクがネットワークの異なる部分にどのように割り当てられるかを研究します。
まず、2 層エンコーダのみのモデルに焦点を当て、キャリーオーバー アルゴリズムがモジュール形式で実装されていることを示します。
最初の層は主に、同じ位置に数字を追加する役割を果たします。
第 2 層は、最初にアテンションで、どの位置にキャリー 1 が必要かどうかを決定し、次に最終的な MLP で 1 のキャリーを実行します。
どのニューロンがそのタスクを担当しているかを正確に特定する簡単な方法を提供します。
繰り越しアルゴリズムのこの実装は、2 層モデルおよび 3 層モデルのハイパーパラメーターの範囲にわたって発生します。
小規模なデコーダのみのモデルについては、同じ実装が観察され、3 つの 7B 大きな言語モデルにその実装が存在することを示す示唆的な証拠が提供されます。

要約(オリジナル)

Addition is perhaps one of the simplest arithmetic tasks one can think of and is usually performed using the carrying over algorithm. This algorithm consists of two tasks: adding digits in the same position and carrying over a one whenever necessary. We study how transformer models implement this algorithm and how the two aforementioned tasks are allocated to different parts of the network. We first focus on two-layer encoder-only models and show that the carrying over algorithm is implemented in a modular fashion. The first layer is mostly responsible for adding digits in the same position. The second layer first decides, in the attention, which positions need a carried one or not, and then performs the carrying of the one in the final MLP. We provide a simple way of precisely identifying which neurons are responsible for that task. This implementation of the carrying over algorithm occurs across a range of hyperparameters for two as well as three-layer models. For small decoder-only models, we observe the same implementation and provide suggestive evidence for its existence in three 7B large language models.

arxiv情報

著者 Jorrit Kruthoff
発行日 2024-01-15 22:36:11+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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