mlsanityData to 7 Oct 2026

Physics of Language Models: Part 1, Learning Hierarchical Language Structures

arXiv 2305.13673 ↗First posted 23 May 2023cs.CL cs.AI cs.LGcited by 83

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

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  2. 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
  3. 2020DeBERTa: Decoding-enhanced BERT with Disentangled Attentioncited by 2,157
  4. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,130
  5. 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
  6. 2022In-context Learning and Induction Headscited by 930
  7. 2023Progress measures for grokking via mechanistic interpretabilitycited by 822
  8. 2018A Convergence Theory for Deep Learning via Over-Parameterizationcited by 784
  9. 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
  10. 2022Neural Networks and the Chomsky Hierarchycited by 214
  11. 2020An Empirical Study on Robustness to Spurious Correlations using Pre-trained Language Modelscited by 133
  12. 2020Perturbed Masking: Parameter-free Probing for Analyzing and Interpreting BERTcited by 109
9 more
  1. 2021Evaluating the Robustness of Neural Language Models to Input Perturbationscited by 87
  2. 2023Do Transformers Parse while Predicting the Masked Word?cited by 48
  3. 2022Characterizing Intrinsic Compositionality in Transformers with Tree Projectionscited by 40
  4. 2021Do Syntactic Probes Probe Syntax? Experiments with Jabberwocky Probingcited by 28
  5. 2017Do GANs actually learn the distribution? An empirical studycited by 23
  6. 2020Parsing as Pretrainingcited by 19
  7. 2021Learning Hierarchical Structures with Differentiable Nondeterministic Stackscited by 16
  8. 2022Probing for Constituency Structure in Neural Language Modelscited by 13
  9. 2021Learning Bounded Context-Free-Grammar via LSTM and the Transformer:Difference and Explanationscited by 7

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2023: 3; 2024: 16; 2025: 36; 2026: 28.

83 papers.

Sort:

By area:

  1. 2023Physics of Language Models: Part 3.1, Knowledge Storage and Extractioncited by 264
  2. 2023Physics of Language Models: Part 3.2, Knowledge Manipulationcited by 142
  3. 2024Physics of Language Models: Part 3.3, Knowledge Capacity Scaling Lawscited by 137
  4. 2023Mechanistically analyzing the effects of fine-tuning on procedurally defined taskscited by 110
  5. 2024Physics of Language Models: Part 2.1, Grade-School Math and the Hidden Reasoning Processcited by 107
  6. 2025Projecting Assumptions: The Duality Between Sparse Autoencoders and Concept Geometrycited by 58
  7. 2024What Makes and Breaks Safety Fine-tuning? A Mechanistic Studycited by 54
  8. 2025How Linguistics Learned to Stop Worrying and Love the Language Modelscited by 50
  9. 2024Physics of Language Models: Part 2.2, How to Learn From Mistakes on Grade-School Math Problemscited by 49
  10. 2024ICLR: In-Context Learning of Representationscited by 49
  11. 2024Theoretical limitations of multi-layer Transformercited by 43
  12. 2024Causal Language Modeling Can Elicit Search and Reasoning Capabilities on Logic Puzzlescited by 35
38 more
  1. 2025Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layerscited by 32
  2. 2024A Percolation Model of Emergence: Analyzing Transformers Trained on a Formal Languagecited by 26
  3. 2025How Is LLM Reasoning Distracted by Irrelevant Context? An Analysis Using a Controlled Benchmarkcited by 26
  4. 2024Understanding the Expressive Power and Mechanisms of Transformer for Sequence Modelingcited by 25
  5. 2024Learning Syntax Without Planting Trees: Understanding Hierarchical Generalization in Transformerscited by 24
  6. 2024Language Models as Models of Languagecited by 24
  7. 2026Locate, Steer, and Improve: A Practical Survey of Actionable Mechanistic Interpretability in Large Language Modelscited by 22
  8. 2025ModernVBERT: Towards Smaller Visual Document Retrieverscited by 19
  9. 2026Deriving Neural Scaling Laws from the statistics of natural languagecited by 18
  10. 2025Learning curves theory for hierarchically compositional data with power-law distributed featurescited by 17
  11. 2024Analyzing (In)Abilities of SAEs via Formal Languagescited by 16
  12. 2024Progressive distillation induces an implicit curriculumcited by 15
  13. 2025Mechanistic Interpretability as Statistical Estimation: A Variance Analysiscited by 14
  14. 2025Language Generation and Identification From Partial Enumeration: Tight Density Bounds and Topological Characterizationscited by 13
  15. 2024On the Role of Depth and Looping for In-Context Learning with Task Diversitycited by 11
  16. 2025The Strawberry Problem: Emergence of Character-level Understanding in Tokenized Language Modelscited by 11
  17. 2025The Dead Salmons of AI Interpretabilitycited by 10
  18. 2025Mechanistic evaluation of Transformers and state space modelscited by 8
  19. 2025Behavior Injection: Preparing Language Models for Reinforcement Learningcited by 8
  20. 2025A Statistical Physics of Language Model Reasoningcited by 7
  21. 2025Towards Universal Offline Black-Box Optimization via Learning Language Model Embeddingscited by 6
  22. 2025Understanding and Enhancing the Planning Capability of Language Models via Multi-Token Predictioncited by 6
  23. 2025Scaling Laws and Representation Learning in Simple Hierarchical Languages: Transformers vs. Convolutional Architecturescited by 5
  24. 2026Provable Learning of Random Hierarchy Models and Hierarchical Shallow-to-Deep Chainingcited by 5
  25. 2025Unraveling Syntax: Language Modeling and the Substructure of Grammarscited by 4
  26. 2026Deep networks learn to parse uniform-depth context-free languages from local statisticscited by 4
  27. 2024Unlocking the Theory Behind Scaling 1-Bit Neural Networkscited by 3
  28. 2024Sneaking Syntax into Transformer Language Models with Tree Regularizationcited by 3
  29. 2025On the Emergence of Induction Heads for In-Context Learningcited by 3
  30. 2026Context-Free Recognition with Transformerscited by 3
  31. 2026Biased Generalization in Diffusion Modelscited by 3
  32. 2026The Topological Trouble With Transformerscited by 3
  33. 2025TinySQL: A Progressive Text-to-SQL Dataset for Mechanistic Interpretability Researchcited by 2
  34. 2025CASCADE Your Datasets for Cross-Mode Knowledge Retrieval of Language Modelscited by 2
  35. 2025When Does Metadata Conditioning (NOT) Work for Language Model Pre-Training? A Study with Context-Free Grammarscited by 2
  36. 2025RetrySQL: text-to-SQL training with retry data for self-correcting query generationcited by 2
  37. 2025Teaching Transformers to Solve Combinatorial Problems through Efficient Trial & Errorcited by 2
  38. 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)