An induction head is a specific type of attention head discovered through mechanistic interpretability that implements a simple algorithm: given a current token, it searches the context for previous occurrences of that token and attends to the token that followed it. This mechanism allows the model to perform in-context copying and pattern completion, such as predicting B after seeing the sequence A, B, ... A. The head operates by composing two key operations: a previous token head that attends to the preceding token, and a K-composition step where the key vector is formed using the output of an earlier attention layer, enabling the head to match current queries against past contexts.
Glossary
Induction Head

What is an Induction Head?
An induction head is a specialized attention head in transformer models that performs in-context copying by attending to the token immediately following a previous occurrence of the current token, enabling pattern completion.
Formally, an induction head's behavior is characterized by its QK circuit attending to the token immediately after a prior instance of the current token, and its OV circuit copying the value of that attended token to the output. This two-step mechanism—matching the current token to a prior occurrence via the key, then retrieving the subsequent token via the value—is a fundamental building block of in-context learning. Induction heads are primarily found in intermediate transformer layers and are considered a key circuit responsible for the emergent ability of large language models to recognize and extend patterns without weight updates.
Core Characteristics of Induction Heads
The defining computational signature and functional properties of induction heads, the primary mechanism enabling in-context learning and sequence copying in transformer models.
The Prefix-Matching Algorithm
An induction head implements a two-step attention algorithm. In the first layer, a previous token head copies information about the immediately preceding token into the current position. In the second layer, the induction head uses the current token as a query to attend to positions where that same token appeared before, specifically focusing on the token that followed it. This allows the model to predict B when it sees A after observing the pattern AB earlier in the sequence.
- Step 1: A previous token head attends to the immediately preceding position
- Step 2: The induction head attends to the token following a previous occurrence of the current token
- Result: The model copies the continuation of a previously observed pattern
QK and OV Circuit Composition
The induction head's behavior emerges from the precise interaction of its QK circuit (attention pattern) and OV circuit (information transfer). The QK circuit performs prefix matching: the query vector at the current position searches for keys at previous positions that are similar to the current token's embedding. The OV circuit then copies the value vector from the token immediately following the matched position, effectively retrieving the continuation of the pattern.
- QK Circuit: Implements a match between the current token and previous occurrences
- OV Circuit: Copies the token that followed the matched occurrence
- K-Composition: The key is often composed from a previous attention head's output in an earlier layer
In-Context Learning Engine
Induction heads are the primary computational primitive behind in-context learning. When a model is presented with a few-shot prompt containing input-output pairs, induction heads detect the repeating pattern and generalize it to the final query. They do not update model weights; instead, they dynamically route information through the residual stream to copy the appropriate output format or answer structure from the demonstration examples.
- Enable zero-shot pattern completion without weight updates
- Form the basis of function vectors that can be extracted and injected
- Critical for tasks like few-shot translation, classification, and code completion
Layer-Specific Formation Dynamics
Induction heads do not exist in randomly initialized models. They form abruptly during training in a phase change, typically emerging after the model has learned bigram statistics. In a two-layer attention-only transformer, the first layer develops previous token heads that pass positional information forward. The second layer then composes its key from this information, creating the induction mechanism. In larger models, induction heads cluster in specific layers, often in the middle-to-late stages of the network.
- Formation is a discontinuous phase transition during training
- Requires prior development of previous token heads in earlier layers
- Emergence correlates with a sharp drop in loss on sequence copying tasks
Attention Pattern Signature
An induction head exhibits a distinctive attention pattern that serves as its diagnostic fingerprint. When processing a sequence with repeated tokens, the attention map shows a characteristic off-by-one diagonal: the head attends to the position immediately following the previous occurrence of the current token. For a sequence like A B ... A, the head at the second A will attend strongly to the position of B that followed the first A.
- Attention focuses on token index = previous_match_index + 1
- Pattern is visible in attention heatmaps as a shifted diagonal
- Strength increases with the number of prior occurrences of the current token
Role in Factual Recall vs. Pattern Copying
Induction heads are specialized for pattern copying, not factual retrieval. They excel at replicating sequences observed in the current context window but do not directly access knowledge stored in MLP layers. This distinction is crucial: induction heads handle in-context patterns, while knowledge neurons in MLP layers handle memorized facts. The two systems can interact—an induction head may route a copied token to an MLP layer that enriches it with stored factual associations.
- Induction Heads: Copy patterns from the current context
- MLP Layers: Retrieve facts from parametric memory
- Interaction: Copied tokens can trigger factual recall in downstream layers
Frequently Asked Questions About Induction Heads
Induction heads are a pivotal discovery in transformer mechanistic interpretability, explaining how language models perform in-context learning without weight updates. These specialized attention heads implement a simple pattern-matching and copying algorithm that allows models to recognize repeated sequences and predict subsequent tokens.
An induction head is a specialized attention head discovered through mechanistic analysis that performs in-context copying by attending to the token immediately following a previous occurrence of the current token. The mechanism operates in two distinct phases: first, a previous token head attends to the token immediately preceding the current position, copying its representation into the residual stream. Second, the induction head uses this enriched representation as a query to find matching tokens earlier in the sequence, then attends to the token that followed that match. This implements the algorithm: 'If I see token A preceded by token B, find a previous occurrence of B and predict whatever came after it.' The circuit relies on the QK circuit to match prefix patterns and the OV circuit to copy the subsequent token's information forward.
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
Key concepts for understanding the internal algorithms and computational pathways that give rise to induction heads in transformer models.
QK Circuit
The computational pathway formed by the query (W_Q) and key (W_K) projection matrices. This circuit determines the attention pattern by computing the dot-product similarity between the current token's query and all previous tokens' keys. In an induction head, the QK circuit is specifically configured to attend to tokens that follow a previous occurrence of the current token, enabling in-context copying.
OV Circuit
The computational pathway formed by the output (W_O) and value (W_V) projection matrices. This circuit determines what information is copied from the attended-to source token to the destination position. In an induction head, the OV circuit acts as a copying mechanism, transforming the source token's residual stream representation into a form that increases the probability of predicting that same token at the current position.
Attention Head
A specialized computational subunit within a transformer layer that computes a weighted sum of past token representations. Induction heads are a specific functional class of attention head discovered through mechanistic interpretability. They emerge in two-layer attention-only models and are hypothesized to be the primary mechanism driving in-context learning in large language models.
Circuit Analysis
The process of identifying and validating the minimal subgraph of a neural network's computational graph responsible for a specific behavior. For induction heads, circuit analysis reveals a two-head composition: a previous token head in an earlier layer attends to the preceding token, and the induction head in a later layer uses that information to attend to the token after the current token's previous occurrence.
Activation Patching
A causal intervention technique used to isolate functional circuits. To verify an induction head, researchers perform activation patching by replacing the head's output with activations from a corrupted run. If the model's ability to perform in-context copying is disrupted, the head's causal role is confirmed. This technique provides rigorous evidence that induction heads are necessary and sufficient for specific copying behaviors.
Rotary Position Embedding (RoPE)
A position encoding method that applies a rotation matrix to query and key vectors based on their absolute positions. RoPE ensures the attention dot product depends only on the relative distance between tokens. Induction heads exploit this property to learn a 'match the previous occurrence' algorithm by attending to tokens at a specific relative offset, making RoPE a critical enabler of their copying functionality.

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