An induction head is a specific attention head circuit discovered through mechanistic interpretability that performs in-context pattern matching. It operates by using the current token to search for a previous occurrence of that same token in the sequence, then attending to the token that followed it. This mechanism allows the model to predict that the previously observed continuation will repeat, enabling in-context learning without weight updates.
Glossary
Induction Heads

What is Induction Heads?
An induction head is a specialized attention circuit in transformer models that enables in-context copying and sequence completion by attending to a token that followed a similar current token in the past.
Formally, an induction head is composed of two cooperating attention heads in successive layers. The first head acts as a previous token head, copying information about the preceding token into the current position's residual stream. The second head uses a K-composition pattern: its query vector attends to the key vector produced by the first head, effectively matching the current token against the copied previous-token information to locate and retrieve the correct continuation.
Key Characteristics of Induction Heads
Induction heads are a specific, interpretable circuit motif in transformer language models that drive in-context learning by attending to previous occurrences of the current token and copying what followed it.
The Core Algorithm: Previous Token Matching
An induction head operates via a two-step mechanism. First, a previous token head attends to the immediately preceding token and copies its embedding into the residual stream. Second, the induction head itself uses a K-composition pattern: its query vector is computed from the current token, but its key vector is computed from the previous token head's output. This causes it to attend to tokens that followed a similar prefix in the past, effectively implementing the rule: 'If I see token A now, look for the last time A appeared and predict what came after it.'
K-Composition and the QK Circuit
The defining architectural signature of an induction head is K-composition with a previous token head. The attention score is computed as softmax(Q_current ยท K_previous), where the key vector is derived from the output of an earlier attention head that attended to the prior position. This compositional structure creates a prefix-matching mechanism: the head searches for positions where the key vector (representing the token after a prefix) matches the query vector (representing the current token). This is distinct from simple copying because it generalizes across different occurrences of the same token.
In-Context Learning Engine
Induction heads are the primary circuit responsible for in-context learning in transformer models. When a model exhibits the ability to complete a pattern like A B -> A B after seeing a few examples, induction heads are performing the underlying computation. They explain why models can copy novel sequences, repeat patterns, and perform simple algorithmic tasks without weight updates. The strength of induction heads correlates directly with a model's few-shot learning capability, and their formation during training coincides with the phase change where in-context learning emerges.
Formation During Training: The Phase Change
Induction heads do not exist at initialization; they form abruptly during training in a phase change event. Research shows that models first develop bigram statistics (attending to the immediately previous token), and then suddenly restructure to form induction heads. This transition is visible in loss curves as a sharp drop and corresponds to the model transitioning from memorization to acquiring a general in-context copying algorithm. Once formed, induction heads rapidly strengthen and become the dominant mechanism for sequence completion tasks.
Relationship to Superposition and Polysemanticity
In larger models, induction heads often exhibit polysemanticity: a single head may implement multiple induction-like behaviors across different token positions or contexts. This is related to the phenomenon of superposition, where the model compresses more features than it has dimensions. Sparse autoencoders can be used to decompose an induction head's activations into distinct, monosemantic features, revealing that what appears as one head may actually be several superimposed induction circuits operating in parallel across different token types or positional offsets.
Causal Verification via Activation Patching
The functional role of induction heads is confirmed through activation patching experiments. By replacing the output of a candidate induction head with activations from a corrupted forward pass (where the prefix context is altered) and observing the resulting logit changes, researchers can causally verify that the head is responsible for copying behavior. Path patching further isolates the specific K-composition pathway, demonstrating that ablating the connection between the previous token head and the induction head's key computation destroys the copying capability while leaving other functions intact.
Induction Heads vs. Related Mechanisms
A comparative analysis of induction heads against other attention mechanisms and circuits involved in in-context learning and sequence completion.
| Feature | Induction Head | Previous Token Head | Function Vector |
|---|---|---|---|
Primary Function | In-context copying and sequence completion via pattern matching | Attends to the immediately preceding token for local syntax | Encodes a specific input-output task behavior from demonstrations |
Attention Pattern | Attends to the token following a similar current token in the past | Attends strictly to the previous token position | Not an attention head; a compact activation representation |
Composition Mechanism | K-composition with a previous token head | Standalone attention without compositional chaining | Injected directly into residual stream activations |
Causal Role in ICL | Core circuit enabling few-shot pattern replication | Provides raw positional context, not pattern induction | Triggers task behavior without requiring exemplars in context |
Layer Location | Typically emerges in middle-to-late transformer layers | Common in early layers for local context aggregation | Derived from activation differences, not a fixed layer component |
Discovery Method | Mechanistic analysis of attention patterns and causal tracing | Standard attention weight visualization | Activation engineering and causal intervention |
Requires Prior Token Match | |||
Generalizes to Novel Patterns |
Frequently Asked Questions
Clear, technical answers to the most common questions about the in-context learning circuit that powers sequence completion in transformer models.
An induction head is a specific attention head circuit in a transformer model that implements a simple in-context copying algorithm. It operates by attending to the token that immediately followed a previous occurrence of the current token. Mechanistically, the head uses a previous token head in an earlier layer to copy information about the preceding token into the current position's residual stream. The induction head then composes its attention pattern by looking for that same preceding token in the sequence history. When found, it attends to the token that came after it, effectively predicting that the sequence [A][B]... [A] should be completed with [B]. This circuit is the primary mechanism enabling in-context learning for sequence completion tasks, allowing models to recognize and continue patterns without weight updates.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Induction heads are a specific circuit within the broader field of mechanistic interpretability. The following concepts are essential for understanding how these circuits are discovered, validated, and related to other model behaviors.
Circuits
The fundamental unit of mechanistic analysis. A circuit is a sparse, interpretable subgraph of a neural networkโconsisting of connected attention heads and MLP neuronsโthat implements a specific, human-understandable algorithm.
- Induction heads form a core circuit for in-context learning
- Circuits are discovered through causal interventions, not just correlation
- The goal is to decompose the full model into a collection of composable circuits
Activation Patching
A causal intervention technique used to isolate the function of a specific model component. To test if a head is an induction head, researchers replace its activation at a specific layer and position with a value from a corrupted forward pass and measure the change in loss.
- Clean vs. corrupted runs: Compare model behavior with and without the patched activation
- Used to prove that induction heads are causally necessary for in-context copying
- Localizes function to specific attention heads rather than entire layers
K-Composition
The specific attention pattern that defines induction heads. In K-composition, the key vectors computed by an earlier attention head are read by the query vectors of a later head in a subsequent token position.
- The previous token head writes into the key subspace
- The induction head reads from that subspace via its query
- This creates a chain: 'Token B' attends to 'Token A' because a previous occurrence of 'A' was followed by 'B'
Superposition
A hypothesized phenomenon where a neural network represents more independent features than it has dimensions in a given layer. Induction heads rely on the model's ability to compress token identity and positional context into overlapping representations.
- The residual stream carries both the 'current token' and 'previous token' signals
- Induction heads must disentangle these superimposed features
- Sparse autoencoders are used to decompose these polysemantic representations into monosemantic features
Direct Logit Attribution
A linear decomposition technique that attributes the final logit output for a token directly to the individual contributions of each attention head and MLP layer. This method provides a mathematical proof of an induction head's effect.
- Decomposes the residual stream into additive paths
- Shows how the induction head's output directly increases the logit of the correct next token
- Validates that the circuit's function matches the hypothesized algorithm
Transformer Mechanistic Analysis
The broader research program that induction heads emerged from. This field seeks to reverse-engineer the specific functional roles of every attention head and MLP layer in transformer architectures.
- Induction heads were discovered in 2022 by Olsson et al. while analyzing in-context learning
- Found to be a universal emergent circuit in models of sufficient size
- Related to function vectors and task vectors that encode specific behaviors

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us