Lune

ICML2024顶会

In-context Learning on Function Classes Unveiled for Transformers

Zhijie Wang, Bo Jiang, Shuai Li

摘要

Transformer-based neural sequence models exhibit a remarkable ability to perform in-context learning. Given some training examples, a pretrained model can make accurate predictions on an unseen input. This paper studies why transformers can learn different types of function classes in-context. We first show by construction that there exists a family of transformers (with different activation functions) that implement approximate gradient descent on the parameters of neural networks, and we provide an upper bound for the number of heads, hidden dimensions, and layers of the transformer. We also show that a transformer can learn linear functions, the indicator function of a unit ball, and smooth functions in-context by learning neural networks that approximate them. The above instances mainly focus on a transformer pre-trained on single tasks. We also prove that when pre-trained on two tasks: linear regression and classification, a transformer can make accurate predictions on both tasks simultaneously. Our results move beyond linearity in terms of in-context learning instances and provide a comprehensive understanding of why transformers can learn many types of function classes through the bridge of neural networks.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 5 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • 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 引用了 Transformers Learn In-Context by Gradient Descent
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical Evidence 引用了 Transformers Learn In-Context by Gradient Descent
  • Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical Evidence 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Can In-context Learning Really Generalize to Out-of-distribution Tasks? 引用了 Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Can In-context Learning Really Generalize to Out-of-distribution Tasks? 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
  • Can In-context Learning Really Generalize to Out-of-distribution Tasks? 引用了 Transformers Learn In-Context by Gradient Descent
  • Can In-context Learning Really Generalize to Out-of-distribution Tasks? 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • An Explanation of In-context Learning as Implicit Bayesian Inference 引用了 Finetuned Language Models are Zero-Shot Learners
  • In-Context Deep Learning via Transformer Models 引用了 Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • In-Context Deep Learning via Transformer Models 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
  • In-Context Deep Learning via Transformer Models 引用了 Transformers Learn In-Context by Gradient Descent
  • In-Context Deep Learning via Transformer Models 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning 引用了 Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning 引用了 An Explanation of In-context Learning as Implicit Bayesian Inference
  • In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning 引用了 Why In-Context Learning Models are Good Few-Shot Learners?
  • In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning 引用了 Transformers Learn In-Context by Gradient Descent
  • In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Why In-Context Learning Models are Good Few-Shot Learners? 引用了 Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Why In-Context Learning Models are Good Few-Shot Learners? 引用了 Transformers Learn In-Context by Gradient Descent
  • Why In-Context Learning Models are Good Few-Shot Learners? 引用了 What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • 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
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper5

  1. Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical EvidenceShaopeng Fu, Liang Ding, Jingfeng Zhang, Di WangNeurIPS 2025 · 15 次引用
  2. In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-LearningTomoya Wakayama, Taiji SuzukiICML 2026 · 12 次引用
  3. Can In-context Learning Really Generalize to Out-of-distribution Tasks?Qixun Wang, Yifei Wang, Xianghua Ying, Yisen WangICLR 2025
  4. In-Context Deep Learning via Transformer ModelsWeimin Wu, Maojiang Su, Jerry Yao-Chieh Hu, Zhao Song 等ICML 2025
  5. Why In-Context Learning Models are Good Few-Shot Learners?Shiguang Wu, Yaqing Wang, Quanming YaoICLR 2025

它引用的 Paper8

  1. Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu 等ICLR 2022 · 4,966 次引用
  2. An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 次引用
  3. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 次引用
  4. Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento 等ICML 2023 · 729 次引用
  5. Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm SelectionYu Bai, Fan Chen, Huan Wang, Caiming Xiong 等NeurIPS 2023 · 356 次引用

相关 Paper

  1. Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In ContextXiang Cheng, Yuxin Chen, Suvrit SraICML 2024 · 64 次引用
  2. What learning algorithm is in-context learning? Investigations with linear modelsEkin Akyürek, Dale Schuurmans, Jacob Andreas, Tengyu Ma 等ICLR 2023 · 85 次引用
  3. In-Context Learning through the Bayesian PrismMadhur Panwar, Kabir Ahuja, Navin GoyalICLR 2024 · 79 次引用
  4. Understanding In-Context Learning in Transformers and LLMs by Learning to Learn Discrete FunctionsSatwik Bhattamishra, Arkil Patel, Phil Blunsom, Varun KanadeICLR 2024 · 77 次引用
  5. Pretrained Transformer Efficiently Learns Low-Dimensional Target Functions In-ContextKazusato Oko, Yujin Song, Taiji Suzuki, Denny WuNeurIPS 2024 · 34 次引用
黄昏的海面,两侧是细线勾勒的悬崖