TL;DR
When faced with compositional tasks, Transformers can either learn the underlying rules (reasoning) or simply memorize input-output mappings. This paper reveals that the scale of parameter initialization dictates which path the model takes: small initializations force the model to learn generalizable reasoning steps, while large initializations lead to brittle memorization. The authors propose a simple, tunable hyperparameter ($\gamma$) to control this initialization scale and optimize models for either logic or memory.
What Problem Does This Paper Address?
Large Language Models (LLMs) show incredible capabilities, but their performance on compositional tasks—problems that require combining multiple simpler rules or steps—remains a major weakness. When a Transformer fails to generalize to an out-of-distribution (OOD) compositional task, it raises a fundamental question: did the model ever actually learn the underlying "primitives" (the basic rules), or did it just memorize the training data's input-output mappings?
More importantly, the authors want to know what causes a model to choose reasoning over memorization. Understanding this mechanism is critical for training models that can reliably perform multi-step logic, coding, and math, rather than just pattern-matching.
Methods
To study this mechanistically, the authors use a controlled synthetic framework called Anchor Functions.
- The Setup: The model is fed sequences containing a "key item" (a number) and an "anchor pair" (two tokens representing specific arithmetic operations, like "+5" and "x2"). The target output is the result of applying both operations sequentially to the key item.
- The Test: The model is trained on most anchor pairs but tested on an unseen pair. The researchers observe whether the model outputs the correct mathematical result (inferential/reasoning solution) or if it just copies the output of a similar, memorized pair (symmetric/memory-based solution).
- Mechanistic Interpretability: The authors analyze the model's internal attention matrices (information flow), vector representations (cosine similarity), and weight matrices to see how the model computes its answers.
- The Hyperparameter ($\gamma$): They formalize initialization scale using a rate $\gamma$, where the standard deviation of a layer's initial weights is set to $1/d_{\mathrm{in}}^\gamma$ ($d_{\mathrm{in}}$ being the number of input neurons). A larger $\gamma$ means a smaller initialization scale.
Datasets
The authors validate their findings across a spectrum of synthetic and real-world datasets:
- Anchor Functions: A custom synthetic dataset for controlled mechanistic experiments.
- SCAN & COGS: Classic compositional generalization benchmarks testing command execution and semantic parsing.
- PrOntoQA: A synthetic multi-step logical reasoning dataset.
- Addition Task: A case-based reasoning intervention to test rule generalization in math.
- SlimPajama: A massive real-world text dataset (specifically GitHub and Wikipedia subsets) used to train GPT-2 models to evaluate language modeling perplexity.
Key Insights and Ideas
- Two Distinct Phases of Learning: The model's solution type undergoes a phase transition based on initialization. Small initializations (large $\gamma$) lead to inferential reasoning. Large initializations (small $\gamma$) lead to memorization.
- Information Flow is Fundamentally Different:
- In memorizing models, the attention mechanism immediately fuses the two anchor tokens together and maps them directly to an output, ignoring the individual mathematical operations.
- In reasoning models, the attention mechanism routes the key item to each anchor separately, computes the intermediate steps, and then combines them. It actually learns the primitives.
- The "Low Complexity" Bias: Why does small initialization cause reasoning? Small initializations start the model with very low complexity. To fit the training data efficiently without exploding its complexity, the model is forced to find the underlying rules (which requires fewer parameters to represent). The authors proved this by showing that small-init models have highly condensed weight matrices and highly structured, ordinal word embeddings.
- Large Init = Lazy Memorization: Large initializations start the model with high complexity. The model already has enough capacity to just memorize the training data lazily, so it never bothers to learn the underlying compositional rules.
Key Results
- Phase Diagram: Across hundreds of runs, models with small initializations consistently achieved near 100% accuracy on unseen compositional tasks (reasoning), while large initializations achieved 0% on reasoning but near 100% on memorized symmetric mappings.
- Real-World Generalization: On the COGS and SCAN datasets, models trained with small initialization and large weight decay dramatically outperformed standard models on out-of-distribution generalization.
- Faster Convergence on Reasoning: On the PrOntoQA logic dataset, large-init models got stuck trying to memorize data as the dataset grew, slowing down training. Small-init models naturally preferred reasoning, leading to faster convergence and higher accuracy.
- Better Code/Text Generation: GPT-2 Medium models trained on SlimPajama (GitHub and Wikipedia) achieved consistently lower perplexity when initialized with smaller scales, proving this isn't just a synthetic phenomenon.
Limitations and Future Work
- Limitations: The deepest mechanistic analyses (like tracking exact attention flows and embedding eigenvalues) were performed on simplified, single-head models using synthetic data. While the performance trends held up in GPT-2 on real data, the exact internal mechanisms in massive, real-world LLMs might be messier.
- Future Work: The authors suggest adapting initialization scales based on the specific task. For example, using larger scales for tasks requiring pure memorization (like factual recall) and smaller scales for reasoning tasks (like code generation). They also propose exploring Mixture of Experts (MoEs) where different expert networks are initialized with different scales to handle different types of cognitive loads.
Summary updated