[Paper Review] Progress measures for grokking via mechanistic interpretability
The paper reverse engineers small transformers solving modular addition to reveal a Fourier-based algorithm, and defines progress measures (restricted and excluded loss) to show grokking arises from gradual circuit formation followed by weight decay removing memorization.
Neural networks often exhibit emergent behavior, where qualitatively new capabilities arise from scaling up the amount of parameters, training data, or training steps. One approach to understanding emergence is to find continuous extit{progress measures} that underlie the seemingly discontinuous qualitative changes. We argue that progress measures can be found via mechanistic interpretability: reverse-engineering learned behaviors into their individual components. As a case study, we investigate the recently-discovered phenomenon of ``grokking'' exhibited by small transformers trained on modular addition tasks. We fully reverse engineer the algorithm learned by these networks, which uses discrete Fourier transforms and trigonometric identities to convert addition to rotation about a circle. We confirm the algorithm by analyzing the activations and weights and by performing ablations in Fourier space. Based on this understanding, we define progress measures that allow us to study the dynamics of training and split training into three continuous phases: memorization, circuit formation, and cleanup. Our results show that grokking, rather than being a sudden shift, arises from the gradual amplification of structured mechanisms encoded in the weights, followed by the later removal of memorizing components.
Motivation & Objective
- Motivate the search for smooth, causally linked progress measures underlying emergent behaviors in neural networks.
- Demonstrate that grokking can be explained by mechanistic reverse engineering of learned circuits.
- Reverse engineer a modular addition Transformer to uncover the Fourier-multiplication algorithm.
- Define and validate continuous progress measures that prefigure the grokking phase transition.
- Characterize training dynamics as three phases: memorization, circuit formation, and cleanup.
Proposed method
- Train small Transformer models on addition mod P with P=113.
- Reverse engineer weights and activations to identify a Fourier-based addition algorithm.
- Show embeddings, attention, and MLP activations exhibit periodic structure at a set of key frequencies.
- Demonstrate that the unembedding and MLP layers realize trigonometric identities to compute a+b mod P.
- Define restricted and excluded loss as progress measures and validate them empirically.
Experimental results
Research questions
- RQ1What mechanistic structures underlie grokking in small transformers trained on modular addition?
- RQ2Can we identify a continuous, interpretable progress measure that precedes the grokking transition?
- RQ3How does the learned algorithm operate in terms of frequency components and trig identities?
- RQ4What training dynamics (phases) characterize the journey from memorization to generalization?
- RQ5What role does weight decay play in driving grokking and phase transitions?
Key findings
- The model embeds inputs onto a circle and uses Fourier components to perform addition via trig identities.
- The logit mapping W_L is well approximated by a sum of five key frequencies, enabling a Fourier-multiplication readout.
- Most neurons are well-approximated by degree-2 polynomials of a single frequency, with frequency-localized readouts to logits.
- Ablations show key frequencies are necessary; removing non-key frequencies can improve performance.
- Grokking comprises three phases—memorization, circuit formation, and cleanup—with weight decay guiding the shift to the generalizing circuit.
- The proposed progress measures (restricted loss and excluded loss) increase continuously before grokking, providing a lens into training dynamics.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.