AI・機械学習
上級

Induction Heads(帰納頭)(インダクションヘッズ)

Transformerモデルに共通して存在する注意ヘッドのパターンで、[A][B]...→[A]というコンテキストを認識して[B]を予測する機能を持つ。In-context Learningの根幹メカニズムとして特定されたMechanistic Interpretabilityの重要発見。

0 回閲覧
0 いいね
2026/6/7 更新
関連タグ
Induction Heads
Circuits
In-context Learning
注意機構
Mechanistic Interpretability

Induction Heads(帰納頭)

Induction Heads(インダクション・ヘッズ、帰納頭)は、Anthropicが2022年の論文「In-context Learning and Induction Heads」で発見・命名した、Transformerモデルの注意機構に普遍的に存在する回路パターン。その発見はMechanistic Interpretabilityにおける最重要の成果の一つとされる。

Induction Headsの機能

Induction Headsは以下のパターン認識を担う:

シーケンス: ... [A] [B] ... [A] → [B] を予測
具体例:
"prefix [cat] [sat] prefix" → "sat" を予測

より正確には2種類の注意ヘッドの連携で動作する:

  1. Previous Token Head(前トークン頭): 現在のトークンが過去のどのトークンと同じかをマーク
  2. Induction Head: 同じトークンの次にきたものを予測

In-context Learningとの関係

論文の中心的な主張:In-context LearningのほとんどはInduction Headsによって実現されている。

証拠として挙げられた事実:

  1. モデルスケールの増加にともない、Induction HeadsとIn-context Learning能力が同時に急激に出現(位相遷移的な振る舞い)
  2. 2層のシンプルなTransformerでもInduction Headsが形成され、基本的なIn-context Learningが可能
  3. Induction Headsを人工的に無効化すると、In-context Learning能力が著しく低下

普遍性と転移

Induction Headsは驚くほど普遍的に存在する:

  • GPT-2(117M)から大規模なLLMまで検出可能
  • テキスト以外のモダリティ(数学・コード・バイナリデータ)でも同一の機能
  • アーキテクチャが異なるモデルでも類似の機能を持つ回路が存在

TransformerLensによる検出

import transformer_lens
import torch

model = transformer_lens.HookedTransformer.from_pretrained("gpt2")

# 繰り返しパターンを持つシーケンスを用意
repeated_tokens = torch.randint(0, model.cfg.d_vocab, (1, 10)).expand(1, -1)
repeated_seq = torch.cat([repeated_tokens, repeated_tokens], dim=-1)

logits, cache = model.run_with_cache(repeated_seq)

# 各注意ヘッドの「誘導スコア」を計算
for layer in range(model.cfg.n_layers):
    for head in range(model.cfg.n_heads):
        attn_pattern = cache[f"blocks.{layer}.attn.hook_attn_weights"][0, head]
        induction_score = attn_pattern.diagonal(-1).mean()
        if induction_score > 0.3:
            print(f"Layer {layer}, Head {head}: Induction score = {induction_score:.3f}")

Mechanistic Interpretabilityへの貢献

Induction Headsの発見は:

  • 「Circuits」アプローチの具体的な成功例を示した
  • 注意ヘッドが特定の計算タスクに特化できることを証明
  • より複雑な回路(Indirect Object Identification等)の研究への道を開いた
  • モデルの「内部言語」が解読可能であることへの信頼を高めた

ABパターンテスト

# ABパターンテスト(Induction Headsの簡易検証)
# シーケンス: A B ... A → モデルがBを高確率で予測すれば Induction Heads が機能
prompt = "hello world some filler text hello"
# → モデルが "world" を次トークン予測すれば OK

AnthropicはInduction Headsの発見を出発点として、より複雑な言語タスク(事実補完、文法処理、算術)を担う回路の同定研究を続けている。

この記事について
カテゴリーAI・機械学習
難易度上級
作成日2026/6/7