# Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalization

**Authors:** Boshi Wang, Xiang Yue, Yu Su, Huan Sun  
**arXiv:** [2405.15071](https://arxiv.org/abs/2405.15071)  
**Date:** 2024-05-23  
**Summary page:** https://www.summarizepaper.com/en/paper/2405.15071v1/

## Key points

- Authors Boshi Wang, Xiang Yue, Yu Su, and Huan Sun explore transformers' capabilities in learning implicit reasoning over parametric knowledge
- Focus on two key reasoning types: composition and comparison
- Transformers can learn implicit reasoning after extensive training beyond overfitting
- Varying levels of generalization observed across different types of reasoning tasks
- Transformers struggle with systematic generalization for composition tasks but excel in comparison tasks
- "Grokking" concept involves forming a generalizing circuit within the transformer model
- Efficiency of the generalizing circuit plays a crucial role in the model's ability to reason implicitly
- Connection between systematicity and configuration of the generalizing circuit explored
- Insights provided for optimizing data and training setups to enhance implicit reasoning induction
- Potential enhancements to transformer architecture suggested by promoting cross-layer knowledge sharing
- Comparison between GPT-4-Turbo and Gemini-1.5-Pro models highlights power of fully grokked transformers for complex reasoning tasks

## Summary

In their paper titled "Grokked Transformers are Implicit Reasoners: A Mechanistic Journey to the Edge of Generalization," authors Boshi Wang, Xiang Yue, Yu Su, and Huan Sun delve into the capabilities of transformers in learning implicit reasoning over parametric knowledge. They focus on two key reasoning types, composition and comparison, and investigate whether transformers can effectively grasp these skills. Through their research, the authors discover that transformers indeed have the capacity to learn implicit reasoning but only after extensive training beyond the point of overfitting. The study reveals varying levels of generalization across different types of reasoning tasks. When presented with out-of-distribution examples, transformers struggle to systematically generalize for composition tasks but excel in comparison tasks. The authors conduct analytical experiments throughout the training process to uncover the mechanisms behind this phenomenon. They identify the concept of "grokking," which involves forming a generalizing circuit within the transformer model. This circuit's efficiency in generalizing versus memorizing plays a crucial role in the model's ability to reason implicitly. Furthermore, the researchers explore the connection between systematicity and the configuration of the generalizing circuit within transformers. Their findings provide insights into optimizing data and training setups to enhance implicit reasoning induction and suggest potential enhancements to transformer architecture by promoting cross-layer knowledge sharing. In a challenging reasoning task with a large search space, comparisons are drawn between GPT-4-Turbo and Gemini-1.5-Pro models based on non-parametric memory versus fully grokked transformers. The results demonstrate that non-parametric memory-based models struggle significantly regardless of prompting styles or retrieval augmentation techniques. In contrast, fully grokked transformers showcase near-perfect accuracy in complex reasoning tasks, highlighting the power of parametric memory for advanced reasoning capabilities. Overall, this study sheds light on how transformers can learn implicit reasoning through grokking and provides valuable insights for improving transformer architectures for complex reasoning tasks. The authors' detailed analysis and experimental findings contribute to advancing our understanding of implicit reasoning mechanisms in language models.
