Grokking

Grokking is a training pattern in which a neural network first memorises its training data and then, long after appearing to overfit, starts to generalise to new examples.

Usually a model's performance on new data improves alongside its performance on training data, or stalls once it begins to overfit. Grokking breaks that pattern. The model reaches perfect accuracy on its training examples while still guessing at random on held-out ones, and then, after much more training with no apparent progress, its held-out accuracy climbs to near perfect.

The effect was named in a January 2022 paper by OpenAI researcher Alethea Power and co-authors Yuri Burda, Harri Edwards, Igor Babuschkin and Vedant Misra, Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets. They trained small networks on tasks generated by simple rules, such as modular arithmetic, and found that generalisation could arrive well after overfitting, and that smaller datasets needed more training before it did. The word comes from Robert Heinlein's novel Stranger in a Strange Land, where to grok means to understand something intuitively.

Later work looked inside the networks. In 2023 Neel Nanda, Lawrence Chan, Tom Lieberum, Jess Smith and Jacob Steinhardt reverse-engineered a small transformer that had grokked modular addition. It had learned to treat addition as rotation around a circle, using Fourier transforms and trigonometric identities. Measuring that circuit showed training passing through three phases: memorisation, formation of the general circuit, and cleanup of the memorised parts. The jump looks sudden on the accuracy chart, but the mechanism underneath was built gradually.

One proposed explanation involves weight decay, a regularisation setting that penalises large parameter values. It slightly favours a simpler general solution over a memorised one, even though the general solution is harder to find, so the model drifts towards it over time.

In practice grokking is a lesson about reading training curves. A flat validation curve does not always mean nothing is happening, and stopping early can miss a later improvement. It is not evidence that AI models suddenly understand things in a human sense. Most clear demonstrations come from small, controlled tasks, though the effect has also been reported in deeper networks and remains an active research topic.

Common questions

What is grokking in AI?

It is a pattern in training where a neural network memorises its training data first and only much later, after long training with no visible progress, starts to perform well on new examples. It is also called delayed generalisation.

Where does the word grokking come from?

From Robert Heinlein's 1961 science fiction novel Stranger in a Strange Land, in which to grok means to understand something intuitively. OpenAI researchers borrowed it for the training pattern in a 2022 paper.

Is grokking really sudden?

It looks sudden on an accuracy chart, but research by Neel Nanda and colleagues found the general solution forming gradually inside the network, followed by the removal of memorised components. The visible jump comes at the end of that process.

Does grokking happen in large language models?

The clearest examples come from small models on simple algorithmic tasks. Researchers have since reported grokking in deeper networks and other kinds of model, but how much it matters for large language models is still being studied.

Finding more

Search for "grokking neural networks", "delayed generalization" or "grokking modular addition" to find the research. The original OpenAI paper and the mechanistic interpretability work by Nanda and colleagues are on arXiv. Be cautious of popular posts that present grokking as sudden machine understanding; the research describes a specific, measurable training effect.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.