Feedough Logo

What Is Few-Shot Prompting? Examples, Templates and Test Results

By Aashish Pahwa

13 min read

[Reader Disclosure]Our content is reader-supported. This means we may earn a commission if you click on some of our links.

Few-shot prompting means putting a few worked examples (the input, plus the output you want) in your prompt before the real task. The model copies the pattern, with no training or fine-tuning.

Reach for it when you need a fixed format, a house tone, or your own labels, and plain instructions keep missing. Show ChatGPT three past Instagram captions and ask for a fourth, and the fourth usually lands in the same style.

But more examples are not automatically better. In our classification test on gpt-4.1-mini, seven examples scored 91.7%, exactly the same as no examples at all, while one-line category definitions hit 100%.

What follows covers what examples actually teach a model, copy-ready templates you can paste today, and the cases where you should skip them.

How Few-Shot Prompting Works

Your model does not learn anything new when you add examples. It reads them as part of the prompt and keeps going in the same pattern. Researchers call this in-context learning: the task is taught by text the model sees at run time, with no training step.

The term comes from the 2020 GPT-3 paper, Language Models are Few-Shot Learners. Brown et al. at OpenAI showed a model could pick up a task from demonstrations written into its input text. Nothing was fine-tuned, and no weights were updated.

The counting is simple. No examples is zero-shot. One example is one-shot. Two or more is few-shot, also called multishot.

Here is the shape of a few-shot prompt, with the four parts marked. The task is judging app-store reviews for a food-delivery app.

1. INSTRUCTION
Classify each review as Positive, Neutral or Negative. Reply with only the label.

2. EXAMPLES (input/output pairs, same format every time)
Review: Order came 40 minutes late and cold.
Label: Negative

Review: The app works, but search never finds what I want.
Label: Neutral

Review: Fast delivery and the driver waited while I came down.
Label: Positive

3. NEW INPUT
Review: Food arrived hot and the app tracked the rider live.

4. OUTPUT (you leave this blank)
Label:

The model fills that last line. From the three pairs it picks up your label set, the input/output format and the length of the answer.

Same Task, Different Prompts: What We Found

How much do those examples actually buy you? We ran the prompts through the OpenAI API on 1 December 2026, on gpt-4.1-mini (non-reasoning) and gpt-5.4-mini (reasoning off by default). Every prompt ran three times at default settings: 552 calls in total.

Test 1 sorted 12 customer support messages into five categories (Billing, Bug, Feature request, Account access, Other), with borderline cases on purpose. Test 2 was 10 multi-step business maths problems with one exact answer each: SaaS seat billing, cafe profit, ad ROI, loan cost, equity dilution, a freelancer payout in rupees and more.

Test 1: Sorting Support Messages

Classification accuracy on the 12 messages:

Prompt variant
gpt-4.1-mini
gpt-5.4-mini
Zero-shot (no examples)
91.7%
100%
One-shot (1 example)
86.1%
100%
Few-shot (7 examples)
91.7%
100%
Zero-shot + one-line category definitions
100%
100%
Chart of Feedough's test on gpt-4.1-mini sorting 12 support messages: one-shot 86.1%, zero-shot 91.7%, few-shot with 7 examples 91.7%, zero-shot with one-line definitions 100%
Our classification test: one-line definitions beat seven examples. Tap to enlarge.

Seven examples gave gpt-4.1-mini no gain over the bare instruction. Adding one-line category definitions to the same prompt took it to full marks. gpt-5.4-mini sorted all 12 messages correctly with every prompt, so the examples added nothing on the newer model. Both models kept the exact output format 100% of the time.

This is the message that broke the example-heavy prompts.

Message: Do you offer a discount for non-profits?
Truth: Billing

gpt-4.1-mini, few-shot (7 examples), output:
Other

Definition line added:
- Billing: payments, refunds, prices, discounts, plans, cancelling or renewing a subscription.

gpt-4.1-mini, zero-shot + definitions, output:
Billing

None of the seven examples touched a discount or a pricing question. The definition named discounts under Billing, and the message sorted correctly. On this case one line of policy did what seven demonstrations did not.

Test 2: Multi-Step Business Maths

Accuracy on the 10 problems, reasoning off on both models:

Prompt variant
gpt-4.1-mini
gpt-5.4-mini
Direct (answer only)
3.3%
10%
Few-shot chain of thought (2 worked examples)
93.3%
93.3%
Zero-shot chain of thought (“Let’s think step by step”)
100%
100%
Chart of Feedough's test: on 10 maths problems, answer-only prompts scored 3.3% and 10%, worked examples 93.3%, and 'think step by step' 100%; with reasoning on, answer-only already scored 100% while 'think step by step' used 292 instead of 115 output tokens
Our maths test: what “think step by step” does with reasoning off and on. Tap to enlarge.

Answer-only prompting nearly failed outright. On the marketplace pricing problem it produced this:

Prompt: A product costs $18 to make. A marketplace takes a fee of 15% of the selling price. The seller wants the profit left after paying the fee and the product cost to equal 35% of the selling price. What selling price, in dollars, achieves this?
Reply with only the final number, nothing else.

gpt-4.1-mini output: 30
Correct answer: 36

Asking for step-by-step working fixed that. Two worked examples on top of it scored lower than step-by-step alone on both models. Three of its four misses were the multi-step SaaS seat-billing problem, and the short worked examples seem to nudge models toward short working.

These numbers come from 12 messages and 10 problems, two OpenAI models and three runs each. We also reworded one marketplace pricing question for clarity and re-ran it, after the first pass showed it could be read two ways. Treat the results as a signal, not a benchmark.

How to Write Few-Shot Examples That Help

Examples do their best work as a format and vocabulary lesson. How you write them decides whether the model learns the right one.

How Many Examples to Use

According to Anthropic’s current documentation, 3-5 examples give the best results. OpenAI’s guide suggests a handful of input/output examples, and Google says to experiment with the number of examples, because too many can make the model overfit to them. Start with three. Add one at a time only when the output drifts from what you want.

What Your Examples Really Teach

Min et al. (2022) tested 12 models, including GPT-3, and randomly swapped the labels in their demonstrations. Accuracy on classification and multiple-choice tasks barely moved. The label space, the kind of input text and the format of the sequence mattered far more than whether each label was right. So your examples mostly teach the model which labels exist, what the inputs look like and where the answer goes. If it needs to know where a boundary sits, write that boundary into the instruction.

Cover the Edge Cases, or Define Them

Going back to the support-message test: none of the seven examples touched a pricing question, and the definition line was what caught it. Examples that skip an edge case do not fix that case. Anthropic’s guidance warns the same way, since examples missing edge cases let the model pick up unintended patterns. So either add one example per tricky case, or define the boundary in words.

Keep the Format Identical, Vary Everything Else

Keep the labels, separators and answer length the same in every example. Change the content, the topics and the order of the labels, so the model does not copy one pattern or treat the last label as the default. Anthropic also wants each pair wrapped in <example> tags, inside a single <examples> block. Before you run the prompt, you can paste your examples into the prompt checker to catch inconsistencies.

One-Shot or Few-Shot?

One example is enough when the task is a shape: a JSON lead object, or the layout of a follow-up email. Use few-shot when the model must tell several categories or tones apart, like formal versus friendly replies for a D2C skincare brand. In our test, one example gave gpt-4.1-mini its lowest classification score, 86.1%. That is one task on one model, so take it as a caution rather than a rule.

Copy-Ready Few-Shot Prompting Templates

Four templates follow. Each one uses the shape from earlier: instruction, examples, new input, then a blank output line. Swap the bracketed parts for your own content and paste the whole thing into ChatGPT, Claude or Gemini.

Each template wraps its examples in <example> tags inside one <examples> block. OpenAI’s prompt engineering guide suggests a diverse range of inputs with their desired outputs, and its own sample wraps them in XML-style tags. That is why each set below mixes simple cases with a tricky one.

Marketing: Write in Your Brand Voice

Use it when you need launch captions or ads in your brand voice and the model keeps turning out generic copy.

Instruction
Write 3 launch captions for the product below. Match the voice of the examples.

<examples>
<example>
Product: Trail running shoe with a recycled sole | Caption: Built for muddy mornings. Drops Friday.
</example>
<example>
Product: Insulated coffee flask | Caption: Still hot at kickoff. Twelve hours, no plug.
</example>
<example>
Product: Plain white sneaker | Caption: One pair, every plan. Out now.
</example>
</examples>

Product: [your product, one line]
Captions:

Support and Ops: Sort Incoming Requests

Use it when a shared inbox needs every message tagged the same way. The definitions draw the lines and the third example covers refunds.

Instruction
Sort the ticket into one category:
Billing = prices, refunds, invoices, plans, cancellations
Technical issue = the product is broken
Feature request = a wanted change
Account access = login or password
Other = none of these

<examples>
<example>
Ticket: My invoice lists two seats but we have three. | Label: Billing
</example>
<example>
Ticket: The export button does nothing in Safari. | Label: Technical issue
</example>
<example>
Ticket: I paid for a year yesterday and want to cancel. Is any of it refundable? | Label: Billing
</example>
</examples>

Ticket: [paste the ticket]
Reply with only the category name.

Analysis: Pull Fields Out of Messy Feedback

Use it when you need structured fields out of free text with the same JSON keys every time.

Instruction
Pull the fields out of the feedback below. Use these keys exactly, and set a missing one to null:
{"sentiment": "Positive" | "Neutral" | "Negative", "product": string | null, "feature_request": true | false}

<examples>
<example>
Feedback: "Love the new dashboard, but it needs dark mode."
{"sentiment": "Neutral", "product": "dashboard", "feature_request": true}
</example>
<example>
Feedback: "Emailed support twice and still no reply."
{"sentiment": "Negative", "product": null, "feature_request": false}
</example>
</examples>

Feedback: "[paste feedback]"

Coding: Match Your Team’s Style

Use it when commit messages drift from your convention. Three Input/Output pairs are usually enough to set the style.

Instruction
Write one commit message for the change below, matching the examples.

<examples>
<example>
Change: added CSV export to the reports page | Output: feat(reports): add CSV export
</example>
<example>
Change: fixed the crash on an empty cart | Output: fix(cart): handle empty cart at checkout
</example>
<example>
Change: renamed user_id to account_id in billing | Output: refactor(billing): rename user_id to account_id
</example>
</examples>

Change: [describe your change]

When Few-Shot Prompting Fails (and When You Don’t Need It)

Examples can also make a prompt worse. Sometimes the right move is fewer of them, or none.

Reasoning Models Often Work Better Without Examples

OpenAI’s reasoning best practices put it plainly: reasoning models often give good results with no few-shot examples. Try your prompt without examples first. Add a few only if needed for more complex requirements, and keep them consistent with the instruction, since a mismatch can produce poor results.

Our maths runs with reasoning on back this up. On gpt-5.4-mini with reasoning_effort set to medium, the answer-only prompt scored 100%. Asking for “think step by step” scored 100% too, but output grew from 115 to 292 tokens (about 2.5x) and time from 1.4 to 2.5 seconds, for no gain. These are the only reasoning-on runs in our test; classification used reasoning off.

A 2025 study of reasoning models by Wang et al. points the same way on maths-style reasoning. Models trained with verifier-based reinforcement learning often did worse with few-shot chain-of-thought examples than with direct answering, and adding more examples kept lowering accuracy, partly because the models copied the exact steps in each example instead of carrying over the general strategy. Anthropic’s docs say worked examples can still shape how Claude approaches a problem when extended thinking is on.

Signs Your Examples Are Hurting

Read the output for copying. A marketer whose captions all come out the same length as the examples has taught the model length, not voice. Answers that drift toward one label, or mirror your example topics, show the same pull. Our maths test hints at the same pull: replies after short worked examples were shorter (155 against 234 output tokens on gpt-4.1-mini), and that is where most of the misses happened.

Skip examples entirely when:

  • Simple tasks a clear instruction already handles, like summarising or translating a line.
  • Tasks where you have no good examples to hand: poor ones teach poor patterns.
  • Long prompts where examples would crowd out the real content, like a founder asking a thinking-mode model for pricing maths.

Few-Shot Prompting vs Zero-Shot and Chain of Thought

Zero-shot is an instruction on its own. Few-shot adds worked examples to that instruction. Chain of thought asks the model to reason before it answers: one prompt line (“think step by step”) gives you zero-shot CoT, while fully worked examples give you few-shot CoT. Here is how the four compare, using the API runs above.

Technique
Best for
Token cost in our test (gpt-4.1-mini)
What we saw
Zero-shot
Summarising a meeting note
About 50 input tokens (classification)
Matched seven examples
Few-shot
Brand-voice captions or custom ticket labels
About 158 input tokens (classification, about 3x zero-shot)
No gain over zero-shot
Zero-shot chain of thought
Multi-step maths or logic, like a break-even or discount calculation
About 84 input + 234 output tokens (maths)
Best maths result, far above answer-only
Few-shot chain of thought
The same maths tasks, when you also want the working format fixed
About 236 input + 155 output tokens (maths)
Slightly below zero-shot chain of thought

The last row lines up with what Cheng et al. found. On maths reasoning with Qwen2.5 models, zero-shot can be stronger than few-shot: adding traditional chain-of-thought exemplars did not beat zero-shot CoT. The exemplars mainly aligned the output format.

So start zero-shot. Add examples when you need a set format, a house tone or your own labels. Add step-by-step when a non-reasoning model faces multi-step maths or logic. For depth, read our lessons on zero-shot prompting and chain-of-thought prompting.

Try It in Feedough’s Few-Shot Prompt Generator

If you want a working few-shot prompt without building it line by line, the few-shot prompt generator turns a task description into a structured prompt with examples you can edit. Three steps:

Feedough's Few-Shot Prompt Generator turning a support-ticket sorting task into a prompt with category definitions and labelled examples
Feedough’s Few-Shot Prompt Generator, run on the support-ticket task from our test.
  1. Describe your task and the output you want. Keep it concrete, like “sort app reviews into Praise, Complaint and Question”.
  2. Add two or three examples. Write your own, or let the generator draft a set. Then check the set covers the borderline cases you care about, the same rule as the templates above.
  3. Copy and run. Paste the prompt into ChatGPT, Claude or Gemini, try it on a few real inputs, and tweak the examples if the output drifts.

Few-Shot Prompting: Quick Answers

What is one-shot prompting?

One-shot prompting means you show the model exactly one worked example before the task. A single example is often enough to lock a format: write one email subject line in your brand voice, then ask for a second in the same style. When the model has to tell several categories or tones apart, give it more than one.

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

With zero-shot prompting, the model gets only your instructions. Few-shot prompting shows it worked examples first, and Google’s Gemini prompting docs recommend always including a few. OpenAI takes the other view: reasoning models often do fine with no examples. Test both on your own task and keep whichever output is better.

How many examples should you use in few-shot prompting?

Start with 3 to 5 examples, the range Anthropic recommends. Add one at a time and stop as soon as the output stops improving. Google’s prompt design strategies warn that too many examples can make the model overfit to them and copy their quirks instead of your task.

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

No. Few-shot learning is the wider machine-learning idea of picking up a task from very few examples. Few-shot prompting is the hands-on version: you write those examples into the prompt, and the model picks up the pattern as it reads. Researchers call this in-context learning.

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

No. Few-shot prompting changes nothing in the model; the examples live only in that one prompt and cost you nothing but tokens. Fine-tuning retrains the model on a large batch of examples, so it takes more data, more time and more money before you see a single result.

The Bottom Line

Examples teach format, tone and labels. Definitions teach boundaries. Reasoning models often need neither.

So use this rule: write a clear zero-shot prompt first. When the format or labels drift, add three to five consistent examples. When a tricky case keeps landing wrong, define that case in words. When a reasoning model already gets it right, drop the examples and keep the prompt short.

Take the prompt you use most this week and run it both ways today.

Aashish Pahwa

Aashish Pahwa

Aashish Pahwa is the founder of Feedough and Koso, an AI agency that builds custom AI systems for companies. He has trained more than 50,000 people to use AI, teaches AI to over 180,000 followers on Instagram (@okaashish), and has spoken at WordCamp Mumbai and DevFest Noida. Feedough’s work has been cited by Harvard Business School and Al Jazeera.

Read Feedough’s editorial standards

Put this to work.

Free Feedough tools for the next step.

  1. Few-shot Prompt GeneratorCreate few-shot learning prompts
  2. Zero-shot Prompt GeneratorGenerate zero-shot AI prompts
  3. Chain Of Thought Prompt GeneratorBuild step-by-step reasoning prompts
See all free tools