Abstract
Researchers have mathematically proven that Transformers follow a distinct two-stage training process: they first master "elementary" knowledge (like syntax) before moving on to "specialized" knowledge (like semantics). This study provides the first rigorous theoretical framework for this phenomenon and reveals that these different types of knowledge are stored in the spectral properties (eigenvalues) of the model's attention weights.
Introduction
When training large language models (LLMs), researchers often observe a curious progression: a model might first learn to generate grammatically perfect but factually nonsensical sentences before eventually "clicking" and providing correct answers. While this "elementary-then-specialized" learning is common in practice, a solid mathematical explanation for why it happens at the feature level has been lacking. This paper bridges that gap by proving how Transformers disentangle and learn these different feature structures over time.
Theoretical Framework: Feature Disentanglement
The authors tackle this by creating a simplified but illustrative theoretical model. They propose that data consists of two primary parts:
- Elementary Component ($P$): Linearly separable features representing simple rules or syntax.
- Specialized Component ($Q$): Non-linear features that are harder to learn, representing complex facts or semantics.
The analysis focuses on a one-layer Transformer using a normalized ReLU self-attention mechanism. By using a signal-noise decomposition technique, the researchers can track how weights move toward solutions for both $P$ and $Q$ components during training.
The Two-Stage Learning Process
The core finding of the paper is the "Elementary-then-Specialized" principle. The model does not learn everything at once. Instead, training is characterized by two distinct stages:
- Elementary Stage: The model rapidly masters linear features. During this phase, the loss associated with syntax drops significantly, while the weights for specialized knowledge remain nearly stagnant.
- Specialized Stage: Only after the elementary stage does the model "unlock" and begin to master the non-linear, specialized features.
While varying feature complexity is the primary driver, the authors note that an annealing learning rate acts as a lens that makes these stages clearly visible in the training loss curve.
Spectral Properties of Knowledge
A striking insight from the study is the discovery of a spectral link within the model's weights. The researchers found that knowledge is spectrally separated:
- Small eigenvalues of the attention weights store elementary/syntactic knowledge.
- Large eigenvalues store specialized/semantic knowledge.
This discovery has practical implications for model editing. Using Singular Value Decomposition (SVD), it is possible to "edit" a model by targeting specific eigenvalues. Removing large eigenvalues can eliminate a model's ability to provide correct facts while leaving its grammatical structure intact.
Empirical Validation
The paper provides rigorous theorems (Theorems 2–5) showing that in Stage 1, the loss for elementary features drops to near zero while specialized loss stays high. These mathematical proofs were validated using three types of data: synthetic data matching the $P$ and $Q$ abstraction, the Counterfact dataset (knowledge tuples used to fine-tune GPT-2), and HotpotQA (a multi-hop question-answering benchmark).
Key results include:
- Syntax Mastery: On the Counterfact dataset, syntactically incorrect predictions dropped from 1,630 to zero by the 5th epoch, even before semantic mastery.
- Spectral Evidence: Experiments demonstrated that semantic accuracy increases as more large eigenvalues are preserved, whereas syntax is grasped even with very few, small eigenvalues.
Conclusion and Future Work
This research provides a rigorous theoretical foundation for the observed stages of Transformer training. By demonstrating that syntax and semantics are learned at different rates and stored in different spectral regions, it offers new ways to think about model training and editing. Future work may extend this analysis to deeper networks and explore how these stages interact across multiple layers.
Summary updated