TL;DR
This paper investigates "grokking," a phenomenon where neural networks generalize much later than expected, and challenges the prevailing theory that it's solely tied to a shift in the Neural Tangent Kernel (NTK). Instead, they find that changes in the network's representational geometry, specifically its "manifold capacity," are a much better indicator of when grokking occurs, suggesting a decoupling of learning regimes and generalization.
What Problem Does This Paper Address?
Neural networks are remarkably good at generalizing to unseen data, a phenomenon that underpins modern machine learning. However, understanding how this generalization happens is still an active area of research. A particularly intriguing puzzle is "grokking," where models that have already perfectly memorized their training data suddenly start to generalize to new data, often much later in training. This delay is counterintuitive and suggests that something fundamental is changing within the network.
Previous theoretical work has linked grokking to a transition from a "lazy" learning regime (where the network behaves like a linear model and its weights change little) to a "rich" feature-learning regime. This transition was often measured by changes in the Neural Tangent Kernel (NTK), which describes the network's behavior in the lazy regime. The assumption was that the NTK would remain stable during the initial memorization phase and then change significantly around the time grokking occurs. This paper questions this assumption in the context of more complex, real-world tasks like image classification.
Methods
The researchers tackle this problem by:
- Reproducing Grokking: They first replicate the grokking phenomenon in image classification tasks (MNIST and EMNIST) using established methods like weight scaling, weight decay, and output re-scaling to induce delayed generalization.
- Analyzing the Neural Tangent Kernel (NTK): They measure the "kernel distance" between NTKs at different training stages. This metric quantifies how much the linearized network's behavior changes over time.
- Introducing Manifold Capacity Metrics: Crucially, they adopt and apply "manifold capacity theory." This framework quantifies how well different object classes are separated in the network's internal representations (activations). They measure "manifold capacity" ($a_c$), "effective dimension" ($D_M$), and "effective radius" ($R_M$) of these representations.
- Probing Feature Transferability: To understand the nature of learned features, they use "linear probing." This involves training a simple linear classifier on the activations of a frozen layer from the main network to see how well those features generalize to a slightly different dataset (MNIST vs. EMNIST).
Datasets
- MNIST: A standard dataset of handwritten digits, used for initial reproduction of grokking and some analysis.
- EMNIST: An extension of MNIST that includes both digits and letters, offering a more complex and challenging image classification task.
Key Insights and Ideas
- NTK is Not the Whole Story: The most surprising finding is that the NTK changes significantly before grokking begins. This suggests that the "rich" learning regime, or at least a departure from the purely "lazy" regime, starts much earlier than previously thought and is decoupled from the onset of delayed generalization.
- Manifold Geometry is Key: Changes in "manifold capacity" and related geometry metrics (like effective dimension and radius) align much more closely with the timing of grokking. This indicates that the network is actively restructuring its internal representations to make classes more separable, which is what ultimately enables generalization.
- Decoupling of Regimes: The research highlights that the theoretical "lazy" and "rich" learning regimes might not always neatly map to observable generalization behavior. The network can be undergoing "rich" learning (as indicated by NTK changes) without immediately showing improved test performance.
- Feature Learning Can Be Lost: In networks that don't grok, features learned early on can actually deteriorate later in training, leading to a form of "representation collapse" or over-specialization, even if the overall training loss is low. This is revealed by the linear probing task under distribution shift.
Key Results
- In image classification tasks, the NTK deviates from its initial state significantly before grokking (i.e., before test performance improves).
- Grokking coincides with a rapid increase in manifold capacity and improved effective geometry metrics of the network's representations.
- When generalization is not delayed (e.g., with a small output scaling parameter), this sharp transition in manifold geometry is absent.
- A UMAP visualization shows object classes becoming increasingly distinct and tightly clustered as the network groks, supporting the idea of improved representational geometry.
- Linear probing on a distributionally shifted dataset reveals that features learned in non-grokking networks can become less generalizable over time, indicating a loss of feature learning.
Limitations and Future Work
- Complexity of Real-World Tasks: While the study uses image classification, the authors acknowledge that the dynamics might differ for other complex tasks.
- Theoretical Explanations: The paper provides empirical evidence but calls for future theoretical work to fully reconcile the observed decoupling of NTK changes and manifold geometry with grokking.
- Generalizability of Findings: The authors hope their findings will motivate the community to test theoretical explanations of grokking on more complex datasets and tasks.
- Memorization vs. Generalization: The paper touches upon late-epoch memorization and its potential link to representation compression, suggesting further investigation into the interplay between generalization and memorization.
Summary updated