Lune

ICLR2024Top-tier venue

One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attention

Arvind V. Mahankali, Tatsunori Hashimoto, Tengyu Ma

Abstract

Recent works have empirically analyzed in-context learning and shown that transformers trained on synthetic linear regression tasks can learn to implement ridge regression, which is the Bayes-optimal predictor, given sufficient capacity [Akyürek et al., 2023], while one-layer transformers with linear self-attention and no MLP layer will learn to implement one step of gradient descent (GD) on a least-squares linear regression objective [von Oswald et al., 2022]. However, the theory behind these observations remains poorly understood. We theoretically study transformers with a single layer of linear self-attention, trained on synthetic noisy linear regression data. First, we mathematically show that when the covariates are drawn from a standard Gaussian distribution, the one-layer transformer which minimizes the pre-training loss will implement a single step of GD on the least-squares linear regression objective. Then, we find that changing the distribution of the covariates and weight vector to a non-isotropic Gaussian distribution has a strong impact on the learned algorithm: the global minimizer of the pre-training loss now implements a single step of pre-conditioned\textit{pre-conditioned} GD. However, if only the distribution of the responses is changed, then this does not have a large effect on the learned algorithm: even when the response comes from a more general family of nonlinear\textit{nonlinear} functions, the global minimizer of the pre-training loss still implements a single step of GD on a least-squares linear regression objective.

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.

102 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

  • In-context Convergence of Transformers cites Transformers learn to implement preconditioned gradient descent for in-context learning
  • In-context Convergence of Transformers cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • In-context Convergence of Transformers cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
  • In-context Convergence of Transformers cites Language Models are Few-Shot Learners
  • In-context Convergence of Transformers cites Transformers Learn In-Context by Gradient Descent
  • In-context Convergence of Transformers cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Transformers learn to implement preconditioned gradient descent for in-context learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Transformers learn to implement preconditioned gradient descent for in-context learning cites Language Models are Few-Shot Learners
  • Transformers learn to implement preconditioned gradient descent for in-context learning cites Transformers Learn In-Context by Gradient Descent
  • Transformers learn to implement preconditioned gradient descent for in-context learning cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • A Survey on In-context Learning cites Transformers learn to implement preconditioned gradient descent for in-context learning
  • A Survey on In-context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • A Survey on In-context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
  • A Survey on In-context Learning cites Language Models are Few-Shot Learners
  • A Survey on In-context Learning cites Transformers Learn In-Context by Gradient Descent
  • A Survey on In-context Learning cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • How Transformers Learn Causal Structure with Gradient Descent cites Transformers learn to implement preconditioned gradient descent for in-context learning
  • How Transformers Learn Causal Structure with Gradient Descent cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • How Transformers Learn Causal Structure with Gradient Descent cites Language Models are Few-Shot Learners
  • How Transformers Learn Causal Structure with Gradient Descent cites Transformers Learn In-Context by Gradient Descent
  • How Transformers Learn Causal Structure with Gradient Descent 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
  • Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? cites Language Models are Few-Shot Learners
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites Transformers learn to implement preconditioned gradient descent for in-context learning
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites Language Models are Few-Shot Learners
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites Transformers Learn In-Context by Gradient Descent
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks 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 papers102

  1. A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng et al.EMNLP 2024 · 479 citations
  2. Transformers learn to implement preconditioned gradient descent for in-context learningKwangjun Ahn, Xiang Cheng, Hadi Daneshmand, Suvrit SraNeurIPS 2023 · 324 citations
  3. Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning TasksJongho Park, Jaeseung Park, Zheyang Xiong, Nayoung Lee et al.ICML 2024 · 124 citations
  4. How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 citations
  5. In-context Convergence of TransformersYu Huang, Yuan Cheng, Yingbin LiangICML 2024 · 114 citations

Builds on8

  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. Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe et al.EMNLP 2022 · 634 citations

Related papers

  1. What learning algorithm is in-context learning? Investigations with linear modelsEkin Akyürek, Dale Schuurmans, Jacob Andreas, Tengyu Ma et al.ICLR 2023 · 85 citations
  2. How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?Jingfeng Wu, Difan Zou, Zixiang Chen, Vladimir Braverman et al.ICLR 2024 · 94 citations
  3. How Transformers Utilize Multi-Head Attention in In-Context Learning? A Case Study on Sparse Linear RegressionXingwu Chen, Lei Zhao, Difan ZouNeurIPS 2024 · 19 citations
  4. 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
  5. Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?Khashayar Gatmiry, Nikunj Saunshi, Sashank J. Reddi, Stefanie Jegelka et al.ICML 2024 · 43 citations
Dusk over the sea between two cliffs drawn in fine vertical lines