All posts

Nov 19, 2026 · 10 min read

The exact moments GPT-2 small learns

Pinpointing the exact moments GPT-2 small acquires skills and knowledge requires saving 190 snapshots of the model during training. Skills like counting and forming plurals show up in the first 1,000 steps, and knowledge about the world, like a country’s capital city, takes thousands more. Between steps 700 and 1,000, the model also builds a different kind of skill entirely on its own. It learns to copy from earlier in the text in a sudden phase change, and the attention heads behind it are called induction heads.

  • LLMs
  • Mechanistic interpretability
  • Training dynamics

A language model doesn’t learn everything at once. Some things show up early in training, and others much later. To see when, I needed to train GPT-2 small (124M) again with the same settings as my last post and save a snapshot of its weights every 100 steps, 190 models in all.

Each snapshot was given the same 372 prompts from 16 different subjects.

The capital of France is → Paris

If a snapshot outputs the right token and the snapshot just before it didn’t, the model learned the answer somewhere in those 100 steps. Each snapshot is the model’s weights saved at one step, so “step 700” means the model as it was after training for 700 steps and no further.

For example, the prompt is Monday, Tuesday, Wednesday, and the right answer is Thursday. Here is what two snapshots say.

  • Step 700 snapshot: June (wrong)
  • Step 800 snapshot: Thursday (right)

So the model picked it up between steps 700 and 800.

Sometimes the right answer doesn’t stick right away. The step 900 snapshot gives Wednesday again, and after that the snapshots keep switching between Thursday and other guesses until step 17,100, when the knowledge finally sticks.

When each subject arrives

Here is one prompt from each of the 16 subjects, sorted by when the model first gets it right. Each strip runs through training from left to right and gets brighter the more sure the model is of the right answer.

The orange dot marks the first snapshot where it’s right, and pointing at it shows the 100-step window it was learned in. On the right is the model’s guess at the current step, blue when it’s right and red when it’s wrong.

how sure of the right answer: 0.01%100%first time it's rightpoint at or tap a strip for the step

  1. This figure needs JavaScript.

training step (log scale)

The tags in the figure split the subjects into three kinds, by where the answer comes from.

  • Facts are knowledge picked up from the training text, like which city is the capital of France. The prompt alone doesn’t give the answer away. (Capital cities, the country of a capital city, continents, languages, authors, baby animals, opposites and units of time.)
  • Patterns are rules or fixed orders the model continues, like counting or plurals. (Counting, number words, the alphabet, days, months, plurals and grammar.)
  • Induction heads (copying) use the prompt itself. The answer appeared earlier in the same text, so the model only has to find it and copy it. The section on the phase change goes into the details.

Patterns mostly arrive early and facts mostly arrive late.

All prompts, subject by subject

The first figure above follows one prompt per subject, but every subject has many. Pick a subject to see all of its prompts. Some click almost all at once, like induction heads (copying) and plurals, while others trickle in over thousands of steps, like months and the alphabet.

This figure needs JavaScript.

Across all 372 prompts, here is the step when each subject arrives.

Arrives means the step by which half of a subject’s prompts have been answered right at least once, even if the model loses the answer again later.

For example, plurals have 15 prompts. By step 600, only 2/15 had been answered right at least once. By step 700, 9/15 had, which is more than half, so plurals arrive at step 700.

  • By step 1,000. Plurals (700), then induction heads (copying), authors and counting (1,000).
  • By step 2,000. Grammar, meaning is or are (1,300), the days of the week (1,400) and number words (2,000).
  • By step 3,000. Languages (2,100) and the alphabet (2,700).
  • By step 5,000. Months (4,200), capital cities and units of time (4,400).
  • Later. Baby animals (6,900) and opposites (11,500).
  • Not reached. The country of a capital city and continents have no arrival step, because fewer than half of their prompts are ever right. Only 25 of 81 and 13 of 56 are.

As mentioned earlier, these arrival steps count only the first time each prompt gets its answer right, and the first right answer doesn’t always stay.

For The capital of France is, the model’s top guess is the until step 3,600, when Paris is on top for the first time. But Paris and the then trade the lead for thousands of steps. Of the 49 snapshots from step 3,600 to step 8,400, Paris is on top in 24 and the in 25. From step 8,500 on, Paris is on top in every snapshot.

Above, a strip showing the top guess in each snapshot from step 1,000: 'the' until step 3,600, then 'Paris' and 'the' swapping places many times, then 'Paris' in every snapshot from step 8,500. Below, the chance of each word: 'the' near 20% and falling, 'Paris' rising from near 0 to about 40 to 60% with large jumps.
“Paris” takes the top spot at step 3,600 but doesn’t keep it. It swaps places with “the” until step 8,500. The strip shows the top guess in each snapshot, and the lines show how likely the model thought each word was.

The phase change, when induction heads (copying) switch on

A phase change is a sudden jump in what a model can do over a short stretch of training. Most skills improve gradually, a little in each snapshot. In a phase change, a skill switches on almost at once. It’s missing in one snapshot and clearly there a few hundred steps later.

Between steps 700 and 1,000, the network creates a new skill entirely on its own, and it is a different kind from the earlier ones. Counting, plurals and facts all come from the training text. This skill takes its answer from a specific word earlier in the prompt.

Nobody programmed it. The model was only ever pushed, by backpropagation, to guess the next token better, and it invented this along the way.

The mechanism behind this skill is the induction head (Anthropic’s paper), an attention head that looks back through the text the model has already read, finds where the current word appeared before, and copies the word that came right after it.

To find that earlier spot, it relies on a second kind of head, a previous-token head, which tags every word with the word that came just before it. The tag is added to the word’s residual stream, the running record each word carries forward through the model’s blocks, where later heads can read it.

Quick background on GPT-2 small

GPT-2 small has 12 transformer blocks, and each transformer block has 12 attention heads, 144 in all. Both are numbered starting from 0, so “block 6, head 0” is the first head of the seventh block.

Here is how the two heads work together on a short sentence with a made-up code word. The previous-token head tags each word as the model reads it, and the induction head uses those tags to find the word to copy. Press Play, or step through one word at a time.

What a tag is

A tag is a short note that the previous-token head leaves on each word. When head 9 reads lamp, it looks back at velvet, the word just before, and writes a note onto lamp that says “I came right after velvet”. The note is really a list of numbers built from the word before it, and the animation shows it as a label.

How I scored the heads

To find these heads, I scored all 144 of them on a separate test from the 12 copying prompts (e.g. The code word is velvet lamp. Again, the code word is velvet). In this test, the prompt is a run of random tokens that starts repeating, and the model has to guess the next token. Here is a tiny version.

fern 4021 ought Zed fern 4021 ought → Zed

The only way to get it right is to copy Zed from earlier in the prompt.

Every head gets two scores, each from 0 to 1. A score is the share of one head’s attention that lands on a particular token, averaged over the test, so 0.3 means 30%.

  • The induction score is the share that lands on the token to copy. In the example, that is Zed when the model is reading the second ought. Six heads scored above 0.3 (blue), in blocks 6, 7 and 8.
  • The previous-token score is the share that lands on the token just before the one being read. In the example, that is 4021 when the model is reading ought. Six heads scored above 0.3 (orange), and block 5, head 9 is by far the strongest.

Together, an induction head and a previous-token head make what is called an induction circuit.

Full view of when the induction heads form

For the sentence in the animation from above, which is The code word is velvet lamp. Again, the code word is velvet, the chart shows the chance the model gives lamp as the last word in every snapshot, and it starts to climb in the shaded stretch between steps 700 and 1,000.

Chance of “lamp” as the last word, at every training step

Point at, or tap, the before, during and after zones under the chart to mark each snapshot.

In a few hundred steps, the model went from not being able to copy at all to doing it, with a small group of heads it built on its own.

These results come from block 5, head 9. The other previous-token heads scored above 0.3, but I haven’t validated them, and other parts of the model may influence the induction heads too.

Techniques used

These are the methods behind everything shown in this post, with the script that does each one. The code is on GitHub.

  • Snapshots. I trained GPT-2 small again and saved its weights every 100 steps, 190 models in all including the finished one.
  • Prompt probing (knowledge_probes.py, probe_snapshots_3.py). Every snapshot gets the same 372 prompts from 16 subjects, and the probability and rank of the right token are saved.
  • Top guesses (knowledge_paths.py). The top 10 guesses for every prompt in every snapshot, which is where “Paris” against “the” comes from.
  • Arrival steps (subject_order.py). A prompt is right when the right token is the top guess. A subject arrives when half its prompts have been right at least once.
  • Scoring attention heads (probe_snapshots.py, head_score_example.py). On 8 rows of 256 random tokens, each repeated, a hook on every block’s attention weights gives all 144 heads an induction score and a previous-token score. Heads above 0.3 in the finished model are the ones named.
  • Reading attention (induction_figure_data.py, copying_wiring.py). On the code word sentence, it records block 5, head 9’s output (the tag) at each word and block 6, head 0’s attention.
  • Removing a tag (induction_figure_data.py). I subtract the tag at “lamp” only and recompute block 6, head 0’s attention, to see whether it needed the tag.

What the snapshots show

A model stopped after a few hundred steps isn’t a small version of the finished model. Knowledge and skills arrive piece by piece, and as you’ve seen, each can take hundreds or many thousands of steps before the model has learned it. That’s why an early snapshot gets almost nothing right.

The most remarkable piece is the induction head. Between steps 700 and 1,000, a small group of attention heads formed that let the model copy from earlier in the text. The model was only pushed to guess the next token better, and it built this on its own. The emergence of this kind of skill is just incredible to me.

One thing to keep in mind is that all of this came from one training run. In another run with a different random seed, the exact steps where things begin to appear would likely be different.

I plan to dig more into induction heads in a future blog post and much more. Thanks for reading!