Few-shot prompting is a technique where you include a few example inputs and their correct outputs in a prompt, so the model infers the pattern and applies it to a new input. OpenAI's prompt engineering guide describes it as steering "a large language model toward a new task by including a handful of input/output examples in the prompt, rather than fine-tuning the model."
This guide explains how few-shot prompts work, how many examples to use, how to choose them, and what changes on current reasoning models, using guidance from Anthropic, OpenAI and Google checked on 26 October 2026.
What is the difference between zero-shot, one-shot and few-shot prompting?
The number of examples. Google's prompt design strategies define the terms: "Prompts that contain a few examples are called few-shot prompts, while prompts that provide no examples are called zero-shot prompts." One-shot is the case in between, with a single example.
| Type | Examples in the prompt | Good for |
|---|---|---|
| Zero-shot | None | Common tasks the model already does well; first attempts on reasoning models |
| One-shot | One | Showing a format when variety does not matter |
| Few-shot | Several, usually varied | Fixing format, tone, labels or edge-case handling |
Google says few-shot prompts "are often used to regulate the formatting, phrasing, scoping, or general patterning of model responses." Anthropic's names for the same idea are few-shot or multishot prompting.
Why do examples work so well?
Because showing is often clearer than telling. OpenAI says the model "implicitly "picks up" the pattern from those examples and applies it to a prompt." Anthropic's prompting best practices call examples "one of the most reliable ways to steer Claude's output format, tone, and structure," and say a few well-crafted examples "improve accuracy and consistency."
Google takes the strongest position of the three: "We recommend to always include few-shot examples in your prompts. Prompts without few-shot examples are likely to be less effective." It adds that "you can remove instructions from your prompt if your examples are clear enough in showing the task at hand."
Google's guide shows the effect with a pair of prompts. Asked to pick the better of two explanations with no examples, the model chose the longer one. After two examples that preferred short explanations, it chose the shorter one. The task was the same; the examples changed the result.
What does a few-shot prompt look like?
Instructions, then clearly marked examples, then the new input. Anthropic suggests wrapping each example in <example> tags and the set in <examples> tags "so Claude can distinguish them from instructions." Here is a support-ticket classifier:
Classify each support ticket as billing, bug, feature_request or account.
Reply with the label only.
<examples>
<example>
Ticket: I was charged twice for the October invoice.
Label: billing
</example>
<example>
Ticket: The export button does nothing in Safari.
Label: bug
</example>
<example>
Ticket: Can you add SSO with Okta?
Label: feature_request
</example>
<example>
Ticket: I need to change the email on my login.
Label: account
</example>
</examples>
Ticket: {{ticket}}
Label:
OpenAI suggests putting examples in the developer message, the instructions your application sends ahead of user input. Its recommended layout for a developer message is identity, instructions, examples, then context. For where that message lives in each API, see what is a system prompt.
How many examples should you include?
Start small and test. The vendors give slightly different guidance:
- Anthropic recommends three to five examples for best results, and suggests you can ask Claude to check your examples for relevance and diversity or to generate more from your initial set.
- Google says models "can often pick up on patterns using a few examples," but warns that "if you include too many examples, the model may start to overfit the response to the examples."
- OpenAI, for reasoning models, says "Try zero shot first, then few shot if needed."
Every example also costs input tokens on every request. If your examples are long, see whether prompt caching applies: OpenAI recommends keeping content you reuse at the start of the prompt so the cache can reuse it.
How do you choose good examples?
Anthropic lists three properties. Make examples:
- Relevant: "Mirror your actual use case closely."
- Diverse: "Cover edge cases and vary enough that Claude doesn't pick up unintended patterns."
- Structured: Wrapped in tags so they are clearly separate from instructions.
Two more rules come from the other guides. Google stresses consistent formatting: "ensure a consistent format across all examples, especially paying attention to XML tags, white spaces, newlines, and example splitters." OpenAI warns that examples must agree with your instructions: "Just ensure that the examples align very closely with your prompt instructions, as discrepancies between the two may produce poor results."
Common mistakes that follow from these rules:
- All examples look alike. If every example ticket is short, the model may mislabel long ones. Vary length, wording and difficulty.
- One label dominates. If three of four examples are
bug, the model may lean towardbug. Balance the set. - Examples break your own rules. If the instruction says "label only" but an example adds a sentence, expect sentences.
- Examples include real customer data. Use realistic but invented content.
Does few-shot prompting work with reasoning models?
Yes, and the advice shifts slightly. OpenAI's reasoning best practices say "Reasoning models often don't need few-shot examples to produce good results, so try to write prompts without examples first," then add examples only for "more complex requirements for your desired output."
Anthropic is more positive about combining the two: "Multishot examples work with thinking. Worked examples in your prompt shape how Claude approaches similar problems in its own thinking blocks. Present each example as a problem, the method to apply, and the expected answer."
On current Claude models, one thing to avoid in examples is a visible reasoning section. Anthropic says prompts that ask some of its newest models to write their reasoning into tags such as <thinking> may be declined, so show the method and answer in your examples rather than a private scratchpad. Chain of thought prompting covers this in detail.
When are examples the wrong tool?
When you need a guarantee. Examples make a format likely; they do not make it certain. If your code parses the output, use schema-based structured output, which constrains the response to a JSON Schema. Google's own prompting guide shows a prompt-only JSON example for a simple order, then recommends its structured output feature "when specifying a more complex JSON Schema for the response."
Examples are also a poor fit when the right answer depends on facts the model does not have. Put those facts in the prompt as context, or retrieve them, as described in what is RAG.
And if you have thousands of examples and a stable task, fine-tuning may be worth evaluating where your provider offers it. OpenAI positions few-shot learning as the alternative to fine-tuning for steering a model toward a new task.
Where should you keep few-shot prompts?
A good set of examples takes time to build, so keep it with the prompt it belongs to. Kipt stores prompts as Markdown files in a private GitHub repo you own, with {{name}} blanks for the new input, so the example set you tested travels with the instructions it was tuned for.
What should you read next?
The prompt engineering guide covers the other core techniques. Chain of thought prompting explains worked examples on reasoning models. For ready-to-adapt prompts, browse prompt templates.