The Closeness of In-Context Learning and Weight Shifting for Softmax Regression
Shuai Li, Zhao Song, Yu Xia, Tong Yu, Tianyi Zhou
摘要
Large language models (LLMs) are known for their exceptional performance in natural language processing, making them highly effective in many human life-related or even job-related tasks. The attention mechanism in the Transformer architecture is a critical component of LLMs, as it allows the model to selectively focus on specific input parts. The softmax unit, which is a key part of the attention mechanism, normalizes the attention scores. Hence, the performance of LLMs in various NLP tasks depends significantly on the crucial role played by the attention mechanism with the softmax unit. In-context learning, as one of the celebrated abilities of recent LLMs, is an important concept in querying LLMs such as ChatGPT. Without further parameter updates, Transformers can learn to predict based on few in-context examples. However, the reason why Transformers becomes in-context learners is not well understood. Recently, several works [ASA+22,GTLV22,ONR+22] have studied the in-context learning from a mathematical perspective based on a linear regression formulation , which show Transformers' capability of learning linear functions in context. In this work, we study the in-context learning based on a softmax regression formulation of Transformer's attention mechanism. We show the upper bounds of the data transformations induced by a single self-attention layer and by gradient-descent on a regression loss for softmax prediction function, which imply that when training self-attention-only Transformers for fundamental regression tasks, the models learned by gradient-descent and Transformers show great similarity.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 25 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time 引用了 Language Models are Few-Shot Learners
- A Survey on In-context Learning 引用了 Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Time
- A Survey on In-context Learning 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- A Survey on In-context Learning 引用了 Language Models are Few-Shot Learners
- A Survey on In-context Learning 引用了 Transformers Learn In-Context by Gradient Descent
- A Survey on In-context Learning 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- An Explanation of In-context Learning as Implicit Bayesian Inference 引用了 Language Models are Few-Shot Learners
- H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models 引用了 Language Models are Few-Shot Learners
- How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression? 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression? 引用了 Language Models are Few-Shot Learners
- How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression? 引用了 Transformers Learn In-Context by Gradient Descent
- How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression? 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- Transformers Learn In-Context by Gradient Descent 引用了 Language Models are Few-Shot Learners
- Transformers Learn In-Context by Gradient Descent 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 Language Models are Few-Shot Learners
- What Can Transformers Learn In-Context? A Case Study of Simple Function Classes 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 Language Models are Few-Shot Learners
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 Are Transformers universal approximators of sequence-to-sequence functions?
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 Transformers Learn In-Context by Gradient Descent
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformer 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
引用它的顶会 Paper25
- H2O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language ModelsZhenyu Zhang, Ying Sheng, Tianyi Zhou, Tianlong Chen 等NeurIPS 2023 · 1,003 次引用
- A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng 等EMNLP 2024 · 479 次引用
- Deja Vu: Contextual Sparsity for Efficient LLMs at Inference TimeZichang Liu, Jue Wang, Tri Dao, Tianyi Zhou 等ICML 2023 · 318 次引用
- Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer TransformerYuandong Tian, Yiping Wang, Beidi Chen, Simon S. DuNeurIPS 2023 · 125 次引用
- How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?Jingfeng Wu, Difan Zou, Zixiang Chen, Vladimir Braverman 等ICLR 2024 · 94 次引用
它引用的 Paper33
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 次引用
- What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 次引用
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento 等ICML 2023 · 729 次引用
- Are Transformers universal approximators of sequence-to-sequence functions?Chulhee Yun, Srinadh Bhojanapalli, Ankit Singh Rawat, Sashank J. Reddi 等ICLR 2020 · 481 次引用
相关 Paper
- Transformers Efficiently Perform In-Context Logistic Regression via Normalized Gradient DescentChenyang Zhang, Yuan CaoICML 2026 · 1 次引用
- In-Context Learning with Transformers: Softmax Attention Adapts to Function LipschitznessLiam Collins, Advait Parulekar, Aryan Mokhtari, Sujay Sanghavi 等NeurIPS 2024 · 33 次引用
- Towards Understanding How Transformers Learn In-context Through a Representation Learning LensRuifeng Ren, Yong LiuNeurIPS 2024 · 26 次引用
- Softmax as Linear Attention in the Large-Prompt Regime: a Measure-based PerspectiveEtienne Boursier, Claire BoyerICML 2026 · 4 次引用
- In-Context Learning with Representations: Contextual Generalization of Trained TransformersTong Yang, Yu Huang, Yingbin Liang, Yuejie ChiNeurIPS 2024 · 45 次引用
