Skip to content
Ask Sera Search
Ask SeraAnswers from our guides, research and news Search
Learn
Guides
Research
Sectors
Platforms
News
Tools
About

What is in-context learning?

In-context learning is a model's ability to do a task from instructions and examples in its prompt, with no further training. The GPT-3 paper named it.

In short. In-context learning is a model's ability to do a task from instructions and examples in its prompt, without further training. The 2020 GPT-3 paper used the term, and the model's weights do not change. Larger models do it better. A 2022 study found that the format of the examples mattered more than whether their answers were correct.

On this page 7 sections

The evidence

  • Confirmed:

    The GPT-3 paper defines few-shot as giving the model a few demonstrations of a task at inference time, with no weight updates. The authors typically used 10 to 100 examples, as many as fit in a 2,048-token context window.1arXiv, May 28, 2020

  • Observed:

    Across 42 benchmarks in the GPT-3 paper, few-shot performance rose faster with model size than zero-shot performance. The authors read this as larger models being more proficient at in-context learning.1arXiv, May 28, 2020. Figure 1.3 of the paper

  • Observed:

    Randomly replacing the answers in the examples barely hurt performance on classification and multiple-choice tasks, across 12 models including GPT-3.2arXiv, Feb 25, 2022

  • Observed:

    With hundreds or thousands of examples, in-context learning gave significant gains, could override biases from pre-training and performed comparably to fine-tuning. Inference cost grew linearly with the number of examples.3arXiv, Apr 17, 2024

Confirmed by the platformObserved in data

In-context learning is why a language model can follow a new format or task from a prompt alone. AI search depends on the same ability: the model reads retrieved pages in its context and answers from them, with no retraining.

#How does in-context learning work?

The model reads the task in its prompt and continues the pattern. Language Models are Few-Shot Learners, the 2020 paper that introduced GPT-3, describes in-context learning as using the text input of a pretrained language model as a form of task specification. The model is given a natural language instruction, a few demonstrations, or both, and is expected to complete further instances of the task by predicting what comes next.1

A prompt for sentiment labels shows the idea:

Text
Review: The battery died in a day. Sentiment: negative
Review: Setup took two minutes. Sentiment: positive
Review: The screen scratches easily. Sentiment:

The model completes the last line from the pattern. The paper stresses that no gradient updates or fine-tuning take place. Google's machine learning glossary lists in-context learning as a synonym for few-shot prompting.14 What is few-shot prompting? covers how many examples providers recommend.

#What makes in-context learning work?

Model size and the shape of the examples both matter. In the GPT-3 paper, few-shot performance rose faster with model size than zero-shot performance, so larger models were more proficient at in-context learning.1

Rethinking the Role of Demonstrations, a 2022 study, tested which parts of the examples count. Randomly replacing the answers in the examples barely hurt performance across 12 models, including GPT-3. The examples helped by showing the range of possible answers, the kind of input text and the overall format.2

#How many examples can in-context learning use?

The limit is the context window. GPT-3 fit 10 to 100 examples in its 2,048-token window.1 Many-Shot In-Context Learning, a 2024 paper, used the longer windows of newer models to test hundreds or thousands of examples. It found significant gains across a wide variety of tasks, and performance comparable to fine-tuning. Inference cost grew linearly with the number of examples.3

AI search puts information into the same context. Anthropic's glossary describes retrieval-augmented generation as passing retrieved documents into the context window, where the model uses them to guide its output. This lets the model use information beyond its training data.5 Like the examples in a prompt, a retrieved page shapes one answer and leaves the model's weights unchanged. What is retrieval-augmented generation (RAG)? covers the retrieval side.

Read next

Related terms

Questions

Is in-context learning the same as few-shot prompting?

Google's machine learning glossary treats them as synonyms. The GPT-3 paper uses in-context learning more broadly, for a model given an instruction, a few examples, or both. Few-shot prompting is the case with several examples.

Does a model learn permanently from its prompt?

No. In-context learning involves no gradient updates or fine-tuning, so the model's weights do not change. The model can use the examples only while they are in its context window.

Does the model learn a new task in context, or recognize one it already knows?

The question is open. The GPT-3 authors kept their terms neutral on whether the model learns a new task at inference time or recognizes patterns it saw in training, and called this an important issue.

About this page

Researched and reviewed by Promptly Found. Reviewed Dec 1, 2026. Next review due Mar 2027.

Notes

  1. 1
    Language Models are Few-Shot LearnersarXiv · May 28, 2020 · Checked Dec 1, 2026 · Paper
  2. 2
    Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?arXiv · Feb 25, 2022 · Checked Dec 1, 2026 · Paper
  3. 3
    Many-Shot In-Context LearningarXiv · Apr 17, 2024 · Checked Dec 1, 2026 · Paper
  4. 4
    Machine Learning GlossaryGoogle for Developers · Checked Dec 1, 2026 · Primary source
  5. 5
    GlossaryClaude API documentation · Checked Dec 1, 2026 · Primary source
Cite this page
Citation style

Promptly Found. (2026, December 1). What is in-context learning? https://promptlyfound.com/glossary/in-context-learning

Revisions 1
First published.