Is Grokking Worthwhile? Functional Analysis and Transferability of Generalization Circuits in Transformers

Kaiyu He, Mian Zhang, Peilin Wu, Xinya Du, Zhiyu Chen

TL;DR

Grokking—the phenomenon where a model suddenly learns to generalize long after overfitting its training data—is often celebrated as the magical emergence of an internal "Generalization Circuit." This paper demystifies this process, revealing that grokking doesn't create a brand-new reasoning paradigm but merely integrates sparsely supervised facts into a pre-existing reasoning path. Furthermore, the authors show that these hard-won circuits exhibit surprisingly poor transferability when the model is introduced to new knowledge.

What Problem Does This Paper Address?

Large Language Models (LLMs) are fantastic at retrieving single facts, but they frequently stumble on multi-hop reasoning—a limitation known as the "curse of two-hop reasoning." For example, a model might know that "Barack's wife is Michelle" and "Michelle was born in 1964," yet fail to answer "Barack's wife was born in?"

This failure happens because of a representational mismatch across independent layers in standard Transformers: early layers extract the "bridge entity" (Michelle), but deeper layers haven't been trained to use that specific latent representation as an input for the next step.

Recent work showed that parameter-sharing Transformers can overcome this by "grokking" the task, eventually forming an internal computational shortcut called a Generalization Circuit. However, grokking requires massive computational overhead, often taking millions of training steps. The authors of this paper ask a fundamental question: Is a grokked model actually superior to a non-grokked counterpart, and is all that extra compute truly worthwhile?

Mechanistic comparison between traditional and parameter-sharing transformers.

Methods

The authors evaluate a state-of-the-art parameter-sharing Transformer architecture on multi-hop reasoning tasks. To look under the hood, they use the logit lens technique, which allows them to decode intermediate hidden states across layers and see exactly when and where the model uncovers the intermediate "bridge entity."

To understand how data distribution influences grokking, they experiment with different data augmentation regimes:

  • First Hop Full Augmentation: Providing full compositional supervision for facts in the first step of the reasoning chain.
  • Second Hop Full Augmentation: Providing full supervision for the second step.
  • Both Hop Full Augmentation: Providing full supervision across the entire chain.

By comparing these setups against "natural grokking" (sparse supervision), they track how and when the Generalization Circuit forms.

Datasets

The authors construct a controlled synthetic dataset based on a directed knowledge graph:

  • Size: 2,000 entities and 200 unique relations, totaling 40,000 atomic facts.
  • Splits: A 95%/5% split creates an In-Distribution (ID) set (38,000 facts) and an Out-of-Distribution (OOD) set (2,000 facts).
  • Training vs. Testing: The model is exposed to all atomic facts during training, but only receives compositional (two-hop) queries constructed from the ID subset. It is evaluated on OOD compositional queries to test true systematic generalization.

Key Insights and Ideas

  • Grokking is Integration, Not Innovation: The internal inference paths for grokked and non-grokked models are identical on in-distribution data. The reasoning circuit actually forms very early in training; the prolonged "grokking" phase is just the slow process of dragging sparsely seen OOD facts into this pre-existing structure.
  • Beware of "Fake Grokking": A sudden jump in test accuracy (behavioral grokking) does not guarantee that the model has formed a true Generalization Circuit. Under a second-hop augmentation regime, models can achieve high accuracy purely through surface-level pattern memorization without ever resolving the intermediate bridge entity.
  • Limited Logical Mastery: If a model truly masters compositional logic, it should instantly apply it to new facts. However, the authors found that when new facts are introduced during fine-tuning, the circuit fails to generalize if the new fact sits in the second hop of the reasoning chain.

Key Results

  • Smarter Training Beats Grokking: Models trained with full supervision (Both Hop Full Augmentation) form a stable Generalization Circuit within just 0.3M steps. They achieve identical performance and transferability to naturally grokked models that require over 1M steps, proving that waiting for grokking is computationally inefficient if more data is available.
Transformer model grokking behavior under different data regimes.
  • The Fragility of Fake Grokking: While "fake grokked" models (from Second Hop Augmentation) look successful on paper, they completely fail to reason compositionally when fine-tuned on a mix of new and old facts, exposing their lack of a true underlying circuit.

Limitations and Future Work

  • Architectural Constraints: These findings are strictly tied to parameter-sharing Transformers. Standard Transformers struggle to resolve representational mismatches entirely, meaning these specific circuit dynamics might not translate directly to traditional architectures.
  • Compute Bottlenecks: Because grokking experiments require millions of steps, a comprehensive grid search of every possible data augmentation strategy was computationally infeasible.
  • Future Directions: The authors suggest that future research should focus on systematically categorizing which specific data distributions inherently favor robust circuit formation over simple pattern memorization.

Summary updated

BibTeX
@inproceedings{he2026is,
  author = {Kaiyu He and Mian Zhang and Peilin Wu and Xinya Du and Zhiyu Chen},
  title = {{Is Grokking Worthwhile? Functional Analysis and Transferability of Generalization Circuits in Transformers}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.1697},
}
Figure