A small network memorized modular arithmetic, then generalized a million steps later
OpenAI named the effect grokking in 2022, on a 400,000-parameter network learning arithmetic tables over 97 symbols.
Why this matters
Grokking is the name for a strange training curve, and it has become a piece of shorthand in arguments about why large models get better. The claim runs like this: somewhere inside a big network, more training can flip a switch, and an ability that was not there before appears all at once. The word comes from one 2022 experiment at OpenAI, run on a network small enough to describe in a paragraph. This piece walks through what that experiment actually measured, what later work found was happening beneath the curve, and how much of the popular claim the evidence will bear. By the end you will know what grokking is, how big the result under it really is, and where the everyday use of the word runs past what anyone has shown.
- 01
- A verbatim quote comes out of the weights, not a lookup: how a network presses specific data into its weights, which is the memorizing half of what grokking trades away.
- 02
- The sudden jump in AI benchmarks was mostly in the scoring: why an ability that seems to appear at a scale threshold can be an artifact of how it is measured.
- 03
- The emergence jump returns when you plot AI skills against loss: the same question examined against training loss rather than model size.
Memorize first, generalize a million steps later
In 2022, Alethea Power, Yuri Burda, Harri Edwards, Igor Babuschkin, and Vedant Misra, all at OpenAI, trained a small transformer to fill in arithmetic tables and reported a training curve that has been cited ever since.1 The task was deliberately plain. Take 97 symbols, treat them as the numbers 0 through 96, and write out a binary operation as a table with one entry for every pair of inputs. Their headline case was division modulo 97: divide one number by another in arithmetic that wraps around at 97. They showed the network half of the 9,409 entries and kept the other half hidden, to see whether it had learned the rule or only the answers.1
Within roughly a thousand optimization steps, the network answered the training half almost perfectly. On the hidden half it sat near chance, and it stayed there far longer than anyone would keep training a model that looked finished. Only near a million steps did its accuracy on the unseen problems climb to near-perfect.1 Fitting what it was shown took about a thousandth of the training that learning the rule did. The authors named that late rise grokking.
A 400,000-parameter network on ninety-seven symbols
How big was the thing that grokked? The transformer had two layers, a width of 128, four attention heads, and about 400,000 parameters outside its embeddings.1 A current frontier model has hundreds of billions. The entire problem was 97 symbols and the table of one operation over them. It was trained with AdamW, an ordinary optimizer, with weight decay turned up. Shown half the table, the network needed on the order of a thousand times more steps to generalize than to memorize.1 This is the scale to hold on to, because the word grokking now travels attached to systems many millions of times larger.
Two further results from the same paper matter for what came later. The effect depended sharply on how much of the table the network saw. Around a quarter to a third of the table, cutting the training data by a single percentage point raised the median time to generalize by 40 to 50 percent.1 Less to learn from did not merely slow the network a little. It pushed the moment of generalization sharply further out. The authors also compared several ways of training and found one that helped far more than the rest. Weight decay, a standard penalty that pushes a network's weights toward smaller values, was the most effective. It more than halved the number of examples the network needed to generalize.1
What forms while the test curve stays flat
The curve looks like a switch flipping. The most important thing later work established is that, underneath, nothing flips. In 2023 Neel Nanda, Lawrence Chan, Tom Lieberum, Jess Smith, and Jacob Steinhardt took the simplest grokking case, addition modulo 113, and worked out exactly what the trained network was computing.2
The network does not store an addition table. It places each number at an angle around a circle, using a few fixed rotation speeds, and adds two numbers by turning through both angles at once. It reads the answer off by seeing which output the combined rotation points to. Remove those few frequencies and the answer collapses, which is how the researchers knew this was the whole method.2
Because they knew the algorithm, Nanda and colleagues could measure how much of it existed at each moment of training, without waiting for the test score to move. They built two readings from the network's internal frequencies: one for how complete the generalizing circuit is, another for how much the network still leans on rote memorized answers.2 Tracked that way, training falls into three stretches.
| Phase | Epochs | Inside the network | Test loss |
|---|---|---|---|
| Memorization | 0–1.4k | The training pairs are fit by rote; no general circuit yet. | High, flat. |
| Circuit formation | 1.4k–9.4k | The generalizing circuit forms and strengthens. | High, flat. |
| Cleanup | 9.4k–14k | The memorized components are shed. | Falls to near zero. |
The circuit starts forming and strengthening thousands of epochs before the test loss drops. The final fall, the part a person watching the curve would call the moment of grokking, is the network discarding the memorized answers it no longer needs. Nanda and colleagues describe grokking as "the gradual amplification of structured mechanisms encoded in the weights, followed by the later removal of memorizing components."2 The jump is sudden only in the one number that was being watched.
This is also where the account of weight decay gets sharper. Nanda and colleagues find that weight decay drives that final cleanup, and in their setup they call it necessary for grokking to happen at all. The original paper had put it more mildly, ranking weight decay the most effective of several training choices it compared, the one that more than halved the data the network needed.21 Read together, they agree on direction even where they differ on strength: weight decay is the main force moving the network off the memorized solution. Other work reached a similar picture from a different angle. Ziming Liu and colleagues modeled grokking as a slow reorganization of how the network represents the numbers internally. For a transformer, they found, the grokking setting sits close to plain memorization, which is part of why the payoff takes so long to arrive.3
Grokking leaves the toy setting
None of this has stopped the word from traveling. Grokking now gets invoked whenever a large model seems to improve in a jump, as evidence that networks hold abilities that more training will unlock. Two lines of work say how much of that the research supports.
The first pulls the mystery out of the effect. Ziming Liu, Eric Michaud, and Max Tegmark traced grokking to the size of the network's weights, and showed they could turn it on and off at will.4 Tuning that one quantity, they induced grokking on images, language, and molecules, well outside arithmetic, and switched it off on the algorithmic tasks where it was first seen.4 Weight decay is one of the controls on that quantity, which ties this back to what both earlier papers found. On this account grokking is a property of the training landscape a researcher can dial, not a threshold a network crosses by getting big.
The second tests the scale question directly. In 2025 Ziyue Li, Chenrui Fan, and Tianyi Zhou tracked a 7-billion-parameter model through pretraining and reported delayed generalization at that scale.5 It is real, and it widens grokking well past toy networks. It is also not the single switch of the shorthand. What they found was local and staggered: different kinds of data, math or code or commonsense, generalized at different times, the harder and later-memorized ones lagging furthest, with no one moment when the whole model grokked.5 They had to detect it through internal measures rather than a test score, because there was no single curve to watch jump. The finding extends the phenomenon and cuts against the popular reading at the same time: at scale, grokking looks less like a hidden switch and more like many small, unsynchronized transitions.
The researchers who study grokking are careful about the leap. Writing for Quanta on the state of the field, the science journalist reports the effect has been studied in "only extremely small networks," and quotes the mathematician Mikhail Belkin calling the modular-arithmetic tasks where grokking lives "a drop in the ocean" next to what current networks do.6 The effect is genuine and reproducible, and it is still a long way from explaining why frontier models improve.
The takeaway
Grokking is a real and repeatable effect with a small, specific home: a tiny network, trained far past the point of fitting its data, eventually learning the rule behind an arithmetic table. Three things are worth carrying away. The delay is enormous and genuine, roughly a thousand times more training to generalize than to memorize on the headline task. The suddenness is mostly in the measurement. Beneath a flat test curve the generalizing circuit is already forming, and weight decay is what clears the memorized part away at the end. And the word has outrun the result. Grokking has been switched on and off at will on other kinds of data, and the one study that reports it in a 7-billion-parameter model finds something scattered and local rather than a single hidden switch. A strange curve on a 97-symbol table is a real thing to have explained. It is not yet a theory of how large models learn.
- 01
- Do Machine Learning Models Memorize or Generalize?: a Google PAIR explorable that animates the memorize-to-generalize transition.
- 02
- Progress Measures for Grokking via Mechanistic Interpretability: the full reverse-engineering of the modular-addition circuit, for readers who want the algorithm in detail.
Sources
- arXiv · Power, Burda, Edwards, Babuschkin & Misra, "Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets" (2022)
- arXiv · Nanda, Chan, Lieberum, Smith & Steinhardt, "Progress Measures for Grokking via Mechanistic Interpretability" (2023)
- arXiv · Liu, Kitouni, Nolte, Michaud, Tegmark & Williams, "Towards Understanding Grokking: An Effective Theory of Representation Learning" (2022)
- arXiv · Liu, Michaud & Tegmark, "Omnigrok: Grokking Beyond Algorithmic Data" (2022)
- arXiv · Li, Fan & Zhou, "Grokking in LLM Pretraining? Monitor Memorization-to-Generalization without Test" (2025)
- Quanta Magazine · Ananthaswamy, "How Do Machines 'Grok' Data?" (2024)