What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
Shivam Garg, Dimitris Tsipras, Percy Liang, Gregory Valiant
摘要
In-context learning refers to the ability of a model to condition on a prompt sequence consisting of in-context examples (input-output pairs corresponding to some task) along with a new query input, and generate the corresponding output. Crucially, in-context learning happens only at inference time without any parameter updates to the model. While large language models such as GPT-3 exhibit some ability to perform in-context learning, it is unclear what the relationship is between tasks on which this succeeds and what is present in the training data. To make progress towards understanding in-context learning, we consider the well-defined problem of training a model to in-context learn a function class (e.g., linear functions): that is, given data derived from some functions in the class, can we train a model to in-context learn "most" functions from this class? We show empirically that standard Transformers can be trained from scratch to perform in-context learning of linear functions-that is, the trained model is able to learn unseen linear functions from in-context examples with performance comparable to the optimal least squares estimator. In fact, in-context learning is possible even under two forms of distribution shift: (i) between the training data of the model and inference-time prompts, and (ii) between the in-context examples and the query input during inference. We also show that we can train Transformers to in-context learn more complex function classes-namely sparse linear functions, two-layer neural networks, and decision trees-with performance that matches or exceeds task-specific learning algorithms. 1 1 Our code and models are available at https://github.com/dtsip/in-context-learning .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 327 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Hyena Hierarchy: Towards Larger Convolutional Language Models 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Hyena Hierarchy: Towards Larger Convolutional Language Models 引用了 Language Models are Few-Shot Learners
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 Language Models are Few-Shot Learners
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 Transformers Learn In-Context by Gradient Descent
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity 引用了 Language Models are Few-Shot Learners
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity 引用了 Calibrate Before Use: Improving Few-shot Performance of Language Models
- A Survey on In-context Learning 引用了 Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
- 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 引用了 Calibrate Before Use: Improving Few-shot Performance of Language Models
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale 引用了 Language Models are Few-Shot Learners
- An Explanation of In-context Learning as Implicit Bayesian Inference 引用了 Language Models are Few-Shot Learners
- An Explanation of In-context Learning as Implicit Bayesian Inference 引用了 Calibrate Before Use: Improving Few-shot Performance of Language Models
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 Language Models are Few-Shot Learners
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective 引用了 Transformers Learn In-Context by Gradient Descent
- Transformers Learn In-Context by Gradient Descent 引用了 An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Transformers Learn In-Context by Gradient Descent 引用了 Language Models are Few-Shot Learners
- Calibrate Before Use: Improving Few-shot Performance of Language Models 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper327
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento 等ICML 2023 · 729 次引用
- Hyena Hierarchy: Towards Larger Convolutional Language ModelsMichael Poli, Stefano Massaroli, Eric Nguyen, Daniel Y. Fu 等ICML 2023 · 481 次引用
- A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng 等EMNLP 2024 · 479 次引用
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye 等NeurIPS 2023 · 470 次引用
- Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm SelectionYu Bai, Fan Chen, Huan Wang, Caiming Xiong 等NeurIPS 2023 · 356 次引用
它引用的 Paper18
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn 等ICLR 2021 · 21,477 次引用
- Calibrate Before Use: Improving Few-shot Performance of Language ModelsZihao Zhao, Eric Wallace, Shi Feng, Dan Klein 等ICML 2021 · 1,843 次引用
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order SensitivityYao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel 等ACL 2022 · 1,494 次引用
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 次引用
相关 Paper
- In-context Learning on Function Classes Unveiled for TransformersZhijie Wang, Bo Jiang, Shuai LiICML 2024 · 8 次引用
- In-Context Learning through the Bayesian PrismMadhur Panwar, Kabir Ahuja, Navin GoyalICLR 2024 · 79 次引用
- In-Context Learning with Representations: Contextual Generalization of Trained TransformersTong Yang, Yu Huang, Yingbin Liang, Yuejie ChiNeurIPS 2024 · 45 次引用
- How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with RepresentationsTianyu Guo, Wei Hu, Song Mei, Huan Wang 等ICLR 2024 · 80 次引用
- Can In-context Learning Really Generalize to Out-of-distribution Tasks?Qixun Wang, Yifei Wang, Xianghua Ying, Yisen WangICLR 2025
