Physics of Language Models: Part 1, Learning Hierarchical Language Structures
Not on the map. Why?
Abstract (arXiv)
Transformer-based language models are effective but complex, and understanding their inner workings and reasoning mechanisms is a significant challenge. Previous research has primarily explored how these models handle simple tasks like name copying or selection, and we extend this by investigating how these models perform recursive language structure reasoning defined by context-free grammars (CFGs). We introduce a family of synthetic CFGs that produce hierarchical rules, capable of generating lengthy sentences (e.g., hundreds of tokens) that are locally ambiguous and require dynamic programming to parse. Despite this complexity, we demonstrate that generative models like GPT can accurately learn and reason over CFG-defined hierarchies and generate sentences based on it. We explore the model's internals, revealing that its hidden states precisely capture the structure of CFGs, and its attention patterns resemble the information passing in a dynamic programming algorithm. This paper also presents several corollaries, including showing why absolute positional embeddings is inferior to relative and rotary embeddings; uniform attention alone is surprisingly effective (motivating our follow-up work on Canon layers); encoder-only models (e.g., BERT, DeBERTa) struggle with deep structure reasoning on CFGs compared to autoregressive models (e.g., GPT); and injecting structural or syntactic noise into pretraining data markedly improves robustness to corrupted language prompts.
Key facts. Cited by 83 papers in the map (data through 7 Oct 2026). Builds on 21 of its 46 references that are in the map. First posted on arXiv 23 May 2023.
Builds on
21 of 46 references.
References · 21
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2020DeBERTa: Decoding-enhanced BERT with Disentangled Attentioncited by 2,157
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2022In-context Learning and Induction Headscited by 930
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
- 2018A Convergence Theory for Deep Learning via Over-Parameterizationcited by 784
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
- 2022Neural Networks and the Chomsky Hierarchycited by 214
- 2020An Empirical Study on Robustness to Spurious Correlations using Pre-trained Language Modelscited by 133
- 2020Perturbed Masking: Parameter-free Probing for Analyzing and Interpreting BERTcited by 109
9 more
- 2021Evaluating the Robustness of Neural Language Models to Input Perturbationscited by 87
- 2023Do Transformers Parse while Predicting the Masked Word?cited by 48
- 2022Characterizing Intrinsic Compositionality in Transformers with Tree Projectionscited by 40
- 2021Do Syntactic Probes Probe Syntax? Experiments with Jabberwocky Probingcited by 28
- 2017Do GANs actually learn the distribution? An empirical studycited by 23
- 2020Parsing as Pretrainingcited by 19
- 2021Learning Hierarchical Structures with Differentiable Nondeterministic Stackscited by 16
- 2022Probing for Constituency Structure in Neural Language Modelscited by 13
- 2021Learning Bounded Context-Free-Grammar via LSTM and the Transformer:Difference and Explanationscited by 7
Built on by
Citing papers per year: 2023: 3; 2024: 16; 2025: 36; 2026: 28.
83 papers.
Sort:
By area:
- 2023Physics of Language Models: Part 3.1, Knowledge Storage and Extractioncited by 264
- 2023Physics of Language Models: Part 3.2, Knowledge Manipulationcited by 142
- 2024Physics of Language Models: Part 3.3, Knowledge Capacity Scaling Lawscited by 137
- 2023Mechanistically analyzing the effects of fine-tuning on procedurally defined taskscited by 110
- 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Processcited by 107
- 2025Projecting Assumptions: The Duality Between Sparse Autoencoders and Concept Geometrycited by 58
- 2024What Makes and Breaks Safety Fine-tuning? A Mechanistic Studycited by 54
- 2025How Linguistics Learned to Stop Worrying and Love the Language Modelscited by 50
- 2024Physics of Language Models: Part 2.2, How to Learn From Mistakes on Grade-School Math Problemscited by 49
- 2024ICLR: In-Context Learning of Representationscited by 49
- 2024Theoretical limitations of multi-layer Transformercited by 43
- 2024Causal Language Modeling Can Elicit Search and Reasoning Capabilities on Logic Puzzlescited by 35
38 more
- 2025Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layerscited by 32
- 2024A Percolation Model of Emergence: Analyzing Transformers Trained on a Formal Languagecited by 26
- 2025How Is LLM Reasoning Distracted by Irrelevant Context? An Analysis Using a Controlled Benchmarkcited by 26
- 2024Understanding the Expressive Power and Mechanisms of Transformer for Sequence Modelingcited by 25
- 2024Learning Syntax Without Planting Trees: Understanding Hierarchical Generalization in Transformerscited by 24
- 2024Language Models as Models of Languagecited by 24
- 2026Locate, Steer, and Improve: A Practical Survey of Actionable Mechanistic Interpretability in Large Language Modelscited by 22
- 2025ModernVBERT: Towards Smaller Visual Document Retrieverscited by 19
- 2026Deriving Neural Scaling Laws from the statistics of natural languagecited by 18
- 2025Learning curves theory for hierarchically compositional data with power-law distributed featurescited by 17
- 2024Analyzing (In)Abilities of SAEs via Formal Languagescited by 16
- 2024Progressive distillation induces an implicit curriculumcited by 15
- 2025Mechanistic Interpretability as Statistical Estimation: A Variance Analysiscited by 14
- 2025Language Generation and Identification From Partial Enumeration: Tight Density Bounds and Topological Characterizationscited by 13
- 2024On the Role of Depth and Looping for In-Context Learning with Task Diversitycited by 11
- 2025The Strawberry Problem: Emergence of Character-level Understanding in Tokenized Language Modelscited by 11
- 2025The Dead Salmons of AI Interpretabilitycited by 10
- 2025Mechanistic evaluation of Transformers and state space modelscited by 8
- 2025Behavior Injection: Preparing Language Models for Reinforcement Learningcited by 8
- 2025A Statistical Physics of Language Model Reasoningcited by 7
- 2025Towards Universal Offline Black-Box Optimization via Learning Language Model Embeddingscited by 6
- 2025Understanding and Enhancing the Planning Capability of Language Models via Multi-Token Predictioncited by 6
- 2025Scaling Laws and Representation Learning in Simple Hierarchical Languages: Transformers vs. Convolutional Architecturescited by 5
- 2026Provable Learning of Random Hierarchy Models and Hierarchical Shallow-to-Deep Chainingcited by 5
- 2025Unraveling Syntax: Language Modeling and the Substructure of Grammarscited by 4
- 2026Deep networks learn to parse uniform-depth context-free languages from local statisticscited by 4
- 2024Unlocking the Theory Behind Scaling 1-Bit Neural Networkscited by 3
- 2024Sneaking Syntax into Transformer Language Models with Tree Regularizationcited by 3
- 2025On the Emergence of Induction Heads for In-Context Learningcited by 3
- 2026Context-Free Recognition with Transformerscited by 3
- 2026Biased Generalization in Diffusion Modelscited by 3
- 2026The Topological Trouble With Transformerscited by 3
- 2025TinySQL: A Progressive Text-to-SQL Dataset for Mechanistic Interpretability Researchcited by 2
- 2025CASCADE Your Datasets for Cross-Mode Knowledge Retrieval of Language Modelscited by 2
- 2025When Does Metadata Conditioning (NOT) Work for Language Model Pre-Training? A Study with Context-Free Grammarscited by 2
- 2025RetrySQL: text-to-SQL training with retry data for self-correcting query generationcited by 2
- 2025Teaching Transformers to Solve Combinatorial Problems through Efficient Trial & Errorcited by 2
- 2026Reasoning Core: A Scalable Procedural Data Generation Suite for Symbolic Pre-training and Post-Trainingcited by 2
50 most cited of 83 All 83 (JSON)
- 2026Synthetic Pre-pretraining Survives Scale, but Not as a Grammatical Prior30 Sep 2026
- 2026Reasoning Core: Designing Broad Procedural Data for Completion-Supervised Reasoning Training5 Aug 2026
- 2026Smooth Scaling Laws Hide Stepwise Token Learning29 Jun 2026
- 2026Structure Before Collapse: Transient semantic geometry in next-token prediction25 Jun 2026
- 2026Critical Percolation as a Synthetic Data Model for Interpretability18 Jun 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Analyzing the Correlation Between Hallucinations and Knowledge Conflicts in Large Language Models7 Jun 2026
- 2026A Systematic Study of Behavioral Cloning for Scientific Data Annotation26 May 2026
- 2026Learn from your own latents and not from tokens: A sample-complexity theory26 May 2026
- 2026Sampling Data with Chains of Forward-Backward Diffusion Steps26 May 2026
- 2026An In-Vitro Study on Cross-Lingual Generalization in Language Models26 May 2026
- 2026Model Collapse as Cultural Evolution21 May 2026
38 more
- 2026Not-So-Strange Love: Language Models and Generative Linguistic Theories are More Compatible than They Appear11 May 2026
- 2026Fine-tuning vs. In-context Learning in Large Language Models: A Formal Language Learning Perspective25 Apr 2026
- 2026Diagnosing CFG Interpretation in LLMs22 Apr 2026
- 2026The Topological Trouble With Transformers18 Apr 2026
- 2026You Can't Fight in Here! This is BBS!10 Apr 2026
- 2026Across the Levels of Analysis: Explaining Predictive Processing in Humans Requires More Than Machine-Estimated Probabilities10 Apr 2026
- 2026Biased Generalization in Diffusion Models3 Mar 2026
- 2026Reasoning Core: A Scalable Procedural Data Generation Suite for Symbolic Pre-training and Post-Training2 Mar 2026
- 2026Deriving Neural Scaling Laws from the statistics of natural language7 Feb 2026
- 2026Deep networks learn to parse uniform-depth context-free languages from local statistics31 Jan 2026
- 2026Convergent World Representations and Divergent Tasks31 Jan 2026
- 2026Provable Learning of Random Hierarchy Models and Hierarchical Shallow-to-Deep Chaining27 Jan 2026
- 2026On the Emergence and Test-Time Use of Structural Information in Large Language Models25 Jan 2026
- 2026Locate, Steer, and Improve: A Practical Survey of Actionable Mechanistic Interpretability in Large Language Models20 Jan 2026
- 2026Are Language Models Models?15 Jan 2026
- 2026Context-Free Recognition with Transformers5 Jan 2026
- 2025The Dead Salmons of AI Interpretability21 Dec 2025
- 2025Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layers19 Dec 2025
- 2025Linguists should learn to love speech-based deep learning models16 Dec 2025
- 2025Large language models are not about natural language15 Dec 2025
- 2025Large language models have learned to use language13 Dec 2025
- 2025Language models as tools for investigating the distinction between possible and impossible natural languages10 Dec 2025
- 2025Testing Transformer Learnability on the Arithmetic Sequence of Rooted Trees1 Dec 2025
- 2025Language Generation and Identification From Partial Enumeration: Tight Density Bounds and Topological Characterizations7 Nov 2025
- 2025On the Emergence of Induction Heads for In-Context Learning2 Nov 2025
- 2025Correlation Dimension of Auto-Regressive Large Language Models24 Oct 2025
- 2025Unraveling Syntax: Language Modeling and the Substructure of Grammars2 Oct 2025
- 2025ModernVBERT: Towards Smaller Visual Document Retrievers1 Oct 2025
- 2025Mechanistic Interpretability as Statistical Estimation: A Variance Analysis1 Oct 2025
- 2025An empirical study on the limitation of Transformers in program trace generation29 Sep 2025
- 2025Understanding and Enhancing the Planning Capability of Language Models via Multi-Token Prediction27 Sep 2025
- 2025Linear Causal Representation Learning by Topological Ordering, Pruning, and Disentanglement26 Sep 2025
- 2025Teaching Transformers to Solve Combinatorial Problems through Efficient Trial & Error26 Sep 2025
- 2025Binary Autoencoder for Mechanistic Interpretability of Large Language Models25 Sep 2025
- 2025Rethinking Memorization Measures and their Implications in Large Language Models20 Jul 2025
- 2025RetrySQL: text-to-SQL training with retry data for self-correcting query generation3 Jul 2025
- 2025Towards Universal Offline Black-Box Optimization via Learning Language Model Embeddings8 Jun 2025
- 2025A Statistical Physics of Language Model Reasoning4 Jun 2025
50 newest of 83 All 83 (JSON)
- 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Processcited by 107
- 2024Physics of Language Models: Part 2.2, How to Learn From Mistakes on Grade-School Math Problemscited by 49
- 2024Causal Language Modeling Can Elicit Search and Reasoning Capabilities on Logic Puzzlescited by 35
- 2025How Is LLM Reasoning Distracted by Irrelevant Context? An Analysis Using a Controlled Benchmarkcited by 26
- 2025Behavior Injection: Preparing Language Models for Reinforcement Learningcited by 8
- 2025A Statistical Physics of Language Model Reasoningcited by 7
- 2026Reasoning Core: A Scalable Procedural Data Generation Suite for Symbolic Pre-training and Post-Trainingcited by 2
- 2025Rethinking Memorization Measures and their Implications in Large Language Modelscited by 1
- 2026Reasoning Core: A Scalable Procedural Data Generation Suite for Symbolic Pre-training and Post-Training2 Mar 2026
- 2025Rethinking Memorization Measures and their Implications in Large Language Models20 Jul 2025
- 2025A Statistical Physics of Language Model Reasoning4 Jun 2025
- 2025Behavior Injection: Preparing Language Models for Reinforcement Learning25 May 2025
- 2025How Is LLM Reasoning Distracted by Irrelevant Context? An Analysis Using a Controlled Benchmark24 May 2025
- 2024Causal Language Modeling Can Elicit Search and Reasoning Capabilities on Logic Puzzles16 Sep 2024
- 2024Physics of Language Models: Part 2.2, How to Learn From Mistakes on Grade-School Math Problems29 Aug 2024
- 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Process29 Jul 2024
- 2026Diagnosing CFG Interpretation in LLMscited by 1
- 2026Diagnosing CFG Interpretation in LLMs22 Apr 2026
- 2025ModernVBERT: Towards Smaller Visual Document Retrieverscited by 19
- 2025ModernVBERT: Towards Smaller Visual Document Retrievers1 Oct 2025
- 2026Model Collapse as Cultural Evolutioncited by 1
- 2026Model Collapse as Cultural Evolution21 May 2026
- 2023Physics of Language Models: Part 3.1, Knowledge Storage and Extractioncited by 264
- 2023Physics of Language Models: Part 3.2, Knowledge Manipulationcited by 142
- 2024Physics of Language Models: Part 3.3, Knowledge Capacity Scaling Lawscited by 137
- 2023Mechanistically analyzing the effects of fine-tuning on procedurally defined taskscited by 110
- 2025Projecting Assumptions: The Duality Between Sparse Autoencoders and Concept Geometrycited by 58
- 2025How Linguistics Learned to Stop Worrying and Love the Language Modelscited by 50
- 2024ICLR: In-Context Learning of Representationscited by 49
- 2024Theoretical limitations of multi-layer Transformercited by 43
- 2025Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layerscited by 32
- 2024A Percolation Model of Emergence: Analyzing Transformers Trained on a Formal Languagecited by 26
- 2024Understanding the Expressive Power and Mechanisms of Transformer for Sequence Modelingcited by 25
- 2024Learning Syntax Without Planting Trees: Understanding Hierarchical Generalization in Transformerscited by 24
12 most cited of 65 All 65 (JSON)
- 2026Synthetic Pre-pretraining Survives Scale, but Not as a Grammatical Prior30 Sep 2026
- 2026Reasoning Core: Designing Broad Procedural Data for Completion-Supervised Reasoning Training5 Aug 2026
- 2026Smooth Scaling Laws Hide Stepwise Token Learning29 Jun 2026
- 2026Structure Before Collapse: Transient semantic geometry in next-token prediction25 Jun 2026
- 2026Critical Percolation as a Synthetic Data Model for Interpretability18 Jun 2026
- 2026An expressivity analysis of hierarchical modelling in deep transformers via bounded-depth grammars16 Jun 2026
- 2026Analyzing the Correlation Between Hallucinations and Knowledge Conflicts in Large Language Models7 Jun 2026
- 2026An In-Vitro Study on Cross-Lingual Generalization in Language Models26 May 2026
- 2026Not-So-Strange Love: Language Models and Generative Linguistic Theories are More Compatible than They Appear11 May 2026
- 2026Fine-tuning vs. In-context Learning in Large Language Models: A Formal Language Learning Perspective25 Apr 2026
- 2026The Topological Trouble With Transformers18 Apr 2026
- 2026You Can't Fight in Here! This is BBS!10 Apr 2026
12 newest of 65 All 65 (JSON)