mlsanityData to 7 Oct 2026

On Mesa-Optimization in Autoregressively Trained Transformers: Emergence and Capability

arXiv 2405.16845 ↗First posted 27 May 2024cs.LG cs.CL stat.MLcited by 5

Not on the map. Why?

Abstract (arXiv)

Autoregressively trained transformers have brought a profound revolution to the world, especially with their in-context learning (ICL) ability to address downstream tasks. Recently, several studies suggest that transformers learn a mesa-optimizer during autoregressive (AR) pretraining to implement ICL. Namely, the forward pass of the trained transformer is equivalent to optimizing an inner objective function in-context. However, whether the practical non-convex training dynamics will converge to the ideal mesa-optimizer is still unclear. Towards filling this gap, we investigate the non-convex dynamics of a one-layer linear causal self-attention model autoregressively trained by gradient flow, where the sequences are generated by an AR process xt+1 = W xt. First, under a certain condition of data distribution, we prove that an autoregressively trained transformer learns W by implementing one step of gradient descent to minimize an ordinary least squares (OLS) problem in-context. It then applies the learned widehatW for next-token prediction, thereby verifying the mesa-optimization hypothesis. Next, under the same data conditions, we explore the capability limitations of the obtained mesa-optimizer. We show that a stronger assumption related to the moments of data is the sufficient and necessary condition that the learned mesa-optimizer recovers the distribution. Besides, we conduct exploratory analyses beyond the first data condition and prove that generally, the trained transformer will not perform vanilla gradient descent for the OLS problem. Finally, our simulation results verify the theoretical results.

Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 50 of its 63 references that are in the map. First posted on arXiv 27 May 2024.

Builds on

50 of 63 references.

References · 50

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  4. 2023Visual Instruction Tuningcited by 7,792
  5. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
  6. 2021Zero-Shot Text-to-Image Generationcited by 4,276
  7. 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,175
  8. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
  9. 2024Visual Autoregressive Modeling: Scalable Image Generation via Next-Scale Predictioncited by 1,005
  10. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
  11. 2013Exact solutions to the nonlinear dynamics of learning in deep linear neural networkscited by 748
  12. 2022Transformers learn in-context by gradient descentcited by 714
38 more
  1. 2022Autoregressive Image Generation using Residual Quantizationcited by 706
  2. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
  3. 2023The Dawn of LMMs: Preliminary Explorations with GPT-4V(ision)cited by 677
  4. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  5. 2016Linear Convergence of Gradient and Proximal-Gradient Methods Under the Polyak-Lojasiewicz Conditioncited by 526
  6. 2023VisionLLM: Large Language Model is also an Open-Ended Decoder for Vision-Centric Taskscited by 499
  7. 2019Implicit Regularization in Deep Matrix Factorizationcited by 402
  8. 2021Transformers Can Do Bayesian Inferencecited by 338
  9. 2023Trained Transformers Learn Linear Models In-Contextcited by 331
  10. 2018Adversarially Robust Generalization Requires More Datacited by 318
  11. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 303
  12. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
  13. 2019Risks from Learned Optimization in Advanced Machine Learning Systemscited by 250
  14. 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
  15. 2024AnyGPT: Unified Multimodal LLM with Discrete Sequence Modelingcited by 213
  16. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
  17. 2023The Learnability of In-Context Learningcited by 126
  18. 2024How Transformers Learn Causal Structure with Gradient Descentcited by 114
  19. 2023In-Context Convergence of Transformerscited by 112
  20. 2023Linear attention is (maybe) all you need (to understand transformer optimization)cited by 97
  21. 2023Uncovering mesa-optimization algorithms in Transformerscited by 94
  22. 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
  23. 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 85
  24. 2024Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimalitycited by 71
  25. 2023Understanding In-Context Learning in Transformers and LLMs by Learning to Learn Discrete Functionscited by 62
  26. 2023Learning Mixtures of Gaussians Using the DDPM Objectivecited by 56
  27. 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 43
  28. 2023On the Optimization and Generalization of Multi-head Attentioncited by 37
  29. 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
  30. 2024In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initializationcited by 30
  31. 2023Revisiting Discriminative vs. Generative Classifiers: Theory and Implicationscited by 29
  32. 2024Linear Transformers are Versatile In-Context Learnerscited by 28
  33. 2023A Closer Look at In-Context Learning under Distribution Shiftscited by 25
  34. 2023Toward Understanding Generative Data Augmentationcited by 25
  35. 2024How Well Can Transformers Emulate In-context Newton's Method?cited by 23
  36. 2024Superiority of Multi-Head Attention in In-Context Linear Regressioncited by 17
  37. 2024How do Transformers perform In-Context Autoregressive Learning?cited by 16
  38. 2021Information-Theoretic Characterization of the Generalization Error for Iterative Semi-Supervised Learningcited by 11

Built on by

Cited by year

Citing papers per year: 2024: 1; 2025: 4.

5 papers.