The Mechanics of Grokking

'Grokking' describes the counterintuitive behavior where a model, after reaching near-zero training loss, continues to train for an extended period before suddenly achieving high validation accuracy. This paper moves beyond qualitative descriptions of this phenomenon by establishing a formal mathematical framework that treats the transition as a phase change in the model's internal representation.

Scaling Laws and Phase Transitions

The authors demonstrate that the transition from memorization to generalization is not merely a stochastic event but follows predictable scaling laws. By analyzing the relationship between model size, dataset complexity, and training duration, they identify a critical threshold where the model's optimization trajectory shifts.

Key findings include:

  • Phase Structure: The transition is characterized by a distinct 'phase structure' where the model first minimizes training error through high-frequency memorization (overfitting) before transitioning to a lower-energy state that captures underlying structural patterns in the data.
  • Predictability: The timing of this transition can be predicted based on the ratio of training data size to model capacity, providing a quantitative basis for determining when a model is likely to 'grok' a task.
  • Optimization Dynamics: The research highlights that the weight decay and optimization path are primary drivers of this transition, suggesting that generalization is an emergent property of the optimization landscape rather than just a result of model architecture.

Implications for Model Training

This research suggests that practitioners can better control the generalization process by tuning hyperparameters that influence the memorization-to-generalization threshold. Rather than treating long training times as a sign of inefficiency, the paper argues that the 'plateau' period is a necessary phase for the model to reorganize its weights into a more robust, generalized representation. This provides a theoretical foundation for understanding why some models fail to generalize and how to optimize training regimes to encourage the emergence of structural knowledge over rote memorization.