Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizers
Not on the map. Why?
Cited by 25 in LLM reasoning, but placed by its own abstract, which didn’t fit.
Abstract (arXiv)
Large pretrained language models have shown surprising in-context learning (ICL) ability. With a few demonstration input-label pairs, they can predict the label for an unseen input without parameter updates. Despite the great success in performance, its working mechanism still remains an open question. In this paper, we explain language models as meta-optimizers and understand in-context learning as implicit finetuning. Theoretically, we figure out that Transformer attention has a dual form of gradient descent. On top of it, we understand ICL as follows: GPT first produces meta-gradients according to the demonstration examples, and then these meta-gradients are applied to the original GPT to build an ICL model. We comprehensively compare the behaviors of in-context learning and explicit finetuning on real tasks to provide empirical evidence that supports our understanding. Experimental results show that in-context learning behaves similarly to explicit finetuning from multiple perspectives. Inspired by the dual form between Transformer attention and gradient descent, we design a momentum-based attention by analogy with gradient descent with momentum. The improved performance over vanilla attention further supports our understanding from another perspective, and more importantly, shows the potential to utilize our understanding for future model design. The code is available at urlhttps://aka.ms/icl.
Key facts. Cited by 204 papers in the map (data through 7 Oct 2026). Builds on 14 of its 29 references that are in the map. First posted on arXiv 20 Dec 2022.
Builds on
14 of 29 references.
References · 14
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2018Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challengecited by 4,710
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2021Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolationcited by 1,085
- 2022In-context Learning and Induction Headscited by 930
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2022General-Purpose In-Context Learning by Meta-Learning Transformerscited by 102
Built on by
Citing papers per year: 2023: 43; 2024: 60; 2025: 71; 2026: 30.
204 papers.
Sort:
By area:
- 2023The Dawn of LMMs: Preliminary Explorations with GPT-4V(ision)cited by 677
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2023Challenges and Applications of Large Language Modelscited by 251
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
- 2023What In-Context Learning "Learns" In-Context: Disentangling Task Recognition and Task Learningcited by 149
- 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 138
- 2023Understanding Catastrophic Forgetting in Language Models via Implicit Inferencecited by 138
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 2023A Survey on LLM-Generated Text Detection: Necessity, Methods, and Future Directionscited by 101
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2023In-Context Learning with Iterative Demonstration Selectioncited by 74
38 more
- 2023Efficient Benchmarking of Language Modelscited by 71
- 2023Generative Speech Recognition Error Correction with Large Language Models and Task-Activating Promptingcited by 71
- 2024In-context Learning with Retrieved Demonstrations for Language Models: A Surveycited by 69
- 2024nGPT: Normalized Transformer with Representation Learning on the Hyperspherecited by 68
- 2023Evaluating the Zero-shot Robustness of Instruction-tuned Language Modelscited by 63
- 2023Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Contextcited by 63
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Surveycited by 62
- 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoningcited by 57
- 2024A Comprehensive Survey of Large Language Models and Multimodal Large Language Models in Medicinecited by 45
- 2024Revisiting VerilogEval: A Year of Improvements in Large-Language Models for Hardware Code Generationcited by 45
- 2024LLM as Dataset Analyst: Subpopulation Structure Discovery with Large Language Modelcited by 43
- 2025Learning without training: The implicit dynamics of in-context learningcited by 41
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 36
- 2025Emergent Abilities in Large Language Models: A Surveycited by 34
- 2025M2IV: Towards Efficient and Fine-grained Multimodal In-Context Learning via Representation Engineeringcited by 34
- 2024Safety Arithmetic: A Framework for Test-time Safety Alignment of Language Models by Steering Parameters and Activationscited by 32
- 2023Can Multimodal Large Language Models Truly Perform Multimodal In-Context Learning?cited by 31
- 2023How to Configure Good In-Context Sequence for Visual Question Answeringcited by 31
- 2023Towards Trustworthy and Aligned Machine Learning: A Data-centric Survey with Causality Perspectivescited by 30
- 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 29
- 2023Understanding In-Context Learning from Repetitionscited by 27
- 2024Cycles of Thought: Measuring LLM Confidence through Stable Explanationscited by 27
- 2024GeoReasoner: Geo-localization with Reasoning in Street Views using a Large Vision-Language Modelcited by 27
- 2024Case-Based or Rule-Based: How Do Transformers Do the Math?cited by 26
- 2023LLMs as Hackers: Autonomous Linux Privilege Escalation Attackscited by 25
- 2024Scaling Data Diversity for Fine-Tuning Language Models in Human Alignmentcited by 25
- 2023Understanding Emergent In-Context Learning from a Kernel Regression Perspectivecited by 23
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2025AURORA:Automated Training Framework of Universal Process Reward Models via Ensemble Prompting and Reverse Verificationcited by 22
- 2024In-context Time Series Predictorcited by 21
- 2023In-context Learning and Gradient Descent Revisitedcited by 20
- 2024Do Efficient Transformers Really Save Computation?cited by 20
- 2023Dissecting Chain-of-Thought: Compositionality through In-Context Filtering and Learningcited by 19
- 2025Data Whisperer: Efficient Data Selection for Task-Specific LLM Fine-Tuning via Few-Shot In-Context Learningcited by 19
- 2023Bootstrapping Interactive Image-Text Alignment for Remote Sensing Image Captioningcited by 18
- 2025Representation Engineering for Large-Language Models: Survey and Research Challengescited by 18
- 2024Superiority of Multi-Head Attention in In-Context Linear Regressioncited by 17
- 2024Shortcomings of LLMs for Low-Resource Translation: Retrieval and Understanding are Both the Problemcited by 17
50 most cited of 204 All 204 (JSON)
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lens4 Sep 2026
- 2026When Is a Task Vector Enough? An Empirical Theory of Implicit Multimodal ICL13 Aug 2026
- 2026In-Context Learning as Implicit Policy Gradient25 Jul 2026
- 2026PICasso: An AI-Enabled Design Framework for Autonomous Optimization of Silicon Photonic Devices28 May 2026
- 2026Causal Interventions on Continuous Variables: A Case Study on Verb Bias in Steering Vectors for In-Context Learning28 May 2026
- 2026Parallax: Parameterized Local Linear Attention for Language Modeling27 May 2026
- 2026In-Context Optimization for Retrieval-Augmented Generation: A Gradient-Descent Perspective25 May 2026
- 2026Few-Shot Degradation Is Not What It Seems: Behavioral Evidence, Representation Analysis, and a Random-Text Control Across 12 Models, 2 Tasks, and 2 Architectures23 May 2026
- 2026A Human-in-the-Loop Framework for Efficient Prompt Selection in Microscopy Vision-Language Models19 May 2026
- 2026Spectral Transformer Neural Processes10 May 2026
- 2026In-Context Fixation: When Demonstrated Labels Override Semantics in Few-Shot Classification8 May 2026
38 more
- 2026Nonsense Helps: Prompt Space Perturbation Broadens Reasoning Exploration7 May 2026
- 2026When Context Sticks: Studying Interference in In-Context Learning25 Apr 2026
- 2026Why Multimodal In-Context Learning Lags Behind? Unveiling the Inner Mechanisms and Bottlenecks15 Apr 2026
- 2026How does Chain of Thought decompose complex tasks?10 Apr 2026
- 2026Meta-learning In-Context Enables Training-Free Cross Subject Brain Decoding9 Apr 2026
- 2026AdaptFuse: Training-Free Sequential Preference Learning via Externalized Bayesian Inference5 Apr 2026
- 2026TR-ICRL: Test-Time Rethinking for In-Context Reinforcement Learning1 Apr 2026
- 2026Demonstrations, CoT, and Prompting: A Theoretical Analysis of ICL20 Mar 2026
- 2026Transformers Learn Robust In-Context Regression under Distributional Uncertainty19 Mar 2026
- 2026HIFICL: High-Fidelity In-Context Learning for Multimodal Tasks13 Mar 2026
- 2026Implicit Statistical Inference in Transformers: Approximating Likelihood-Ratio Tests In-Context11 Mar 2026
- 2026COLD-Steer: Steering Large Language Models via In-Context One-step Learning Dynamics6 Mar 2026
- 2026Fine-Tuning Without Forgetting In-Context Learning: A Theoretical Analysis of Linear Attention Models26 Feb 2026
- 2026Free Energy Mixer6 Feb 2026
- 2026RAPO: Risk-Aware Preference Optimization for Generalizable Safe Reasoning4 Feb 2026
- 2026A Constrained Optimization Perspective of Unrolled Transformers24 Jan 2026
- 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformers21 Jan 2026
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification3 Jan 2026
- 2025Rethinking Label Consistency of In-Context Learning: An Implicit Transductive Label Propagation Perspective13 Dec 2025
- 2025DABench-LLM: Standardized and In-Depth Benchmarking of Post-Moore Dataflow AI Accelerators for LLMs4 Dec 2025
- 2025Equivalence of Context and Parameter Updates in Modern Transformer Blocks22 Nov 2025
- 2025Convergence dynamics of Agent-to-Agent Interactions with Misaligned objectives11 Nov 2025
- 2025Scaling Laws and In-Context Learning: A Unified Theoretical Framework9 Nov 2025
- 2025Superpositional Gradient Descent: Harnessing Quantum Principles for Model Training1 Nov 2025
- 2025Detecting Data Contamination in LLMs via In-Context Learning30 Oct 2025
- 2025A Framework for Quantifying How Pre-Training and Context Benefit In-Context Learning26 Oct 2025
- 2025Enabling Robust In-Context Memory and Rapid Task Adaptation in Transformers with Hebbian and Gradient-Based Plasticity24 Oct 2025
- 2025Large Language Models as Model Organisms for Human Associative Learning24 Oct 2025
- 2025How Do LLMs Use Their Depth?21 Oct 2025
- 2025Online In-Context Distillation for Low-Resource Vision Language Models20 Oct 2025
- 2025Rewiring Experts on the Fly:Continuous Rerouting for Better Online Adaptation in Mixture-of-Expert models16 Oct 2025
- 2025Holdout-Loss-Based Data Selection for LLM Finetuning via In-Context Learning16 Oct 2025
- 2025Transmuting prompts into weights9 Oct 2025
- 2025Local Linear Attention: An Optimal Interpolation of Linear and Softmax Attention For Test-Time Regression1 Oct 2025
- 2025From Harm to Help: Turning Reasoning In-Context Demos into Assets for Reasoning LMs27 Sep 2025
- 2025Defining and Monitoring Complex Robot Activities via LLMs and Symbolic Reasoning19 Sep 2025
- 2025KITE: Kernelized and Information Theoretic Exemplars for In-Context Learning19 Sep 2025
- 2025Reasoning Under Uncertainty: Exploring Probabilistic Reasoning Capabilities of LLMs12 Sep 2025
50 newest of 204 All 204 (JSON)
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Surveycited by 62
- 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoningcited by 57
- 2024Cycles of Thought: Measuring LLM Confidence through Stable Explanationscited by 27
- 2024GeoReasoner: Geo-localization with Reasoning in Street Views using a Large Vision-Language Modelcited by 27
- 2025AURORA:Automated Training Framework of Universal Process Reward Models via Ensemble Prompting and Reverse Verificationcited by 22
- 2023Dissecting Chain-of-Thought: Compositionality through In-Context Filtering and Learningcited by 19
- 2024Exploring the Mystery of Influential Data for Mathematical Reasoningcited by 13
- 2025Rethinking Invariance in In-context Learningcited by 8
- 2025Reasoning Under Uncertainty: Exploring Probabilistic Reasoning Capabilities of LLMscited by 8
- 2025Don't Take Things Out of Context: Attention Intervention for Enhancing Chain-of-Thought Reasoning in Large Language Modelscited by 7
- 2025Teaching LLMs According to Their Aptitude: Adaptive Reasoning for Mathematical Problem Solvingcited by 4
- 2025Counterfactual reasoning: an analysis of in-context emergencecited by 4
12 most cited of 25 All 25 (JSON)
- 2026Nonsense Helps: Prompt Space Perturbation Broadens Reasoning Exploration7 May 2026
- 2026How does Chain of Thought decompose complex tasks?10 Apr 2026
- 2026TR-ICRL: Test-Time Rethinking for In-Context Reinforcement Learning1 Apr 2026
- 2026RAPO: Risk-Aware Preference Optimization for Generalizable Safe Reasoning4 Feb 2026
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification3 Jan 2026
- 2025Rethinking Label Consistency of In-Context Learning: An Implicit Transductive Label Propagation Perspective13 Dec 2025
- 2025From Harm to Help: Turning Reasoning In-Context Demos into Assets for Reasoning LMs27 Sep 2025
- 2025Defining and Monitoring Complex Robot Activities via LLMs and Symbolic Reasoning19 Sep 2025
- 2025Reasoning Under Uncertainty: Exploring Probabilistic Reasoning Capabilities of LLMs12 Sep 2025
- 2025Enhancing Chain-of-Thought Reasoning with Critical Representation Fine-tuning14 Jul 2025
- 2025Thinking About Thinking: SAGE-nano's Inverse Reasoning for Self-Aware Language Models30 Jun 2025
- 2025Counterfactual reasoning: an analysis of in-context emergence5 Jun 2025
12 newest of 25 All 25 (JSON)
- 2023The Dawn of LMMs: Preliminary Explorations with GPT-4V(ision)cited by 677
- 2024A Comprehensive Survey of Large Language Models and Multimodal Large Language Models in Medicinecited by 45
- 2025M2IV: Towards Efficient and Fine-grained Multimodal In-Context Learning via Representation Engineeringcited by 34
- 2023Can Multimodal Large Language Models Truly Perform Multimodal In-Context Learning?cited by 31
- 2023How to Configure Good In-Context Sequence for Visual Question Answeringcited by 31
- 2025Mimic In-Context Learning for Multimodal Taskscited by 12
- 2025Online In-Context Distillation for Low-Resource Vision Language Modelscited by 2
- 2026HIFICL: High-Fidelity In-Context Learning for Multimodal Taskscited by 1
- 2026A Human-in-the-Loop Framework for Efficient Prompt Selection in Microscopy Vision-Language Modelscited by 0
- 2026A Human-in-the-Loop Framework for Efficient Prompt Selection in Microscopy Vision-Language Models19 May 2026
- 2026HIFICL: High-Fidelity In-Context Learning for Multimodal Tasks13 Mar 2026
- 2025Online In-Context Distillation for Low-Resource Vision Language Models20 Oct 2025
- 2025Mimic In-Context Learning for Multimodal Tasks11 Apr 2025
- 2025M2IV: Towards Efficient and Fine-grained Multimodal In-Context Learning via Representation Engineering6 Apr 2025
- 2024A Comprehensive Survey of Large Language Models and Multimodal Large Language Models in Medicine14 May 2024
- 2023How to Configure Good In-Context Sequence for Visual Question Answering4 Dec 2023
- 2023Can Multimodal Large Language Models Truly Perform Multimodal In-Context Learning?29 Nov 2023
- 2023The Dawn of LMMs: Preliminary Explorations with GPT-4V(ision)29 Sep 2023
- 2023Understanding Catastrophic Forgetting in Language Models via Implicit Inferencecited by 138
- 2024Safety Arithmetic: A Framework for Test-time Safety Alignment of Language Models by Steering Parameters and Activationscited by 32
- 2023Towards Trustworthy and Aligned Machine Learning: A Data-centric Survey with Causality Perspectivescited by 30
- 2024Scaling Data Diversity for Fine-Tuning Language Models in Human Alignmentcited by 25
- 2025Holdout-Loss-Based Data Selection for LLM Finetuning via In-Context Learningcited by 1
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lenscited by 0
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lens4 Sep 2026
- 2025Holdout-Loss-Based Data Selection for LLM Finetuning via In-Context Learning16 Oct 2025
- 2024Safety Arithmetic: A Framework for Test-time Safety Alignment of Language Models by Steering Parameters and Activations17 Jun 2024
- 2024Scaling Data Diversity for Fine-Tuning Language Models in Human Alignment17 Mar 2024
- 2023Understanding Catastrophic Forgetting in Language Models via Implicit Inference18 Sep 2023
- 2023Towards Trustworthy and Aligned Machine Learning: A Data-centric Survey with Causality Perspectives31 Jul 2023
- 2023REX: Rapid Exploration and eXploitation for AI Agentscited by 13
- 2024Automating Traffic Model Enhancement with AI Research Agentcited by 8
- 2023Predictive Minds: LLMs As Atypical Active Inference Agentscited by 2
- 2025Convergence dynamics of Agent-to-Agent Interactions with Misaligned objectivescited by 1
- 2025Convergence dynamics of Agent-to-Agent Interactions with Misaligned objectives11 Nov 2025
- 2024Automating Traffic Model Enhancement with AI Research Agent25 Sep 2024
- 2023Predictive Minds: LLMs As Atypical Active Inference Agents16 Nov 2023
- 2023REX: Rapid Exploration and eXploitation for AI Agents18 Jul 2023
- 2024RuleRAG: Rule-Guided Retrieval-Augmented Generation with Language Models for Question Answeringcited by 13
- 2024A Theory for Token-Level Harmonization in Retrieval-Augmented Generationcited by 7
- 2024Evaluating and Safeguarding the Adversarial Robustness of Retrieval-Based In-Context Learningcited by 4
- 2026In-Context Optimization for Retrieval-Augmented Generation: A Gradient-Descent Perspectivecited by 0
- 2026In-Context Optimization for Retrieval-Augmented Generation: A Gradient-Descent Perspective25 May 2026
- 2024RuleRAG: Rule-Guided Retrieval-Augmented Generation with Language Models for Question Answering15 Oct 2024
- 2024A Theory for Token-Level Harmonization in Retrieval-Augmented Generation3 Jun 2024
- 2024Evaluating and Safeguarding the Adversarial Robustness of Retrieval-Based In-Context Learning24 May 2024
- 2025PM-MOE: Mixture of Experts on Private Model Parameters for Personalized Federated Learningcited by 8
- 2025Rewiring Experts on the Fly:Continuous Rerouting for Better Online Adaptation in Mixture-of-Expert modelscited by 3
- 2024Toward generalizable learning of all (linear) first-order methods via memory augmented Transformerscited by 0
- 2025Rewiring Experts on the Fly:Continuous Rerouting for Better Online Adaptation in Mixture-of-Expert models16 Oct 2025
- 2025PM-MOE: Mixture of Experts on Private Model Parameters for Personalized Federated Learning1 Feb 2025
- 2024Toward generalizable learning of all (linear) first-order methods via memory augmented Transformers8 Oct 2024
- 2025ICLShield: Exploring and Mitigating In-Context Learning Backdoor Attackscited by 9
- 2025Mitigating Many-Shot Jailbreakingcited by 3
- 2025ICLShield: Exploring and Mitigating In-Context Learning Backdoor Attacks2 Jul 2025
- 2025Mitigating Many-Shot Jailbreaking13 Apr 2025
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2023Challenges and Applications of Large Language Modelscited by 251
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
- 2023What In-Context Learning "Learns" In-Context: Disentangling Task Recognition and Task Learningcited by 149
- 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 138
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 2023A Survey on LLM-Generated Text Detection: Necessity, Methods, and Future Directionscited by 101
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2023In-Context Learning with Iterative Demonstration Selectioncited by 74
- 2023Efficient Benchmarking of Language Modelscited by 71
- 2023Generative Speech Recognition Error Correction with Large Language Models and Task-Activating Promptingcited by 71
12 most cited of 150 All 150 (JSON)
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026When Is a Task Vector Enough? An Empirical Theory of Implicit Multimodal ICL13 Aug 2026
- 2026In-Context Learning as Implicit Policy Gradient25 Jul 2026
- 2026PICasso: An AI-Enabled Design Framework for Autonomous Optimization of Silicon Photonic Devices28 May 2026
- 2026Causal Interventions on Continuous Variables: A Case Study on Verb Bias in Steering Vectors for In-Context Learning28 May 2026
- 2026Parallax: Parameterized Local Linear Attention for Language Modeling27 May 2026
- 2026Few-Shot Degradation Is Not What It Seems: Behavioral Evidence, Representation Analysis, and a Random-Text Control Across 12 Models, 2 Tasks, and 2 Architectures23 May 2026
- 2026Spectral Transformer Neural Processes10 May 2026
- 2026In-Context Fixation: When Demonstrated Labels Override Semantics in Few-Shot Classification8 May 2026
- 2026When Context Sticks: Studying Interference in In-Context Learning25 Apr 2026
- 2026Why Multimodal In-Context Learning Lags Behind? Unveiling the Inner Mechanisms and Bottlenecks15 Apr 2026
- 2026Meta-learning In-Context Enables Training-Free Cross Subject Brain Decoding9 Apr 2026
12 newest of 150 All 150 (JSON)