Skip to main content

Prompt guides

Few-shot prompting: giving a model examples

How to use one or more examples in a prompt to show a model the pattern you want, rather than only describing it — with guidance on how many examples help and when zero-shot is enough.

All prompt guides · Last reviewed:

What "few-shot" and "zero-shot" mean

A zero-shot prompt asks for a result with no example included; a one-shot prompt includes exactly one; a few-shot prompt includes several. The terms describe how many examples are in the prompt, not a claim about accuracy — a well-written zero-shot prompt can outperform a badly chosen few-shot one, since the examples only help if they actually represent what you want.

When examples help more than a longer description would

Examples earn their place when the task has a format, tone, or pattern that is genuinely easier to demonstrate than describe — labeling data into categories that are hard to define in words, matching a specific writing voice, or following a template with quirks a plain description would miss. For a task that is already unambiguous from a short instruction, an example adds length without adding information.

What makes an example useful, not just present

An example is only as good as how representative it is of the real task — an easy or unusual example can teach the wrong pattern. A couple of well-chosen examples that cover the range of cases you actually expect, including an edge case if one is likely, tends to work better than several examples that all look alike. If your examples disagree with each other in tone or format, expect the model to blend them rather than pick the one you meant.

Questions people ask

How many examples should a few-shot prompt include?
There is no fixed number — enough to cover the range of cases you expect, often two to five, and more only if the task genuinely varies more than that. Adding examples that all look the same rarely helps past the first one or two.
Is few-shot prompting always better than zero-shot?
No. It is not published as a guaranteed accuracy gain and this page will not claim one — a clear zero-shot prompt on a well-defined task can do just as well, and examples mainly help when the task is easier to show than to describe.
Can I combine few-shot examples with a step-by-step instruction?
Yes — they address different things. Examples show the pattern or format you want; asking for step-by-step reasoning changes how the model works toward the answer. See chain-of-thought prompting, linked below, for the second technique.

Practice on a real conversation

A few-shot prompt works the same way across every model ClawAI routes to — the examples live in your prompt, not in a setting, so they travel with the conversation regardless of which provider answers it.