Scaling Laws and Representation Learning in Simple Hierarchical Languages: Transformers vs. Convolutional Architectures
Francesco Cagnetta, Alessandro Favero, Antonio Sclocchi, Matthieu Wyart
TL;DR
The paper tackles how neural language models learn hierarchical structure and scaling laws when trained for next-token prediction on data generated by the Random Hierarchy Model (RHM), a tractable ensemble of probabilistic context-free grammars. It develops a correlation-based theory of representation learning and contrasts convolutional networks with locality/weight sharing against transformers with global self-attention, predicting faster, structure-aligned scaling for CNNs. The authors derive and validate power-law scaling relations for the excess test loss under online training, linking them to the ability to reconstruct latent hierarchies via token correlations and to translation-invariant architectural priors. This work elucidates how architectural biases interact with data statistics to shape neural scaling laws, with implications for designing models that efficiently learn compositional structure in hierarchical data and for understanding when attention-based models offer advantages beyond generic sequence modeling.
Abstract
How do neural language models acquire a language's structure when trained for next-token prediction? We address this question by deriving theoretical scaling laws for neural network performance on synthetic datasets generated by the Random Hierarchy Model (RHM) -- an ensemble of probabilistic context-free grammars designed to capture the hierarchical structure of natural language while remaining analytically tractable. Previously, we developed a theory of representation learning based on data correlations that explains how deep learning models capture the hierarchical structure of the data sequentially, one layer at a time. Here, we extend our theoretical framework to account for architectural differences. In particular, we predict and empirically validate that convolutional networks, whose structure aligns with that of the generative process through locality and weight sharing, enjoy a faster scaling of performance compared to transformer models, which rely on global self-attention mechanisms. This finding clarifies the architectural biases underlying neural scaling laws and highlights how representation learning is shaped by the interaction between model architecture and the statistical properties of data.
