[2402.01258] Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscape
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.
Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscape Juno Kim 1 2 Taiji Suzuki 1 2 Abstract previously unseen tasks based on demonstrative example prompts without further…
saved by
related reading
- [2505.02621] Mirror Mean-Field Langevin Dynamicsarxiv.org
- [2205.09653] Self-Consistent Dynamical Field Theory of Kernel Evolution in Wide Neural Networksarxiv.org
- A Mathematical Framework for Transformer Circuitstransformer-circuits.pub
- [2212.07677] Transformers learn in-context by gradient descentarxiv.org
- In-context Learning and Induction Headstransformer-circuits.pub
- NL.pdfabehrouz.github.io
- transformer_attention.pdfarxiv.org
- What Can Transformers Learn In-Context?arxiv.org
- [2605.01172] A Theory of Generalization in Deep Learningarxiv.org
- Uncovering mesa-optimization algorithms in Transformersarxiv.org
- Learning without training: The implicit dynamics of in-context learningarxiv.org
- Pretraining Data Mixtures Enable Narrow Model Selection Capabilities in Transformer Modelsarxiv.org