Skip to content
Prompt Engineering

Few-Shot Prompting Explained: Zero-Shot, One-Shot and In-Context Learning

AIblogly Team October 12, 2026
Few-Shot Prompting Explained: Zero-Shot, One-Shot and In-Context Learning

In short: few-shot prompting means putting a few worked examples in your prompt so the AI model can see the pattern and copy it for a new input. The model is not retrained. It picks up the task from the examples within that one request, which is called in-context learning. The terms zero-shot, one-shot and few-shot come from OpenAI's 2020 GPT-3 paper; later research found that the format of the examples matters more than whether their answers are correct, and that their order can bias the result.

What is few-shot prompting, in simple words?

Few-shot prompting is teaching by example inside the prompt. Instead of describing exactly what you want, you show two or three finished examples and leave the last one blank. The model fills it in the same style.

Review: The battery lasts two days. -> positive
Review: It stopped charging after a week. -> negative
Review: Setup took five minutes. -> positive
Review: The screen scratches easily. ->

The model sees the pattern (a review, an arrow, one word) and answers "negative". No instruction such as "classify the sentiment" was needed. For other prompt-writing techniques, see the prompt engineering guide.

What is the difference between zero-shot, one-shot and few-shot?

The difference is how many examples the prompt contains: none, one, or several. The terms were set by the GPT-3 paper, Language Models are Few-Shot Learners, submitted on 28 May 2020 by Tom B. Brown and 30 co-authors at OpenAI.

SettingWhat the prompt containsExample
Zero-shotA description of the task only"Translate English to French: cheese ->"
One-shotThe description plus one example"sea otter -> loutre de mer", then "cheese ->"
Few-shotThe description plus several examplesSeveral word pairs, then "cheese ->"

In the paper, few-shot typically meant 10 to 100 examples, as many as fitted in the model's 2,048-token context window. The paper reported that performance generally improved from zero-shot to few-shot, and that the gap grew with model size.

What is in-context learning?

In-context learning is a model adapting to a task from the text in its prompt, without any change to the model itself. The GPT-3 paper evaluated its 175-billion-parameter model "without any gradient updates or fine-tuning, with tasks and few-shot demonstrations specified purely via text interaction with the model". The examples only last for that request; the next conversation starts fresh.

That is the difference from fine-tuning, which trains the model on examples and permanently changes its internal numbers (its weights). See how LLMs work for how training works.

What matters most in few-shot examples?

Research found the format of the examples and the set of possible answers matter more than whether each example's answer is correct. Rethinking the Role of Demonstrations (Sewon Min and colleagues, 2022) replaced the correct labels in few-shot examples with random ones and found performance dropped only slightly across a range of classification and multiple-choice tasks. What mattered more was that the examples showed:

  • the set of possible labels (for example "positive" and "negative");
  • the kind of input text to expect;
  • the overall format of question and answer.

Can the order of examples change the answer?

Yes. The choice and order of examples can swing accuracy widely. Calibrate Before Use (Tony Z. Zhao and colleagues, 2021) found three biases in GPT-3's few-shot answers:

  • Majority label bias: favouring whichever label appears most often in the examples.
  • Recency bias: favouring the label of the last example or examples.
  • Common token bias: favouring answers that are frequent in the model's training data.

The paper's fix, contextual calibration, measures the model's bias on a content-free input such as "N/A" and adjusts its output probabilities to cancel it.

Is few-shot prompting still used today?

Yes. Context windows have grown far beyond GPT-3's 2,048 tokens, so many more examples fit in a prompt than in 2020. Our AI models directory lists each model's current window, and our guide to tokens and context windows explains the unit. Google's prompt design guide notes that few-shot prompts are often used to regulate the formatting, phrasing and scope of a model's responses.

Few-shot examples that include written reasoning, not just answers, are the basis of chain-of-thought prompting.

Words to know

  • Zero-shot: a prompt with no examples.
  • One-shot: a prompt with one example.
  • Few-shot: a prompt with several examples.
  • In-context learning: learning a task from the prompt, without retraining.
  • Demonstration: another word for an example in the prompt.
  • Label: the answer part of an example, such as "positive".
  • Fine-tuning: further training that permanently changes a model's weights.
  • Context window: the maximum amount of text a model can read at once.

Frequently asked questions

What is few-shot prompting?+

Few-shot prompting is including a few worked examples in a prompt so an AI model can copy their pattern for a new input. The model learns the task from the examples within that request, without being retrained.

What is the difference between zero-shot and few-shot prompting?+

A zero-shot prompt describes the task with no examples. A few-shot prompt adds several examples of inputs and the outputs wanted. The terms were defined in OpenAI's 2020 GPT-3 paper, which found few-shot generally performed better and the gap grew with model size.

What is in-context learning?+

In-context learning is a model adapting to a task from the examples and instructions in its prompt, with no change to the model's weights. The adaptation lasts only for that request.

How many examples should a few-shot prompt have?+

There is no fixed number. The GPT-3 paper typically used 10 to 100 examples, as many as fitted in its 2,048-token context window. Research found the examples' format and labels matter more than their exact count.

Do the examples in a few-shot prompt need correct answers?+

A 2022 study by Sewon Min and colleagues found that replacing correct labels with random ones lowered performance only slightly on classification and multiple-choice tasks. The format, the kind of input and the set of possible labels mattered more.

Is few-shot prompting the same as fine-tuning?+

No. Few-shot prompting puts examples in the prompt and leaves the model unchanged. Fine-tuning trains the model on examples and permanently changes its weights.

Enjoyed this? Get more in your inbox.

Up to ten of the week's AI news stories, by email once a week.