Understanding Emergent In-Context Learning from a Kernel Regression Perspective
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) have initiated a paradigm shift in transfer learning. In contrast to the classic pretraining-then-finetuning procedure, in order to use LLMs for downstream prediction tasks, one only needs to provide a few demonstrations, known as in-context examples, without adding more or updating existing model parameters. This in-context learning (ICL) capability of LLMs is intriguing, and it is not yet fully understood how pretrained LLMs acquire such capabilities. In this paper, we investigate the reason why a transformer-based language model can accomplish in-context learning after pre-training on a general language corpus by proposing a kernel-regression perspective of understanding LLMs' ICL bahaviors when faced with in-context examples. More concretely, we first prove that Bayesian inference on in-context prompts can be asymptotically understood as kernel regression hat y = sumi yi K(x, xi)/sumi K(x, xi) as the number of in-context demonstrations grows. Then, we empirically investigate the in-context behaviors of language models. We find that during ICL, the attention and hidden features in LLMs match the behaviors of a kernel regression. Finally, our theory provides insights into multiple phenomena observed in the ICL field: why retrieving demonstrative samples similar to test samples can help, why ICL performance is sensitive to the output formats, and why ICL accuracy benefits from selecting in-distribution and representative samples. Code and resources are publicly available at https://github.com/Glaciohound/Explain-ICL-As-Kernel-Regression.
Key facts. Cited by 24 papers in the map (data through 14 Oct 2026). Builds on 25 of its 50 references that are in the map. First posted on arXiv 22 May 2023.
Builds on
25 of 50 references.
References · 25
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,374
- 2022Emergent Abilities of Large Language Modelscited by 2,512
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 2022Transformers learn in-context by gradient descentcited by 732
13 more
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
- 2021Learning To Retrieve Prompts for In-Context Learningcited by 648
- 2020Hopfield Networks is All You Needcited by 475
- 2023Larger language models do in-context learning differentlycited by 394
- 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2021Reframing Instructional Prompts to GPTk's Languagecited by 176
- 2021Noisy Channel Language Model Prompting for Few-Shot Text Classificationcited by 165
- 2021Cutting Down on Prompts and Parameters: Simple Few-Shot Learning with Language Modelscited by 139
- 2021Open Vocabulary Electroencephalography-To-Text Decoding and Zero-shot Sentiment Classificationcited by 67
- 2022Insights into Pre-training via Simpler Synthetic Taskscited by 26
- 2023Calibrating Transformers via Sparse Gaussian Processescited by 21
Built on by
Citing papers per year: 2023: 1; 2024: 11; 2025: 3; 2026: 9.
24 papers.
Sort:
By area:
- 2023Challenges and Applications of Large Language Modelscited by 254
- 2024Visual In-Context Learning for Large Vision-Language Modelscited by 128
- 2024Can large language models explore in-context?cited by 76
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 46
- 2024Dual Operating Modes of In-Context Learningcited by 43
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2024Revisiting In-context Learning Inference Circuit in Large Language Modelscited by 17
- 2025Understanding In-Context Learning on Structured Manifolds: Bridging Attention to Kernel Methodscited by 15
- 2024Does learning the right latent variables necessarily improve in-context learning?cited by 13
- 2024What Makes In-context Learning Effective for Mathematical Reasoning: A Theoretical Analysiscited by 7
- 2024On the Learn-to-Optimize Capabilities of Transformers in In-Context Sparse Recoverycited by 6
- 2026Interpretable Tabular Foundation Models via In-Context Kernel Regressioncited by 4
12 more
- 2026OpenRFM: Dissecting Relational In-Context Learningcited by 4
- 2024From Unstructured Data to In-Context Learning: Exploring What Tasks Can Be Learned and Whencited by 3
- 2024Towards the Effect of Examples on In-Context Learning: A Theoretical Case Studycited by 2
- 2025In-Context Learning for Gradient-Free Receiver Adaptation: Principles, Applications, and Theorycited by 1
- 2025Mamba Can Learn Low-Dimensional Targets In-Context via Test-Time Feature Learningcited by 1
- 2026Transformers Can Implement Preconditioned Richardson Iteration for In-Context Gaussian Kernel Regressioncited by 1
- 2026Privacy Vulnerabilities of Attention Layers in Tabular Foundation Models and Protection of High-Risk Queriescited by 1
- 2026Training-Free Universal Approximation by Prompting Random Transformerscited by 1
- 2026Implicit Statistical Inference in Transformers: Approximating Likelihood-Ratio Tests In-Contextcited by 0
- 2026Symmetry Reveals Layerwise Dynamics: How Transformers Perform In-Context Classificationcited by 0
- 2026When Correct Demonstrations Hurt: Rethinking the Role of Exemplars in In-Context Learningcited by 0
- 2026Large Discovery Models: Empirically-grounded Model-Based Open-Ended Searchcited by 0
- 2026Large Discovery Models: Empirically-grounded Model-Based Open-Ended Search16 Aug 2026
- 2026Training-Free Universal Approximation by Prompting Random Transformers10 Aug 2026
- 2026Privacy Vulnerabilities of Attention Layers in Tabular Foundation Models and Protection of High-Risk Queries24 Jun 2026
- 2026OpenRFM: Dissecting Relational In-Context Learning3 Jun 2026
- 2026When Correct Demonstrations Hurt: Rethinking the Role of Exemplars in In-Context Learning25 May 2026
- 2026Transformers Can Implement Preconditioned Richardson Iteration for In-Context Gaussian Kernel Regression8 May 2026
- 2026Symmetry Reveals Layerwise Dynamics: How Transformers Perform In-Context Classification13 Apr 2026
- 2026Implicit Statistical Inference in Transformers: Approximating Likelihood-Ratio Tests In-Context11 Mar 2026
- 2026Interpretable Tabular Foundation Models via In-Context Kernel Regression2 Feb 2026
- 2025Mamba Can Learn Low-Dimensional Targets In-Context via Test-Time Feature Learning14 Oct 2025
- 2025In-Context Learning for Gradient-Free Receiver Adaptation: Principles, Applications, and Theory18 Jun 2025
- 2025Understanding In-Context Learning on Structured Manifolds: Bridging Attention to Kernel Methods12 Jun 2025
12 more
- 2024What Makes In-context Learning Effective for Mathematical Reasoning: A Theoretical Analysis11 Dec 2024
- 2024On the Learn-to-Optimize Capabilities of Transformers in In-Context Sparse Recovery17 Oct 2024
- 2024Towards the Effect of Examples on In-Context Learning: A Theoretical Case Study12 Oct 2024
- 2024Revisiting In-context Learning Inference Circuit in Large Language Models6 Oct 2024
- 2024From Unstructured Data to In-Context Learning: Exploring What Tasks Can Be Learned and When31 May 2024
- 2024Does learning the right latent variables necessarily improve in-context learning?29 May 2024
- 2024Can large language models explore in-context?22 Mar 2024
- 2024Dual Operating Modes of In-Context Learning29 Feb 2024
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitzness18 Feb 2024
- 2024Visual In-Context Learning for Large Vision-Language Models18 Feb 2024
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscape2 Feb 2024
- 2023Challenges and Applications of Large Language Models19 Jul 2023
- 2024Visual In-Context Learning for Large Vision-Language Modelscited by 128
- 2024Visual In-Context Learning for Large Vision-Language Models18 Feb 2024
- 2023Challenges and Applications of Large Language Modelscited by 254
- 2024Can large language models explore in-context?cited by 76
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 46
- 2024Dual Operating Modes of In-Context Learningcited by 43
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2025Understanding In-Context Learning on Structured Manifolds: Bridging Attention to Kernel Methodscited by 15
- 2024Does learning the right latent variables necessarily improve in-context learning?cited by 13
- 2024On the Learn-to-Optimize Capabilities of Transformers in In-Context Sparse Recoverycited by 6
- 2026Interpretable Tabular Foundation Models via In-Context Kernel Regressioncited by 4
- 2026OpenRFM: Dissecting Relational In-Context Learningcited by 4
- 2024From Unstructured Data to In-Context Learning: Exploring What Tasks Can Be Learned and Whencited by 3
- 2024Towards the Effect of Examples on In-Context Learning: A Theoretical Case Studycited by 2
12 most cited of 18 All 18 (JSON)
- 2026Large Discovery Models: Empirically-grounded Model-Based Open-Ended Search16 Aug 2026
- 2026Training-Free Universal Approximation by Prompting Random Transformers10 Aug 2026
- 2026OpenRFM: Dissecting Relational In-Context Learning3 Jun 2026
- 2026When Correct Demonstrations Hurt: Rethinking the Role of Exemplars in In-Context Learning25 May 2026
- 2026Transformers Can Implement Preconditioned Richardson Iteration for In-Context Gaussian Kernel Regression8 May 2026
- 2026Symmetry Reveals Layerwise Dynamics: How Transformers Perform In-Context Classification13 Apr 2026
- 2026Interpretable Tabular Foundation Models via In-Context Kernel Regression2 Feb 2026
- 2025In-Context Learning for Gradient-Free Receiver Adaptation: Principles, Applications, and Theory18 Jun 2025
- 2025Understanding In-Context Learning on Structured Manifolds: Bridging Attention to Kernel Methods12 Jun 2025
- 2024On the Learn-to-Optimize Capabilities of Transformers in In-Context Sparse Recovery17 Oct 2024
- 2024Towards the Effect of Examples on In-Context Learning: A Theoretical Case Study12 Oct 2024
- 2024From Unstructured Data to In-Context Learning: Exploring What Tasks Can Be Learned and When31 May 2024
12 newest of 18 All 18 (JSON)