TL;DR
Grokking—the sudden onset of generalization long after a model has completely overfitted the training data—is widely seen as a mysterious phenomenon unique to deep neural networks. This paper demystifies grokking by proving it occurs in a classical, simple setting: over-parameterized ridge regression trained with gradient descent and weight decay. The authors provide the first exact quantitative bounds on "grokking time" and demonstrate how it can be precisely controlled or eliminated via hyperparameter tuning.
What Problem Does This Paper Address?
When training over-parameterized models, we often see training loss drop to zero almost instantly, while validation performance remains poor—a classic case of overfitting. However, in certain scenarios, if you keep training the model long past this point, the test error suddenly plummets to near-zero. This delayed generalization is known as grokking.
Most existing theories attribute grokking to complex architectural traits of deep neural networks, such as a transition from "lazy" kernel regimes to "rich" feature-learning regimes. This paper addresses a fundamental question: Are deep or non-linear structures actually necessary for grokking to occur? By studying grokking through the lens of classical ridge regression, the authors isolate the mathematical root causes of the phenomenon without the confounding complexities of deep architectures.
Methods
The authors analyze an over-parameterized linear regression model (the student) trained to learn a ground-truth linear teacher function using vanilla Gradient Descent (GD) with $\ell_2$ regularization (weight decay).
The core of their theoretical analysis relies on splitting the student's weight vector into two orthogonal subspaces:
- $\theta_\parallel$ (Data-spanning subspace): The component of the weights directly updated by the training data to minimize empirical loss.
- $\theta_\perp$ (Null space subspace): The component orthogonal to the training data, which does not affect training performance but heavily impacts generalization.
By tracking these components, the authors prove an end-to-end trajectory consisting of three distinct phases: fast training error decay, prolonged overfitting, and eventual global generalization driven by the slow erosion of the null-space weights via weight decay.
Datasets
To validate their mathematical guarantees, the authors use synthetic datasets where features are drawn from an i.i.d. Gaussian distribution $\mathcal{N}(0, \frac{1}{m}I_m)$. This allows them to cleanly control variables like feature dimension ($m$) and sample size ($n$). They also extend their empirical evaluation to:
- Random Fourier Features (RFF): To test a more complex feature mapping.
- Two-layer ReLU Neural Networks: To demonstrate that their linear-derived bounds qualitatively predict grokking behavior in non-linear deep learning settings.
Key Insights and Ideas
- Grokking is a Subspace Race: Grokking happens because of a massive speed mismatch between two optimization forces. The data-spanning weights ($\theta_\parallel$) converge exponentially fast to fit the training data. Meanwhile, the noise-inducing weights in the null space ($\theta_\perp$) decay at a much slower rate governed strictly by the weight decay parameter $\lambda$. Grokking time is simply the delay it takes for weight decay to clean up the null space.
- Not Unique to Deep Learning: Neither depth, non-linearity, nor complex algorithmic tasks (like modular arithmetic) are required for grokking. It is an inherent property of over-parameterized models trained with explicit regularization.
- Hyperparameter Predictability: Because the mechanics reduce to geometry and linear algebra, grokking time ($t_2 - t_1$) becomes explicitly predictable. For instance, grokking time scales inversely with weight decay ($1/\lambda$) and grows logarithmically with the initialization scale ($\nu^2$).
Key Results
The paper provides the first mathematically rigorous, quantitative lower bounds on grokking time.
- The $1/\lambda$ Scaling Law: They prove that as the weight decay parameter $\lambda \to 0$, the generalization delay approaches infinity ($t_2 \propto 1/\lambda$), while having virtually no effect on the initial overfitting time ($t_1$).
- Neural Network Alignment: Remarkably, the quantitative bounds derived for simple ridge regression accurately predict the qualitative behavior of non-linear, two-layer ReLU networks.
As shown in Figure 1, the loss trajectories of classical ridge regression match the classic grokking curves observed in deep learning. Furthermore, their hyperparameter sensitivity analysis perfectly aligns with empirical simulations:
Limitations and Future Work
- Realizable Setting Assumption: The theoretical proofs assume a realizable setting where the teacher function can be perfectly represented within the student's feature space. While the authors provide empirical evidence that grokking still occurs with label noise, a formal proof for the non-realizable setting remains open.
- Explicit vs. Implicit Regularization: This work focuses heavily on explicit $\ell_2$ regularization. However, grokking has been observed in unregularized settings where implicit bias (e.g., from initialization or step size) drives generalization. Extending these tight quantitative bounds to unregularized settings is a crucial next step.
- The Regression vs. Classification Gap: In regression, continuous loss decays smoothly, making the "test loss plateau" less visually abrupt than the accuracy plateaus seen in classification grokking. The authors introduce a surrogate accuracy metric to replicate this plateau, but a deeper theoretical bridge between the two domains is still needed.
Summary updated