TL;DR
Grokking—where a neural network suddenly generalizes long after achieving perfect training accuracy—can be explained as an internal competition between two distinct subnetworks. Early in training, a dense subnetwork quickly memorizes the data; later, regularized optimization triggers rapid norm growth in a tiny, sparse subnetwork that implements an algorithmic circuit and takes over the model's predictions.
What Problem Does This Paper Address?
In standard machine learning, overfitting usually means game over: once a model memorizes its training data, it rarely improves its generalization without fresh data or early stopping. Yet under the phenomenon called grokking, networks trained on algorithmic tasks overfit to 100% training accuracy with near-chance test accuracy, and then—tens of thousands of optimization steps later—generalization accuracy abruptly spikes to 100%.
Understanding the optimization dynamics and internal computational structures driving this phase transition is an active open question. Because grokking resembles sudden "emergent abilities" observed in scaled foundation models, uncovering its causal mechanisms could shed light on how discrete algorithmic reasoning emerges in deep networks.
Methods
The authors analyze a one-hidden-layer ReLU network ($p = 1000$ hidden units) trained via stochastic gradient descent (SGD) with weight decay on sparse parity classification. To reverse-engineer the model’s internal mechanisms throughout training, they employ:
- Active Subnetwork Identification via Pruning: Using input-dependent weight-magnitude pruning, they identify the minimal subnetwork $f_k$ of $k$ hidden neurons whose predictions match the full network $f$ across the input data.
- Effective Sparsity & Faithfulness Metrics: They define "effective sparsity" as the size of this minimal active subnetwork, and track subnetwork "faithfulness"—the degree to which an isolated subnetwork matches the complete model's test predictions.
- Neuron Norm Tracking: They trace the Euclidean weight norms of generalizing neurons versus memorizing neurons across training epochs.
- Circuit Analysis: They compare the discovered active subnetworks against theoretical Boolean logic circuits (such as Disjunctive Normal Form, or DNF).
Datasets
The authors evaluate their claims on controlled synthetic algorithmic tasks:
- Sparse Parity: The primary benchmark consists of an $(n, k)$-parity task where inputs are bit strings $x \in \{\pm 1\}^n$ and the label is the product of $k$ hidden bits. Standard runs use $n = 40, k = 3$ (and $k = 4$ in the appendix), with $N = 1000$ training points and 100 fixed test points.
- Modular Arithmetic Operators: To test dense vs. generalizing representations, the authors train a 2-layer decoder transformer on modular addition ($\text{mod } 97$) and modular division datasets (9,400 samples each), drawn from Power et al. (2022).
Key Insights and Ideas
- A Tale of Two Circuits: Training is characterized by competition between two mostly disjoint parameter structures: an early, sprawling dense subnetwork that memorizes training points, and a compact sparse subnetwork that computes the true generalizing function.
- Selective Norm Growth Yields Sparsity: While weight decay typically encourages smaller norms, it drives non-essential neurons toward zero once training loss reaches near-zero. Simultaneously, a tiny subset of generalizing neurons experiences an explosive surge in weight norm. Because these large weights overpower smaller linear layer activations, selective growth paradoxically induces effective sparsity.
- Circuits Resemble DNF Formulas: Parity on $k=3$ bits can theoretically be solved by a standard DNF network using $2^k = 8$ neurons, or an optimized DNF variant with 6 neurons. Empirically, the discovered generalizing subnetworks across runs consist of exactly 6 or 8 neurons. Intriguingly, SGD fails to find an even more compact 4-neuron threshold-gate construction.
- "Memorization" Has Latent Structure: On modular addition, test accuracy hovers well above chance prior to grokking. The authors attribute this to the network implicitly learning symmetry (the commutative property $a + b = b + a$) early on, proving that pre-grokking representations are not purely random look-up tables.
Key Results
- Sparsification Aligns with Grokking: As test accuracy jumps from chance ($\sim 50\%$) to $100\%$, the active hidden layer size drops by two orders of magnitude—from over 600 active neurons down to just 6–8 neurons.
- Subnetwork Faithfulness Crossover: Before grokking, the generalizing subnetwork's predictions do not match the full network. Around the transition, its faithfulness surges to $100\%$ on test points, while the complementary (memorizing) subnetwork's faithfulness plummets.
- Empirical Subnetwork Sizes: Across 5 random seeds for $k = 3$, the identified sparse subnetworks contain $\{6, 6, 6, 8, 8\}$ neurons. For $k = 4$, the subnetwork similarly collapses to a tiny, high-norm core around the grokking threshold.
Limitations and Future Work
- Model Simplicity: The core mechanistic conclusions are derived from a single-hidden-layer MLP on synthetic sparse parity. Multi-layer transformers and natural language tasks exhibit significantly more complex internal routing.
- Optimization Theory Gap: While the paper documents what occurs (norm growth in generalizing neurons versus decay elsewhere), it does not provide an analytical convergence proof explaining why gradient descent selects DNF-like circuits over smaller threshold-gate alternatives.
- Connections to LLM Emergence: The authors hypothesize that selective norm growth relates to outlier feature emergence in large language models (such as LLM.int8()), but leave rigorous testing of this connection to future research.
Summary updated