Provable In-Context Learning of Nonlinear Regression with Transformers
Not on the map. Why?
Abstract (arXiv)
The transformer architecture, which processes sequences of input tokens to produce outputs for query tokens, has revolutionized numerous areas of machine learning. A defining feature of transformers is their ability to perform previously unseen tasks using task specific prompts without updating parameters, a phenomenon known as in-context learning (ICL). Recent research has actively explored the training dynamics behind ICL, with much of the focus on relatively simple tasks such as linear regression and binary classification. To advance the theoretical understanding of ICL, this paper investigates more complex nonlinear regression tasks, aiming to uncover how transformers acquire in-context learning capabilities in these settings. We analyze the stage-wise dynamics of attention during training: attention scores between a query token and its target features grow rapidly in the early phase, then gradually converge to one, while attention to irrelevant features decays more slowly and exhibits oscillatory behavior. Our analysis introduces new proof techniques that explicitly characterize how the nature of general non-degenerate L-Lipschitz task functions affects attention weights. Specifically, we identify that the Lipschitz constant L of nonlinear function classes as a key factor governing the convergence dynamics of transformers in ICL. Leveraging these insights, for two distinct regimes depending on whether L is below or above a threshold, we derive different time bounds to guarantee near-zero prediction error. Notably, despite the convergence time depending on the underlying task functions, we prove that query tokens consistently attend to prompt tokens with highly relevant features at convergence, demonstrating the ICL capability of transformers for unseen functions.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 41 of its 46 references that are in the map. First posted on arXiv 28 Jul 2025.
Builds on
41 of 46 references.
References · 41
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 2022Transformers learn in-context by gradient descentcited by 732
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
- 2020A Survey on Visual Transformercited by 654
- 2023Trained Transformers Learn Linear Models In-Contextcited by 337
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
- 2018Towards a Definition of Disentangled Representationscited by 296
- 2024Long-context LLMs Struggle with Long In-context Learningcited by 286
- 2024Many-Shot In-Context Learningcited by 206
29 more
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
- 2022Self-Adaptive In-Context Learning: An Information Compression Perspective for In-Context Example Selection and Orderingcited by 161
- 2023Birth of a Transformer: A Memory Viewpointcited by 161
- 2021AMMUS : A Survey of Transformer-based Pretrained Models in Natural Language Processingcited by 131
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 118
- 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 118
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
- 2023In-Context Convergence of Transformerscited by 115
- 2022Disentangled Representation Learningcited by 112
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 86
- 2024Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimalitycited by 74
- 2023Battle of the Backbones: A Large-Scale Comparison of Pretrained Models across Computer Vision Taskscited by 72
- 2023Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Contextcited by 63
- 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 57
- 2024Asymptotic theory of in-context learning by linear attentioncited by 55
- 2023A Review of Deep Learning Techniques for Speech Processingcited by 52
- 2024ICLR: In-Context Learning of Representationscited by 50
- 2024Dual Operating Modes of In-Context Learningcited by 43
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 40
- 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chainscited by 40
- 2023Transformers in Speech Processing: A Surveycited by 39
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 38
- 2024How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?cited by 35
- 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 31
- 2024Transformers on Markov Data: Constant Depth Sufficescited by 27
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2023Towards Understanding How Transformers Learn In-context Through a Representation Learning Lenscited by 15
- 2024Local to Global: Learning Dynamics and Effect of Initialization for Transformerscited by 11
Built on by
Citing papers per year: 2025: 1; 2026: 3.
4 papers.
- 2026Bayesian Optimality of In-Context Learning with Selective State Spacescited by 1
- 2026Why LLMs Fail at Causal Discovery and How Interventional Agents Escapecited by 1
- 2025To Theoretically Understand Transformer-Based In-Context Learning for Optimizing CSMAcited by 0
- 2026Demonstrations, CoT, and Prompting: A Theoretical Analysis of ICLcited by 0
- 2026Why LLMs Fail at Causal Discovery and How Interventional Agents Escape26 May 2026
- 2026Demonstrations, CoT, and Prompting: A Theoretical Analysis of ICL20 Mar 2026
- 2026Bayesian Optimality of In-Context Learning with Selective State Spaces19 Feb 2026
- 2025To Theoretically Understand Transformer-Based In-Context Learning for Optimizing CSMA31 Jul 2025