Grokking is a phenomenon where a neural network, typically a small transformer trained on an algorithmic task like modular arithmetic, suddenly achieves perfect test accuracy long after it has already achieved perfect training accuracy. The model initially memorizes the training data, exhibiting classic overfitting with zero validation performance, but with extended training—often orders of magnitude more steps than needed to fit the train set—it undergoes a sharp phase transition to a generalizing solution. This defies the standard statistical learning theory expectation that validation loss should rise after overfitting begins.
Glossary
Grokking

What is Grokking?
Grokking is a surprising phenomenon in deep learning where a model abruptly transitions from memorizing a training dataset to perfectly generalizing a clean, general solution after a prolonged period of overfitting.
The mechanism behind grokking is linked to the transition from a dense, memorizing subnetwork to a sparse, generalizing circuit within the model's weights. Weight decay plays a critical role by slowly pruning the memorization solution, eventually allowing the more efficient, generalizing algorithm to dominate. The phenomenon highlights the importance of implicit regularization and suggests that validation loss alone can be a misleading proxy for learning, as the model's internal representations can restructure dramatically long after the training loss plateaus.
Frequently Asked Questions
Clear, technical answers to the most common questions about the grokking phenomenon in neural networks, from its defining characteristics to its implications for AI safety.
Grokking is a phenomenon in machine learning where a neural network abruptly transitions from memorizing the training dataset with near-perfect training accuracy but poor test accuracy (overfitting) to perfectly generalizing a clean, general solution after a prolonged period of additional training. The term was coined by researchers at OpenAI in 2021 when studying small transformers trained on modular arithmetic tasks. The defining characteristic is a sharp, delayed phase change in validation accuracy that occurs long after training accuracy has saturated, without any changes to the optimization algorithm or hyperparameters. This challenges the classical understanding of overfitting, suggesting that models can spontaneously escape memorization regimes through extended training alone.
Grokking vs. Standard Overfitting
A comparison of the distinct training phases and generalization behaviors between the grokking phenomenon and standard overfitting in neural networks.
| Feature | Grokking | Standard Overfitting | Standard Generalization |
|---|---|---|---|
Training accuracy timeline | Reaches 100% quickly | Reaches 100% quickly | Reaches 100% gradually |
Validation accuracy timeline | Sudden jump to 100% after prolonged plateau | Degrades while training accuracy rises | Rises in tandem with training accuracy |
Memorization phase duration | Extended (thousands of steps) | Indefinite (no transition) | Brief or absent |
Generalization onset | Abrupt phase transition | Never occurs | Gradual and smooth |
Weight norm behavior | Decays slowly during memorization, then stabilizes | Grows unbounded | Remains bounded and stable |
Decision boundary complexity | Initially complex, simplifies abruptly | Highly complex and jagged | Smooth and simple throughout |
Loss landscape trajectory | Circles a valley before finding a flat minimum | Descends into a sharp minimum | Descends directly into a flat minimum |
Implicit regularization required |
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
Understanding grokking requires fluency in the core concepts of mechanistic interpretability. These terms form the vocabulary for reverse-engineering the circuits and representations that enable sudden generalization.
Circuits
Sparse, interpretable subgraphs of a neural network consisting of connected attention heads and MLP neurons that implement a specific, human-understandable algorithm. Grokking is often explained as the model transitioning from a dense, memorized solution to a sparse, generalizing circuit. The formation of these circuits corresponds with the sudden drop in validation loss.
Superposition
A hypothesized phenomenon where a neural network represents more independent features than it has dimensions in a given layer, compressing sparse features into a lower-dimensional space. During the memorization phase before grokking, models may rely on polysemantic neurons in superposition. The transition to a generalizing solution often involves disentangling these features into more robust, monosemantic representations.
Weight Decay
A regularization technique that adds a penalty proportional to the squared magnitude of the weights to the loss function. Weight decay is empirically critical for inducing grokking. It exerts a constant pressure toward simpler solutions, eventually forcing the model to abandon the complex memorization strategy in favor of a sparse, low-norm circuit that perfectly generalizes.
Double Descent
A phenomenon where model performance on test data first improves, then worsens (as the model overfits), and then improves a second time. Grokking is a dramatic, delayed form of the second descent. Unlike classic double descent driven by more parameters or data, grokking is driven purely by extended training time, revealing a temporal axis to the bias-variance tradeoff.
Sparse Autoencoder
An unsupervised architecture trained to decompose a model's dense, polysemantic activations into a sparse set of interpretable, monosemantic features. Researchers use sparse autoencoders to analyze the internal representations before and after grokking, identifying the emergence of clean, generalizable feature directions that replace the entangled representations used during memorization.
Memorization vs. Generalization
The fundamental dichotomy at the heart of grokking. Memorization is the rote storage of training examples, achieving perfect training accuracy with no underlying pattern extraction. Generalization is the discovery of a parsimonious algorithm that maps inputs to outputs. Grokking is the abrupt phase transition from the former to the latter, visible as a sharp validation accuracy spike long after training accuracy has saturated.

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