mlsanityData to 14 Oct 2026

How Transformers Learn Regular Language Recognition: A Theoretical Study on Training Dynamics and Implicit Bias

arXiv 2505.00926 ↗First posted 2 May 2025cs.LG cs.CL stat.MLcited by 11

Not on the map. Why?

Abstract (arXiv)

Language recognition tasks are fundamental in natural language processing (NLP) and have been widely used to benchmark the performance of large language models (LLMs). These tasks also play a crucial role in explaining the working mechanisms of transformers. In this work, we focus on two representative tasks in the category of regular language recognition, known as `even pairs' and `parity check', the aim of which is to determine whether the occurrences of certain subsequences in a given sequence are even. Our goal is to explore how a one-layer transformer, consisting of an attention layer followed by a linear layer, learns to solve these tasks by theoretically analyzing its training dynamics under gradient descent. While even pairs can be solved directly by a one-layer transformer, parity check need to be solved by integrating Chain-of-Thought (CoT), either into the inference stage of a transformer well-trained for the even pairs task, or into the training of a one-layer transformer. For both problems, our analysis shows that the joint training of attention and linear layers exhibits two distinct phases. In the first phase, the attention layer grows rapidly, mapping data sequences into separable vectors. In the second phase, the attention layer becomes stable, while the linear layer grows logarithmically and approaches in direction to a max-margin hyperplane that correctly separates the attention layer outputs into positive and negative samples, and the loss decreases at a rate of O(1/t). Our experiments validate those theoretical results.

Key facts. Cited by 11 papers in the map (data through 14 Oct 2026). Builds on 45 of its 57 references that are in the map. First posted on arXiv 2 May 2025.

Builds on

45 of 57 references.

References · 45

  1. 2017Attention Is All You Needcited by 60,361
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  3. 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
  4. 2017The Implicit Bias of Gradient Descent on Separable Datacited by 655
  5. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
  6. 2019Learning Deep Transformer Models for Machine Translationcited by 309
  7. 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
  8. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
  9. 2022Neural Networks and the Chomsky Hierarchycited by 217
  10. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
  11. 2017On the Properties of the Softmax Function with Application in Game Theory and Reinforcement Learningcited by 142
  12. 2023What Formal Languages Can Transformers Express? A Surveycited by 124
33 more
  1. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
  2. 2023In-Context Convergence of Transformerscited by 115
  3. 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 113
  4. 2018Convergence of Gradient Descent on Separable Datacited by 110
  5. 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 102
  6. 2022On the Implicit Bias in Deep-Learning Algorithmscited by 86
  7. 2023A Theoretical Understanding of Shallow Vision Transformers: Learning, Generalization, and Sample Complexitycited by 77
  8. 2023Transformers as Support Vector Machinescited by 74
  9. 2024Why are Sensitive Functions Hard for Transformers?cited by 74
  10. 2024Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimalitycited by 74
  11. 2023Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Contextcited by 63
  12. 2023Max-Margin Token Selection in Attention Mechanismcited by 58
  13. 2023Transformers learn through gradual rank increasecited by 52
  14. 2023JoMA: Demystifying Multilayer Transformers via JOint Dynamics of MLP and Attentioncited by 52
  15. 2024Transformers Provably Solve Parity Efficiently with Chain of Thoughtcited by 50
  16. 2022Implicit Bias in Leaky ReLU Networks Trained on High-Dimensional Datacited by 46
  17. 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 46
  18. 2020Effects of Parameter Norm Growth During Transformer Training: Inductive Bias from Gradient Descentcited by 40
  19. 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 38
  20. 2023On the Optimization and Generalization of Multi-head Attentioncited by 37
  21. 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
  22. 2021Fast Margin Maximization via Dual Accelerationcited by 33
  23. 2024Implicit Bias and Fast Convergence Rates for Self-attentioncited by 31
  24. 2024From Sparse Dependence to Sparse Attention: Unveiling How Chain-of-Thought Enhances Transformer Sample Efficiencycited by 29
  25. 2024Provably learning a multi-head attention layercited by 21
  26. 2024Implicit Regularization of Gradient Flow on One-Layer Softmax Attentioncited by 19
  27. 2023Implicit Bias of Gradient Descent for Two-layer ReLU and Leaky ReLU Networks on Nearly-orthogonal Datacited by 18
  28. 2024Superiority of Multi-Head Attention in In-Context Linear Regressioncited by 17
  29. 2024Unveil Benign Overfitting for Transformer in Vision: Training Dynamics, Convergence, and Generalizationcited by 17
  30. 2024Training Nonlinear Transformers for Chain-of-Thought Inference: A Theoretical Generalization Analysiscited by 14
  31. 2024Non-asymptotic Convergence of Training Transformers for Next-token Predictioncited by 13
  32. 2024Benign Overfitting in Single-Head Attentioncited by 12
  33. 2024Training Dynamics of Transformers to Recognize Word Co-occurrence via Gradient Flow Analysiscited by 9

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 5; 2026: 6.

11 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Is Random Attention Sufficient for Sequence Modeling? Disentangling Trainable Components in the Transformer
  2. 2024From Attention to Activation: Unravelling the Enigmas of Large Language Models
  3. 2024On Limitation of Transformer for Learning HMMs
  4. 2026Trust, but Verify: Peeling Low-Bit Transformer Networks for Training Monitoring
  5. 2025Emergence of Minimal Circuits for Indirect Object Identification in Attention-Only Transformers
  6. 2023Jump to Conclusions: Short-Cutting Transformers With Linear Transformations
  7. 2026Transformer-Based Language Models Across Domain Verticals: Architectures, Applications and Critical Assessment
  8. 2024Towards Universality: Studying Mechanistic Similarity Across Language Model Architectures