Zubnet AI學習Wiki › Induction Head
基礎

Induction Head

在 Transformer 中發現的一個特定的兩 attention head 電路,透過模式匹配實現上下文學習。如果模型在上下文前面見過「A B」模式,現在再次看到「A」,induction head 就預測「B」會跟著來。這個簡單機制被認為是 LLM 從上下文範例學習的基本建構塊。

為什麼重要

Induction head 是機械可解釋性裡理解最好的電路 — Transformer 如何從學到的權重實現一個有用演算法的具體例子。它們解釋 few-shot prompting 為什麼有效:當你給範例,induction head 偵測模式並套用它。理解 induction head 為理解更複雜的學到行為提供基礎。

Deep Dive

The circuit uses two heads across two layers. The first head (a "previous token head" in an earlier layer) copies information about which token preceded the current one. The second head (the actual "induction head" in a later layer) uses this information to complete patterns: if token B was preceded by A earlier in the context, and A appears again, the induction head boosts the prediction of B. This is a simple but powerful form of in-context learning.

Discovery and Verification

Olsson et al. (2022, Anthropic) identified induction heads through careful analysis of attention patterns in Transformers of various sizes. They observed a phase change during training: induction heads form suddenly, and their formation coincides with a dramatic improvement in the model's ability to do in-context learning. This suggests that induction heads are not just one of many circuits but a foundational capability that enables higher-level in-context learning.

Beyond Simple Patterns

Real-world in-context learning is more complex than "A B ... A → B." Models learn to generalize patterns: "capital of France is Paris, capital of Germany is Berlin, capital of Japan is..." requires understanding the abstract pattern, not just copying. Research suggests that more complex induction-like circuits build on the basic induction head mechanism, composing it with other circuits to handle abstraction and generalization.

相關概念

← 所有術語
← Image Generation Inference →