TL;DR
When neural networks "grok," they spend thousands of epochs blindly memorizing training data before abruptly snapping into a state of near-perfect generalization. Historically, watching this generalizing rule form under the hood required reverse-engineering the exact mathematical circuit in advance. This paper introduces a clever retrospective compass—the Geometric Coherence Score—that reveals where in the Transformer and when in training this transition happens, showing that the MLP quietly organizes itself first while the attention heads lock in the final pieces right around the breakthrough.
What Problem Does This Paper Address?
Picture a small Transformer learning modular addition—essentially clock arithmetic. Early in training, it hits 100% accuracy on the training set while completely failing on unseen test pairs. It has built a giant, brittle lookup table. Yet if you leave the GPU running long after training loss bottoms out, test accuracy suddenly shoots up to 99%. That delayed, phase-transition-like epiphany is called grokking.
Mechanistic interpretability researchers love grokking because they can crack open the finished network and find elegant trigonometric algorithms (often called "Clock" or "Pizza" circuits). Once you know the exact algorithm, you can build custom progress measures to watch it assemble during the flat test-accuracy plateau.
Here is the catch: to build those progress measures, you have to reverse-engineer the final algorithm first—and two networks trained on the exact same task might invent completely different ones. If we face a network whose internal algorithm we haven't decoded yet, how do we know where inside the architecture, and when during training, to look first?
Methods
The authors introduce a novel, algorithm-free diagnostic called the Geometric Coherence Score (GCS). The intuition is wonderfully geometric: if a network is relying on a memorized lookup table, nudging two related inputs slightly will cause their internal representations to veer off in unrelated directions. If the network has learned a shared underlying rule, related inputs should respond similarly to local nudges.
What is new here is how GCS defines "related inputs" retrospectively without knowing the task's math:
- Final-Model Neighborhoods: Take the fully trained model at the end of a run and see which inputs cluster together as $k$-nearest neighbors in its final hidden space. That fixed graph becomes your reference map for the entire training history.
- Directional Probes: At every saved checkpoint, use Jacobian-vector products (JVPs)—automatic differentiation that measures instantaneous directional derivatives without finite noise—to nudge the prediction-position (
=) embedding along principal neighbor directions. - Spectral Summary: Measure the cosine similarity of these local output changes separately for the Attention and MLP sublayers, build a weighted similarity graph, and compute its spectral entropy to get a single coherence score per checkpoint.
To verify that these geometric shifts actually matter for prediction, the authors pair GCS with causal weight resets, activation patching, and frozen-component continuation experiments, rolling individual components back to a pre-grokking checkpoint ($t^-$) chosen just before attention outputs become symmetric to swapping operands (e.g., $a + b$ vs. $b + a$).
Datasets
No new benchmarks are introduced; the authors use standard synthetic modular arithmetic datasets modulo a prime $p = 113$ (with a cross-prime check at $p = 97$). Models read token sequences formatted as [a, b, =] and predict the result at = across four operations—addition, subtraction, multiplication, and division—using a harsh 30% train / 70% test split designed to induce grokking.
Key Insights and Ideas
- Memorization looks like geometric shattering: Untrained networks actually start with high GCS because smooth random weights nudge everything the same way. As the network memorizes the training set, MLP coherence plunges into a deep trough—inputs that will eventually share a rule are being forced into fragmented, independent lookup entries.
- MLPs lay the groundwork; Attention finishes the job: In one-layer Transformers, MLP coherence bottoms out early and recovers substantially before test accuracy buds, whereas attention coherence peaks right around grokking and dips afterward.
- Pre-grokking MLPs are already "grok-ready": If you take a fully generalized network and swap its MLP weights back to a checkpoint shortly before grokking ($t^-$), the model barely blinks. Do the exact same rollback to the Attention layer, and test accuracy collapses. Even more strikingly, taking those $t^-$ MLP weights, freezing them, and transplanting them back into an early memorizing network allows the rest of the model to successfully grok, whereas freezing early memorizing MLP weights traps it.
Key Results
- Consistent trajectory signatures: Across 104 grokking runs (spanning 1–3 layers, ReLU/GELU/SiLU activations, and 4 arithmetic tasks), MLP coherence drops to a trough and partly recovers by grokking in 103/104 runs, while attention coherence peaks near grokking and dips in 94/104 runs. The separation between components is sharpest in 1-layer models (30/35 vs. a random-anchor null mean of 10.3).
- Asymmetric reset costs: In 17 one-layer addition and multiplication runs, resetting final attention weights to $t^-$ causes a mean test accuracy drop of 0.40, whereas resetting the MLP drops accuracy by only 0.03—outweighing even parameter-matched random MLP unit resets (max mean drop 0.025). Within attention, resetting $K$ or $O$ matrices hurts far more than $Q$ (near zero) or $V$.
- Frozen-MLP training: Continuing training from the MLP-coherence trough with frozen $t^-$ MLP weights reaches 99% test accuracy within budget in 15/17 runs, compared to 3/17 with trough MLP weights and 4/17 with untrained initialization weights.
- Pinpointing critical windows: Using attention GCS alone to pick 11-checkpoint windows on 71 held-out runs captures accuracy jumps at the 0.887 median percentile and symmetry shifts at the 0.963 percentile, beating random windows (0.779 and 0.508) and frequently highlighting earlier, non-overlapping training stages compared to simple $L_2$/CKA distance-to-final metrics.
Limitations and Future Work
The authors are admirably candid about the boundaries of their setup:
- Toy scale and architecture: Experiments focus on small, decoder-only Transformers without LayerNorm on synthetic arithmetic. Pilot runs with LayerNorm grokked too quickly for the checkpoint sampling rate to resolve the joint signature (appearing in only 2/11 one-layer and 0/10 two-layer runs), and deeper networks were only probed at their final block.
- Retrospective and probe-sensitive: Because GCS relies on the final model's hidden states, it cannot be used as a live early-warning monitor during training, and it may miss transient precursor circuits that get wiped out during cleanup. Furthermore, changing how directional probes are aligned (e.g., using Procrustes rotations instead of singular-value rank, or probing operand tokens instead of
=) alters or delays the observed MLP recovery. - Open mechanistic questions: It remains an open question for future work whether zooming into GCS-selected checkpoint windows actually makes it easier for researchers to reconstruct unknown circuits from scratch.
Summary updated