Lune

ICML2024Top-tier venue

Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscape

Juno Kim, Taiji Suzuki

Abstract

Large language models based on the Transformer architecture have demonstrated impressive capabilities to learn in context. However, existing theoretical studies on how this phenomenon arises are limited to the dynamics of a single layer of attention trained on linear regression tasks. In this paper, we study the optimization of a Transformer consisting of a fully connected layer followed by a linear attention layer. The MLP acts as a common nonlinear representation or feature map, greatly enhancing the power of in-context learning. We prove in the mean-field and two-timescale limit that the infinite-dimensional loss landscape for the distribution of parameters, while highly nonconvex, becomes quite benign. We also analyze the second-order stability of mean-field dynamics and show that Wasserstein gradient flow almost always avoids saddle points. Furthermore, we establish novel methods for obtaining concrete improvement rates both away from and near critical points. This represents the first saddle point analysis of mean-field dynamics in general and the techniques are of independent interest.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

34 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in Transformers cites Transformers Learn In-Context by Gradient Descent
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites Transformers Learn In-Context by Gradient Descent
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Non-asymptotic Convergence of Training Transformers for Next-token Prediction cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Non-asymptotic Convergence of Training Transformers for Next-token Prediction cites Transformers Learn In-Context by Gradient Descent
  • Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannot cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannot cites Transformers Learn In-Context by Gradient Descent
  • Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets Cannot cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Transformers are Minimax Optimal Nonparametric In-Context Learners cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Transformers are Minimax Optimal Nonparametric In-Context Learners cites Transformers Learn In-Context by Gradient Descent
  • Transformers are Minimax Optimal Nonparametric In-Context Learners cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • In-Context Learning with Representations: Contextual Generalization of Trained Transformers cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • In-Context Learning with Representations: Contextual Generalization of Trained Transformers cites Transformers Learn In-Context by Gradient Descent
  • In-Context Learning with Representations: Contextual Generalization of Trained Transformers cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Gated Linear Attention Transformers with Hardware-Efficient Training cites Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention
  • Transformers Learn In-Context by Gradient Descent cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers34

  1. Unveiling Induction Heads: Provable Training Dynamics and Feature Learning in TransformersSiyu Chen, Heejune Sheen, Tianhao Wang, Zhuoran YangNeurIPS 2024 · 48 citations
  2. In-Context Learning with Representations: Contextual Generalization of Trained TransformersTong Yang, Yu Huang, Yingbin Liang, Yuejie ChiNeurIPS 2024 · 45 citations
  3. Transformers are Minimax Optimal Nonparametric In-Context LearnersJuno Kim, Tai Nakamaki, Taiji SuzukiNeurIPS 2024 · 42 citations
  4. Transformers Provably Learn Sparse Token Selection While Fully-Connected Nets CannotZixuan Wang, Stanley Wei, Daniel Hsu, Jason D. LeeICML 2024 · 22 citations
  5. Non-asymptotic Convergence of Training Transformers for Next-token PredictionRuiquan Huang, Yingbin Liang, Jing YangNeurIPS 2024 · 15 citations

Builds on18

  1. Transformers are RNNs: Fast Autoregressive Transformers with Linear AttentionAngelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François FleuretICML 2020 · 2,665 citations
  2. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
  3. Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
  4. Gated Linear Attention Transformers with Hardware-Efficient TrainingSonglin Yang, Bailin Wang, Yikang Shen, Rameswar Panda et al.ICML 2024 · 390 citations
  5. Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm SelectionYu Bai, Fan Chen, Huan Wang, Caiming Xiong et al.NeurIPS 2023 · 356 citations

Related papers

  1. Global Convergence in Training Large-Scale TransformersCheng Gao, Yuan Cao, Zihao Li, Yihan He et al.NeurIPS 2024 · 10 citations
  2. On Mesa-Optimization in Autoregressively Trained Transformers: Emergence and CapabilityChenyu Zheng, Wei Huang, Rongzhen Wang, Guoqiang Wu et al.NeurIPS 2024 · 10 citations
  3. How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?Hongkang Li, Meng Wang, Songtao Lu, Xiaodong Cui et al.ICML 2024 · 37 citations
  4. Perceptrons and Localization of Attention’s Mean-Field LandscapeAntonio Álvarez López, Borjan Geshkovski, Domènec Ruiz-BaletICML 2026 · 7 citations
  5. Optimality and NP-Hardness of Transformers in Learning Markovian Dynamical FunctionsYanna Ding, Songtao Lu, Yingdong Lu, Tomasz Nowicki et al.NeurIPS 2025 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines