Redirecting to original paper in 30 seconds...
Click below to go immediately or wait for automatic redirect
📄 Abstract
Abstract: Transformers exhibit compositional reasoning on sequences not observed during
training, a capability often attributed to in-context learning (ICL) and skill
composition. We investigate this phenomenon using the Random Hierarchy Model
(RHM), a probabilistic context-free grammar that generates sequences through
recursive rule application. Models are trained on subsets of sequences and
evaluated across four generalization conditions: memorization, in-distribution
generalization, out-of-distribution generalization with the same rules, and
cross-layer transfer. Behaviorally, performance improves systematically with
task complexity and the number of in-context examples, with out-of-distribution
tasks requiring substantially more examples than in-distribution scenarios.
Mechanistically, we identify a progressive emergence of layer specialization
during training that correlates with generalization performance. Principal
component analysis and attention pattern clustering reveal that transformers
develop structured, hierarchically organized representations in specialized
layers. These results demonstrate that transformers develop modular,
interpretable mechanisms supporting compositional reasoning, linking internal
algorithmic structure to observed behavioral capabilities.
Submitted
October 20, 2025
Key Contributions
This paper investigates compositional reasoning in Transformers using the Random Hierarchy Model (RHM) and identifies a progressive emergence of layer specialization during training that correlates with generalization performance. It demonstrates that OOD tasks require substantially more examples than in-distribution tasks and analyzes attention patterns to understand these mechanisms.
Business Value
Provides deeper insights into the internal workings of Transformers, enabling the development of more robust and generalizable models for complex reasoning tasks.