Induction heads blend n-gram estimates on synthetic data
The thing everyone assumed induction heads were doing
If you have read anything about how large language models learn from their own prompt, you have probably met the induction head. It is the most famous circuit in mechanistic interpretability — the sub-field that tries to reverse-engineer what specific computation a trained network is actually running, rather than just measuring how well it scores.
The standard picture is two layers of attention working together. Attention, in this context, is the mechanism that lets a model look back over everything it has read so far and decide which earlier positions are relevant to the token it is about to predict. In an induction head, the first layer builds a summary of what came just before each position, and the second layer scans backwards for a place where the same thing came just before — then copies whatever followed it last time. See A B earlier in the text, currently looking at A, predict B.
Described that way, an induction head is a lookup table. It finds exact matches and counts what came next. Statisticians have a name for that: it is the maximum-likelihood estimate, the "just count what you saw" answer.
A paper presented at ICML 2026 — Induction Heads Interpolate N-Grams, by Francesco D'Angelo, Oğuz Kaan Yüksel, Swathi Shree Narashiman and Nicolas Flammarion — argues that this picture is only the limiting case, and that the real behaviour is something far more interesting. It is worth saying up front that this went through peer review and was published as a conference paper, with an OpenReview record attached; that puts it in a different category from most of what lands on arXiv.
First, the thing from your NLP textbook
To see why the result is fun, you need one idea from the era before neural language models.
An n-gram model predicts the next word by counting. A trigram model asks: of all the times I've seen the two words "the weather is", what came next, and how often? Then it predicts proportionally. Simple, fast, and for decades it was the state of the art.
It also has a fatal flaw. Language is enormous and sparse, so most three-word sequences you'll ever encounter, you have never seen before. A count of zero becomes a probability of zero, and a probability of zero is not "unlikely" — in a language model it is impossible. One unseen trigram and the model assigns the whole sentence probability zero. It doesn't degrade; it breaks.
The fix is smoothing, and it comes in two flavours that every introductory NLP course covers:
- Add-α (Dirichlet / Laplace) smoothing. Before you count anything, pretend you already saw every possible continuation α times. Nothing can have a count of zero any more, because everything starts above zero. Those imaginary observations are called pseudo-counts, and in Bayesian terms they encode a prior belief about what continuations are plausible.
- Interpolation, of which Jelinek-Mercer is the classic form. If the three-word context is too rare to trust, don't throw the prediction away — blend it with what a two-word context says, and a one-word context, and the overall word frequencies. Long contexts are specific but unreliable; short ones are reliable but vague. Interpolation mixes all of them, weighted by how much you trust each.
There is a third relative, Katz back-off, which is stricter: use the longest context that has any data at all, and if it has none, fall back one level. Interpolation always mixes; back-off picks one.
None of this is neural. It is 1980s and 1990s statistical language modelling, and it is usually taught as background before the course gets to the interesting part.
What does the study show about how AI models learn from a prompt?
The authors study transformers trained on order-k Markov chains — synthetic sequences where the next token depends only on the previous k tokens, according to a hidden transition rule that is redrawn for each sequence. The model has to infer that rule from the sequence itself, which is in-context learning stripped down to something you can do exact maths on.
Their central move is to stop analysing the induction head in the hard-attention limit. Attention scores pass through a softmax, and how sharply it concentrates depends on the scale of the attention weights (the paper's parameter β). Push that scale to infinity and attention picks out exactly one thing — the exact match — and you recover the counting story. Every prior analysis, the authors note, did exactly that.
At finite attention scale, something else happens. The circuit does not just find exact matches; it scores every candidate position in the history by how much of the current context it overlaps with, and mixes in all of their predictions with weights that fall off exponentially as the overlap shrinks. A context that matches in all k positions dominates. A context that matches in only one still contributes something.
That is an interpolation across context orders — with mixing weights that depend on the data rather than being tuned by hand. Which is to say: Jelinek-Mercer smoothing, arrived at by gradient descent on a synthetic prediction task, with nobody having written it down.
The attention scale is the dial between the two classical regimes. Turn it up and you get Katz's hard rule: the longest matching context wins outright. Turn it down and you get a smooth, differentiable blend. And the back-off behaviour is automatic — when the full-length context has never occurred, its term is multiplied by a count of zero and simply vanishes, leaving the shorter contexts to carry the prediction. No if statement required.
One detail goes beyond the textbook. Classical interpolation and back-off both work with contiguous suffixes — the last two words, the last one word. The transformer's estimator also counts non-contiguous matches: contexts that agree with the current one in some positions and not others. It is averaging over all subsets of the context, not just the suffixes. That is a richer family than either classical method.
The second mechanism: BOS as imaginary evidence
The other half of the paper concerns a piece of plumbing that most people never think about.
Nearly every transformer prepends a beginning-of-sequence token. The usual justification is that attention heads need somewhere harmless to point when nothing in the context is relevant — an "attention sink", a parking space.
The paper shows it is doing real statistical work. Because BOS is always there and never depends on the sequence, attention paid to it contributes a constant amount to every prediction, regardless of what has been observed. A constant added to every count is precisely a pseudo-count — which makes the BOS token an implementation of add-α smoothing, built out of an architectural convention nobody chose for that reason.
The paper even derives roughly what attention scale corresponds to a given α, tying the knob to the classical parameter.
Constructed, then confirmed
The argument is made twice over, which is what makes it convincing.
First by construction: the authors build a disentangled transformer — a stripped-down variant with no MLPs, where each layer's output is concatenated onto the residual stream rather than added to it, so nothing gets tangled together and every computation stays legible. (This form is known to be equivalent to a standard attention-only transformer, so it is a fair object to reason about.) They set the weights analytically to the values their theory predicts, and the resulting model behaves as claimed.
Then by training: they train models from scratch and check whether they land in the same place. They do. The trained models reproduce the predicted attention patterns — a first layer copying at lag 1 and lag 2, a second layer matching contexts and grading its attention by overlap — and this holds for a fully standard two-layer transformer with LayerNorm, an MLP block, learned embeddings and additive residuals, not only for the interpretable stand-in.
The behaviour also adapts to the situation. With no BOS token available, trained models lean on soft context matching to interpolate across orders. With a BOS token, they use pseudo-counts instead — and where add-α is the Bayes-optimal thing to do, they match it. Where it isn't optimal, because the underlying task has structure that rewards backing off to shorter contexts, they combine both mechanisms and match or beat the classical count-based baselines.
That last point is the sharpest version of the finding. The network is not approximating the textbook estimator badly. Given a task where the textbook estimator is the right answer, it finds it; given a task where the textbook estimator is the wrong answer, it does better.
Caveats
Read this as a clean theoretical result, not a claim about ChatGPT.
- The setting is synthetic order-k Markov data with small, controlled models. The main experiments use k = 2 and a five-token vocabulary; the "standard transformer" comparison is two layers with a model dimension of 64. Natural language is not an order-k Markov chain.
- The paper does not claim that the same estimator description holds for production-scale language models. It characterises what this circuit computes in this setting. Extending it to frontier models is an open question, and nothing here should be read as having answered it.
- There is no large-scale validation. No experiments on real text corpora or large models are part of this work.
The honest summary is that a specific, well-studied circuit has been given a precise statistical identity in a setting where you can prove things. That is genuinely useful — much of interpretability research is stuck at "this head seems to do something like X" — but it is a foundation, not a finding about deployed systems.
Why it's worth your time anyway
Mechanistic interpretability usually produces results of the form this attention head is involved in this behaviour. This one produces something rarer: the circuit is exactly this estimator, here is the derivation, and here is the classical algorithm it coincides with.
And the classical algorithm is one a lot of readers have already met and filed under history. If you have sat through a lecture on Jelinek-Mercer interpolation and add-α smoothing, and then separately learned how attention works, this paper connects the two — the sparse-data problem that broke n-gram models has not gone away, and a transformer trained on next-token prediction converges on the same family of solutions the field worked out by hand thirty years ago.
The authors' own framing is that transformers learn to regularise their in-context estimates rather than simply count. Counting was never the hard part. Knowing what to do when you haven't seen enough is.
Details
- Paper: Induction Heads Interpolate N-Grams — arXiv:2607.02800 · PDF
- Venue: Published as a conference paper at ICML 2026 — OpenReview
- Submitted to arXiv: 2 July 2026
- Authors: Francesco D'Angelo*, Oğuz Kaan Yüksel*, Swathi Shree Narashiman†, Nicolas Flammarion (* equal contribution)
- Affiliations: TML Lab (Theory of Machine Learning), EPFL, Switzerland; IIT Madras, India († internship at the TML Lab)
- Subject: Machine Learning (cs.LG)
- Setup: order-k Markov chains with k = 2, vocabulary size 5; transition rules drawn from an independent Dirichlet prior (α = 1) or a hierarchical Dirichlet prior (η₁ = η₂ = 5.0)
- Models compared: disentangled construction (weights set analytically), disentangled trained, and a standard two-layer transformer (d_model = 64, LayerNorm, MLP block, learned relative positional biases)
- Training: Adam, learning rate 10⁻³, batch size 32, 10⁶ iterations, last-token cross-entropy loss
- Evaluation: KL divergence between the model's prediction and the ground-truth transition distribution
- Licence: the paper is CC BY 4.0, which is why its Figure 1 appears above with attribution
Sources
- https://arxiv.org/abs/2607.02800
- https://arxiv.org/pdf/2607.02800
- https://openreview.net/forum?id=BSY7jhBxM1
Related stories
- EPFL builds FiberMotor, a flexible thread-like linear motor
- Polarization lets gallium nitride diodes block more than 3.9 kV
- Atlas of 306,146 designed protein binders awaits lab tests
- Rare Marine Bacteria Hold Ocean Microbial Networks Together, an IIT Madras Study of 4,611 Samples Reports
- Flapping-wing robot takes off from water using wings alone
- One Robotic Fish Design, Three Sizes: The Swimming Scaled, the Efficiency Did Not
More from Debug Duck
- Planted AI flaws can be 20.4 times harder to detect, study finds
- NVIDIA launches BioNeMo Agent Toolkit for scientific discovery
- LineShine, a CPU-only machine with 13.79 million cores, tops the June 2026 TOP500 at 2.198 exaflop/s; five systems now reach an exaflop
- Jensen Huang talks vision, risk and the GPU with Condoleezza Rice
- Anthropic says its engineers now ship 8x as much code per quarter