Lune

ICLR2024Top-tier venue

How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?

Jingfeng Wu, Difan Zou, Zixiang Chen, Vladimir Braverman, Quanquan Gu, Peter L. Bartlett

Abstract

Transformers pretrained on diverse tasks exhibit remarkable in-context learning (ICL) capabilities, enabling them to solve unseen tasks solely based on input contexts without adjusting model parameters. In this paper, we study ICL in one of its simplest setups: pretraining a linearly parameterized single-layer linear attention model for linear regression with a Gaussian prior. We establish a statistical task complexity bound for the attention model pretraining, showing that effective pretraining only requires a small number of independent tasks. Furthermore, we prove that the pretrained model closely matches the Bayes optimal algorithm, i.e., optimally tuned ridge regression, by achieving nearly Bayes optimal risk on unseen tasks under a fixed context length. These theoretical findings complement prior experimental research and shed light on the statistical foundations of ICL.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

60 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context cites Language Models are Few-Shot Learners
  • Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context cites Transformers Learn In-Context by Gradient Descent
  • Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites Language Models are Few-Shot Learners
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites Transformers Learn In-Context by Gradient Descent
  • Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • A Theoretical Understanding of Self-Correction through In-context Alignment cites Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context
  • A Theoretical Understanding of Self-Correction through In-context Alignment cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • A Theoretical Understanding of Self-Correction through In-context Alignment cites Transformers Learn In-Context by Gradient Descent
  • A Theoretical Understanding of Self-Correction through In-context Alignment cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • An Explanation of In-context Learning as Implicit Bayesian Inference cites Language Models are Few-Shot Learners
  • Can large language models explore in-context? cites Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context
  • Can large language models explore in-context? cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Can large language models explore in-context? cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Can large language models explore in-context? cites Language Models are Few-Shot Learners
  • Can large language models explore in-context? cites Transformers Learn In-Context by Gradient Descent
  • Can large language models explore in-context? cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • The Evolution of Statistical Induction Heads: In-Context Learning Markov Chains cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • The Evolution of Statistical Induction Heads: In-Context Learning Markov Chains cites Language Models are Few-Shot Learners
  • The Evolution of Statistical Induction Heads: In-Context Learning Markov Chains cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Why Larger Language Models Do In-context Learning Differently? cites Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Context
  • Why Larger Language Models Do In-context Learning Differently? cites Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selection
  • Why Larger Language Models Do In-context Learning Differently? cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Why Larger Language Models Do In-context Learning Differently? cites Language Models are Few-Shot Learners
  • Why Larger Language Models Do In-context Learning Differently? cites Transformers Learn In-Context by Gradient Descent
  • Why Larger Language Models Do In-context Learning Differently? cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Transformers Learn In-Context by Gradient Descent cites Language Models are Few-Shot Learners
  • Transformers Learn In-Context by Gradient Descent cites 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 cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers60

  1. The Evolution of Statistical Induction Heads: In-Context Learning Markov ChainsEzra Edelman, Nikolaos Tsilivis, Benjamin L. Edelman, Eran Malach et al.NeurIPS 2024 · 140 citations
  2. Can large language models explore in-context?Akshay Krishnamurthy, Keegan Harris, Dylan J. Foster, Cyril Zhang et al.NeurIPS 2024 · 95 citations
  3. A Theoretical Understanding of Self-Correction through In-context AlignmentYifei Wang, Yuyang Wu, Zeming Wei, Stefanie Jegelka et al.NeurIPS 2024 · 69 citations
  4. Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In ContextXiang Cheng, Yuxin Chen, Suvrit SraICML 2024 · 64 citations
  5. Why Larger Language Models Do In-context Learning Differently?Zhenmei Shi, Junyi Wei, Zhuoyan Xu, Yingyu LiangICML 2024 · 54 citations

Builds on17

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
  3. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
  4. Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
  5. Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm SelectionYu Bai, Fan Chen, Huan Wang, Caiming Xiong et al.NeurIPS 2023 · 356 citations

Related papers

  1. Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressionAllan Raventós, Mansheej Paul, Feng Chen, Surya GanguliNeurIPS 2023 · 174 citations
  2. When can in-context learning generalize out of task distribution?Page C. Goddard, Lindsay M. Smith, Vudtiwat Ngampruetikorn, David J. SchwabICML 2025
  3. In-Context Learning with Representations: Contextual Generalization of Trained TransformersTong Yang, Yu Huang, Yingbin Liang, Yuejie ChiNeurIPS 2024 · 45 citations
  4. In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-LearningTomoya Wakayama, Taiji SuzukiICML 2026 · 12 citations
  5. Transformers are Minimax Optimal Nonparametric In-Context LearnersJuno Kim, Tai Nakamaki, Taiji SuzukiNeurIPS 2024 · 42 citations
Dusk over the sea between two cliffs drawn in fine vertical lines