What is in-context learning?
The sources describe in-context learning (ICL) as a language model carrying out a task from examples in the prompt. Seven sources define the term as follows, retrieved on 6 December 2026 and listed with their own dates:
| Source and date | Wording |
|---|---|
| IBM, “What is in-context learning?” (no visible date; page metadata 1 August 2025 and 17 November 2025) | “This is the promise of in-context learning (ICL) that enables AI models to learn tasks dynamically by simply giving examples in a prompt.” |
| Stanford AI Lab blog, Sang Michael Xie and Sewon Min (1 August 2022) | “In-context learning is a mysterious emergent behavior in large language models (LMs) where the LM performs a task just by conditioning on input-output examples, without optimizing any parameters.” |
| Garg et al., arXiv 2208.01066, version 3 (11 August 2023) | “In-context learning refers to the ability of a model to condition on a prompt sequence consisting of in-context examples (input-output pairs corresponding to some task) along with a new query input, and generate the corresponding output.” |
| Xie et al., arXiv 2111.02080, version 6 (21 July 2022) | “Large language models (LMs) such as GPT-3 have the surprising ability to do in-context learning, where the model learns to do a downstream task simply by conditioning on a prompt consisting of input-output examples.” |
| Dong et al., arXiv 2301.00234, version 6 (5 October 2024) | “With the increasing capabilities of large language models (LLMs), in-context learning (ICL) has emerged as a new paradigm for natural language processing (NLP), where LLMs make predictions based on contexts augmented with a few examples.” |
| Google Research blog, Jerry Wei and Denny Zhou (15 May 2023) | “in-context learning (ICL), a process whereby models are prompted with a few examples of input-label pairs before performing the task on an unseen evaluation example” |
| Wikipedia, “Prompt engineering” (last edited 30 November 2026) | “A model's ability to temporarily learn from prompts is known as in-context learning.” |
Six of the seven rows describe a prompt with examples. Wikipedia names no examples and speaks of learning “temporarily” from prompts.
How in-context learning works
IBM describes a prompt “that includes a set of examples (input/output pairs or in-context examples)”. According to IBM, the examples “are not used to retrain the model but are fed directly into its context window”, and “The model does not update its weights during this process.”
The Stanford AI Lab post describes the last step: “At the end of the prompt, we append a test input and allow the LM to make a prediction just by conditioning on the prompt and predicting the next tokens.”
One prompt, no weight update
1
Examples: input and output pairs
2
A new input
3
The model predicts the next tokens
4
The output; the weights stay as they were
In-context learning, few-shot prompting and other names
The examples in a prompt are the subject of the few-shot prompting entry. The table shows how far each source extends the term itself.
| Source and date | Wording |
|---|---|
| IBM, “What is in-context learning?” (no visible date) | “Importantly, prompt engineering is not a separate mechanism but a set of techniques operating within the broader concept of in-context learning.” |
| Lakera, “What is In-context Learning, and how does it work: The Beginner’s Guide” (date shown 16 November 2026; page metadata 22 September 2023) | “In-context learning (ICL) is known as few-shot learning or few-shot prompting.” |
| Olsson et al., Transformer Circuits Thread (published 8 March 2022) | “a simple heuristic measure of in-context learning: In-context learning score: the loss of the 500th token in the context minus the average loss of the 50th token in the context, averaged over dataset examples.” |
| Introduction to In-Context Learning, Interactive Robotics Lab (page without date) | “In-Context Learning (ICL) enables large language models to adjust to new tasks without changing their internal weights.” |
IBM also counts “Zero-shot prompting: the task is explained without providing any examples” under the term, while Lakera equates the term with few-shot learning. Olsson et al. use the term for a quantity they measure: a score computed from the loss at two token positions.
In-context learning and fine-tuning
IBM: “Unlike supervised learning, where a model undergoes a training phase with backpropagation to alter its parameters, ICL relies entirely on pretrained language models and keeps their parameters unchanged.” Garg et al. (version 3): “Crucially, in-context learning happens only at inference time without any parameter updates to the model.” Wikipedia (last edited 30 November 2026): “Unlike training and fine-tuning, which produce lasting changes, in-context learning is temporary.” Training that changes the weights is covered in the fine-tuning entry.
Where the change stays
Training and fine-tuning
Parameters are altered in training. Training and fine-tuning produce lasting changes.
In-context learning
The parameters stay unchanged. The effect is temporary.
Explanations in the papers
Five paper abstracts and one blog post, retrieved on 6 December 2026, give these explanations:
| Source and date | Wording |
|---|---|
| Xie et al., arXiv 2111.02080, version 6 (21 July 2022) | “At test time, in-context learning occurs when the LM also infers a shared latent concept between examples in a prompt.” |
| Olsson et al., arXiv 2209.11895, version 1 (24 September 2022) | “We present six complementary lines of evidence, arguing that induction heads may be the mechanistic source of general in-context learning in transformer models of any size.” |
| von Oswald et al., arXiv 2212.07677, version 2 (31 May 2023) | “Thus we show how trained Transformers become mesa-optimizers i.e. learn models by gradient descent in their forward pass.”, on “self-attention-only Transformers on simple regression tasks” |
| Hendel et al., arXiv 2310.15916, version 1 (24 October 2023) | “the functions learned by ICL often have a very simple structure”, with “a single ‘task vector’ calculated from the training set” |
| Pan et al., arXiv 2305.09731, version 1 (16 May 2023) | “Task recognition (TR) captures the extent to which LLMs can recognize a task through demonstrations” and “task learning (TL) is the ability to capture new input-label mappings unseen in pre-training” |
| Google Research blog (15 May 2023) | “We found that overriding prior knowledge is an emergent ability of model scale, as is the ability to learn in-context with semantically-unrelated labels.” |
Four of the five abstracts describe the state of knowledge themselves. Xie et al.: “Thus, it is unclear what enables in-context learning.” von Oswald et al.: “At present, the mechanisms of in-context learning in Transformers are not well understood and remain mostly an intuition.” Hendel et al.: “However, its underlying mechanism is still not well understood.” Pan et al.: “its mechanisms are not yet well-understood”. von Oswald et al. also relate their explanation to another one: they name “induction-head (Olsson et al., 2022)” and “show how it could be understood as a specific case of in-context learning by gradient descent learning within Transformers”.
Does the model learn?
de Wynter (arXiv 2509.10414, version 4, 11 February 2026) writes: “We argue that, mathematically, ICL fits the definition of learning; however, its full characterisation requires empirical work.” The same abstract continues: “We find that, empirically, ICL is limited in its ability to learn and generalise to unseen tasks.” Pan et al. (version 1) report: “We show that (1) models can achieve non-trivial performance with only TR, and TR does not further improve with larger models or more demonstrations; (2) LLMs acquire TL as the model scales, and TL's performance consistently improves with more demonstrations in context.”
Limits in the sources
Li et al. (arXiv 2404.02060, version 3, 12 June 2024) built a test for long prompts: “We introduce a benchmark (LongICLBench) for long in-context learning in extreme-label classification using six datasets with 28 to 174 classes and input lengths from 2K to 50K tokens.” The abstract reports that the 15 long-context models tested “perform well on less challenging classification tasks with smaller label space and shorter demonstrations”, and continues: “However, they struggle with more challenging task like Discovery with 174 labels, suggesting a gap in their ability to process long, context-rich sequences.”
Other meanings of “in-context learning”
The abbreviation ICL has other uses. Wikipedia's disambiguation page (last edited 13 March 2026) lists “Imperial College London, a UK university” and “ICL Group Ltd., an Israeli multi-national chemical company”, among others. Wikipedia redirects the title “Contextual learning” to its article “Constructivism (philosophy of education)” (last edited 28 November 2026). Outside language, the site Introduction to In-Context Learning carries the subtitle “For Language, Computer Vision, and Robotics”. This entry covers the behavior of language models.
In-context learning and related terms
Few-shot prompting. Examples in a prompt and what changes the result; the few-shot prompting entry covers them.
Fine-tuning. Extra training that changes a model's weights is the subject of the fine-tuning entry.
Context window. Everything a model can look at while writing one answer; the context window entry explains it.
Context engineering. How the parts of the context are chosen and arranged is covered in the context engineering entry.
Large language model. The pretrained models that show this behavior are described in the large language model entry.
Source
- IBM, “What is in-context learning?” (no visible date; page metadata 2025-08-01 and 2025-11-17). Source for the definition, the setup, the example and the difference from supervised learning (retrieved 2026-12-06): https://www.ibm.com/think/topics/in-context-learning
- Sang Michael Xie and Sewon Min, Stanford AI Lab blog, “How does in-context learning work? A framework for understanding the differences from traditional supervised learning” (1 August 2022). Source for the definition and the last step of the prompt (retrieved 2026-12-06): https://ai.stanford.edu/blog/understanding-incontext/
- Jerry Wei and Denny Zhou, Google Research blog, “Larger language models do in-context learning differently” (15 May 2023). Source for the definition and model scale (retrieved 2026-12-06): https://research.google/blog/larger-language-models-do-in-context-learning-differently/
- Lakera, “What is In-context Learning, and how does it work: The Beginner’s Guide” (date shown 2026-11-16; page metadata 2023-09-22). Source for the names (retrieved 2026-12-06): https://www.lakera.ai/blog/what-is-in-context-learning
- Catherine Olsson et al., “In-context Learning and Induction Heads”, Transformer Circuits Thread (published 8 March 2022). Source for the in-context learning score (retrieved 2026-12-06): https://transformer-circuits.pub/2022/in-context-learning-and-induction-heads/index.html
- Catherine Olsson et al., “In-context Learning and Induction Heads”, arXiv 2209.11895, version 1 (24 September 2022). Source for induction heads (retrieved 2026-12-06): https://arxiv.org/abs/2209.11895v1
- Sang Michael Xie et al., “An Explanation of In-context Learning as Implicit Bayesian Inference”, arXiv 2111.02080, version 6 (21 July 2022). Source for the definition and the shared latent concept (retrieved 2026-12-06): https://arxiv.org/abs/2111.02080v6
- Shivam Garg et al., “What Can Transformers Learn In-Context? A Case Study of Simple Function Classes”, arXiv 2208.01066, version 3 (11 August 2023). Source for the definition and inference time (retrieved 2026-12-06): https://arxiv.org/abs/2208.01066v3
- Qingxiu Dong et al., “A Survey on In-context Learning”, arXiv 2301.00234, version 6 (5 October 2024). Source for the definition (retrieved 2026-12-06): https://arxiv.org/abs/2301.00234v6
- Johannes von Oswald et al., “Transformers learn in-context by gradient descent”, arXiv 2212.07677, version 2 (31 May 2023). Source for gradient descent in the forward pass (retrieved 2026-12-06): https://arxiv.org/abs/2212.07677v2
- Roee Hendel et al., “In-Context Learning Creates Task Vectors”, arXiv 2310.15916, version 1 (24 October 2023). Source for task vectors (retrieved 2026-12-06): https://arxiv.org/abs/2310.15916v1
- Jane Pan et al., “What In-Context Learning ‘Learns’ In-Context: Disentangling Task Recognition and Task Learning”, arXiv 2305.09731, version 1 (16 May 2023). Source for task recognition and task learning (retrieved 2026-12-06): https://arxiv.org/abs/2305.09731v1
- Adrian de Wynter, “Is In-Context Learning Learning?”, arXiv 2509.10414, version 4 (11 February 2026). Source for whether the model learns (retrieved 2026-12-06): https://arxiv.org/abs/2509.10414v4
- Tianle Li et al., “Long-context LLMs Struggle with Long In-context Learning”, arXiv 2404.02060, version 3 (12 June 2024). Source for long prompts (retrieved 2026-12-06): https://arxiv.org/abs/2404.02060v3
- Wikipedia, “Prompt engineering” (last edited 2026-11-30). Source for the definition and the temporary effect (retrieved 2026-12-06): https://en.wikipedia.org/wiki/Prompt_engineering
- Wikipedia, “ICL” (last edited 2026-03-13). Source for the other meanings of the abbreviation (retrieved 2026-12-06): https://en.wikipedia.org/wiki/ICL
- Wikipedia, “Constructivism (philosophy of education)” (last edited 2026-11-28), reached through the redirect from “Contextual learning”. Source for the redirect (retrieved 2026-12-06): https://en.wikipedia.org/wiki/Contextual_learning
- Interactive Robotics Lab, “Introduction to In-Context Learning” (page without date). Source for the definition and the use outside language (retrieved 2026-12-06): https://intro-to-icl.github.io/
Frequently asked questions
What is the in-context learning method?
The Stanford AI Lab blog describes a model that performs a task “just by conditioning on input-output examples, without optimizing any parameters”. IBM writes that the examples “are not used to retrain the model but are fed directly into its context window”. Both describe a prompt that carries the examples, followed by a new input.
What is meant by in-context learning?
Dong et al. write that LLMs “make predictions based on contexts augmented with a few examples”. Wikipedia writes “A model's ability to temporarily learn from prompts is known as in-context learning.” Olsson et al. use a measure instead: the loss of the 500th token minus the average loss of the 50th token.
Does in-context learning really learn?
The sources look at the question from different sides. de Wynter (version 4) writes “We argue that, mathematically, ICL fits the definition of learning; however, its full characterisation requires empirical work.” Pan et al. report that models “can achieve non-trivial performance with only TR”, that is, with task recognition and without learning new mappings.
What is the difference between in-context learning and few-shot learning?
Lakera writes “In-context learning (ICL) is known as few-shot learning or few-shot prompting.” IBM places few-shot prompting inside the broader concept and lists “Zero-shot prompting: the task is explained without providing any examples” beside it. The sources do not draw one line between the two terms.
Can you provide an example of in-context learning?
IBM gives a sentiment prompt: “Review: The movie was fantastic → Sentiment: Positive Review: I hated the storyline → Sentiment: Negative Review: The music was pleasant → Sentiment:” IBM writes “The model completes the last line by predicting ‘Positive,’ continuing the structure observed in the earlier input-label mappings.”