Few-shot prompting means putting a small number of worked examples inside your prompt, so the AI can copy the pattern instead of guessing what you want. Anthropic's current guidance recommends 3 to 5 examples that are relevant, diverse and clearly separated from your instructions. Google's guidance for Gemini and OpenAI's guidance agree on the core idea, but they add cautions about format consistency and about giving too many examples.
This article answers one question: how many examples should you give, and what should they look like? It covers what the three major AI companies actually say, a simple original framework for building an example set (the 3-Slot Example Set), a worked example you can adapt, and a checklist. If your prompts are failing for reasons other than missing examples, start with why ChatGPT prompts fail and the CLEAR framework.
The Short Answer
Give 3 to 5 examples when you want a specific format, tone or structure, make them resemble your real task, make them different from each other, and format them identically. That is the practical reading of Anthropic's prompting documentation, which states: "Include 3–5 examples for best results." Skip examples when the task is simple and the instruction alone is already unambiguous. The sections below explain the reasoning and the exceptions.
What "Few-Shot" Actually Means
OpenAI's documentation describes few-shot learning as a way to "steer 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," and says the model "implicitly picks up the pattern from those examples and applies it to a prompt." Anthropic calls the same technique "multishot prompting" and describes examples as "one of the most reliable ways to steer Claude's output format, tone, and structure." A prompt with no examples is often called zero-shot; a prompt with one is one-shot; a prompt with several is few-shot.
The idea is the same as showing a new colleague two or three finished samples instead of describing the style for ten minutes. If you want to understand why the model can use those samples at all, see our walkthrough of what AI does when you type a prompt: the examples sit in the context window next to your request, so the model can reference them when it writes its reply.
What Each Company Says (Checked Live on October 2, 2026)
| Source | What it says about examples |
|---|---|
| Anthropic (Claude) | Examples are "one of the most reliable ways to steer Claude's output format, tone, and structure." Make them relevant, diverse and structured, and "include 3–5 examples for best results." |
| OpenAI | Few-shot learning means including "a handful of input/output examples in the prompt"; the model "implicitly picks up the pattern." Show "a diverse range of possible inputs with the desired outputs." |
| Google (Gemini) | "We recommend to always include few-shot examples in your prompts." Experiment with the number, keep the format identical across examples, and avoid too many, which can cause overfitting. |
Notice what these sources do not say. None of them gives a universal number that works for every task. Anthropic's 3 to 5 is a recommendation for "best results"; Google explicitly says you may need to experiment. Treat the number as a starting point and test it on your own task.
The 3-Slot Example Set (Original Framework)
The documentation tells you examples should be relevant and diverse. It does not tell you how to pick them when you are starting from a blank page. The framework below is our own practical method for turning those principles into a set you can build in a few minutes. It is an interpretation, not a statement from Anthropic, OpenAI or Google.
| Slot | What goes in it | Documented principle it applies |
|---|---|---|
| 1. Typical | One example that looks exactly like your most common real input and the output you would be happy with. | "Relevant: mirror your actual use case closely" (Anthropic). |
| 2. Edge | One example of an awkward input, such as missing information, an unusually long item or an ambiguous request, with the output you would want. | "Cover edge cases" (Anthropic). |
| 3. Contrast | One example that is clearly different from the first two in topic, length or style, while keeping the same output format. | "Vary enough that Claude doesn't pick up unintended patterns" (Anthropic); "a diverse range of possible inputs" (OpenAI). |
With three slots you already meet the lower end of Anthropic's 3 to 5 range. If your task has more than one common input type, add a fourth or fifth example for each extra type rather than repeating the typical case. Anthropic also suggests you can ask the model to "evaluate your examples for relevance and diversity, or to generate additional ones based on your initial set," which is a quick way to find gaps.
Format Matters as Much as Content
Two format rules appear in the documentation and are easy to skip. First, separate examples from instructions. Anthropic recommends wrapping examples in <example> tags, with several examples inside <examples> tags, "so Claude can distinguish them from instructions." OpenAI's guide shows examples wrapped in XML tags inside the developer message. If you are using a chat app rather than the API, you can get the same effect with clear labels such as "EXAMPLE 1" and "END OF EXAMPLES."
Second, keep every example in the same shape. Google's guidance says: "Make sure that the structure and formatting of few-shot examples are the same to avoid responses with undesired formats," and points to XML tags, white space, newlines and example splitters as details to keep consistent. If example 1 uses bullets and example 2 uses a paragraph, you have effectively told the model that either is fine.
When Examples Help, and When They Don't
Examples are most useful when the thing you want is hard to describe but easy to recognize: a voice, a layout, a level of detail, a labeling scheme. They add less when the request is plain ("Translate this sentence into Spanish"). The table below is our own decision aid, based on the documented behavior that examples steer format, tone and structure.
| Your situation | Examples? | Why |
|---|---|---|
| You need a specific layout, voice or labeling scheme | Yes, 3 to 5 | Hard to describe, easy to recognize; examples steer format, tone and structure. |
| The task is simple and the instruction is unambiguous | Usually not needed | The instruction alone already carries the full request. |
| Results keep coming back in the wrong format | Add or fix examples | Inconsistent example formatting is a documented cause of unwanted output formats. |
| Outputs all start or sound the same | Diversify the examples | Similar examples can create unintended patterns or overfitting. |
The Over-Copying Risk
Examples are powerful because the model imitates them, and that is also the risk. Google's guidance warns that using too many examples may cause the model to overfit its responses to them, and Anthropic's guidance asks for diversity so the model does not "pick up unintended patterns." In practice, if all three of your examples begin with the same phrase, expect the output to begin with that phrase too. Google's documentation also observes that short, concise examples tend to lead to concise responses while detailed examples encourage more elaborate ones, so your examples set the length as well as the style.
One more point from Google's guidance is worth keeping: you can often remove instructions from the prompt if the examples are clear enough in showing the task. That does not mean you should always delete the instructions; it means that when a prompt gets long and contradictory, the examples may be doing more work than the rules.
Worked Example: Product Descriptions in a Consistent Voice
The prompt below is an illustration we wrote for this article, not a tested benchmark. The goal is a short product description for a fictional online store, in a calm, practical voice. Here is how the three slots map to it.
- Typical case: a ceramic mug, described in two sentences with one practical detail.
- Edge case: a product with very little information (only a name and size), where the example shows the writer asking for no invented details and describing only what is known.
- Contrast case: a product in a different category (a notebook), so the model does not learn that every description must mention kitchens or drinks.
You then add one line of instruction (for example: "Write in the same voice and length as the examples. Do not invent features that are not in the product details") and paste the new product below the examples with the same labels you used in the examples. The instruction states the rule; the examples show it. Because all three examples share one layout, the output is far more likely to match it.
If the result still drifts, change one thing at a time: first the examples (are they too similar?), then the formatting (is it identical across examples?), then the instruction. For jobs that need several stages, you can combine this with prompt chaining, using a different example set at each step.
A 6-Point Checklist for Your Next Few-Shot Prompt
- Are my examples close to the real task, not generic samples?
- Do they differ from each other in length, input type or difficulty?
- Is at least one of them an edge case the model might otherwise mishandle?
- Are all of them in exactly the same format, with the same labels and spacing?
- Are the examples clearly separated from my instructions?
- Have I tested the output against the examples, rather than assuming it will match?
Frequently Asked Questions
Is one example enough? It can work for simple formats, but Anthropic's recommendation is 3 to 5 for best results, and a single example gives the model no way to tell which features are essential and which are accidental. When the result copies an incidental detail, add a contrasting example.
Where do I put examples in a chat app? The documentation examples target API use, but the principle carries over: put the examples in the conversation, label them clearly and keep them in one consistent format. If you reuse the same set often, a standing instruction channel is a better home than re-pasting; our guide to system prompts versus regular prompts explains the difference.
Should I explain why my examples are good? Anthropic's guidance on instructions says that giving the reason behind an instruction can help the model deliver more targeted responses. A one-line note such as "keep it short because this will be read on a phone" is cheap context. This is an application of that documented principle, not a test result.
How do I keep my best example sets? Save them with the task they belong to. Our article on building a personal prompt library you will actually reuse shows a simple structure for storing prompts, and an example set is just another field in that card.
Want Example-Ready Prompts Without Starting From Scratch?
AI Prompt Library PRO gives you 500 ready-to-use prompts across common business tasks, so you can spend your time adding your own examples instead of writing every prompt from zero.
Get AI Prompt Library PRO — $27Sources: Anthropic, "Prompting best practices" (section "Use examples effectively") (examples steer format, tone and structure; relevant, diverse, structured; 3–5 examples; context behind instructions); Anthropic, "Multishot prompting" (same guidance); OpenAI, "Prompt engineering" guide (few-shot definition, diverse inputs, XML-wrapped examples in a developer message); Google, Gemini API "Prompt design strategies" (always include few-shot examples, experiment with number, consistent formatting, overfitting caution, examples can replace instructions). All sources checked live on October 2, 2026. The 3-Slot Example Set, the decision table, the checklist and the product-description example are our own interpretation and illustration, not statements from Anthropic, OpenAI or Google. Vendor guidance changes; check the linked pages for current wording. Last reviewed: October 2026.