# Few-shot prompting: how to show examples instead of just explaining

> Few-shot prompting uses examples inside the prompt to show the model exactly what you want — more reliable than verbal instructions alone for formatting, tone, and structure.

Source: Promptea — https://www.promptea.me/en/guides/few-shot-prompting · Language: English · Last updated: 2026-11-14

## When few-shot beats plain instructions

- When the format is hard to describe but easy to show: tables, structured labels, custom JSON shapes.
- When tone needs to be precise: formal vs. casual, technical vs. plain — examples anchor the register.
- When the task has unusual patterns the model hasn't seen in training (niche domains, internal formats).
- When you've tried zero-shot and the output is inconsistent across runs.
- When the model keeps misunderstanding the instruction despite rewording it.

## How to write effective few-shot examples

- Use 2-5 examples — enough to show the pattern, not so many that you burn tokens.
- Keep examples diverse: cover different lengths, edge cases, or content types the task might encounter.
- Show the exact input-output format you want — not a paraphrase of it.
- Use consistent delimiter markers (e.g. Input: / Output: or --- Example --- blocks) so the model sees structure.
- Place examples before the actual task, and mark the end of examples clearly.

## Templates

### Classify text with examples

```text
Classify the sentiment of each text as: Positive, Negative, or Neutral.

Examples:
Input: "The delivery was fast and the product works great."
Output: Positive

Input: "Arrived damaged and customer support didn't help."
Output: Negative

Input: "Package arrived on Tuesday."
Output: Neutral

---

Now classify these:
Input: "[text 1]"
Output:

Input: "[text 2]"
Output:

Return ONLY the classification label for each. No explanation.
```

[Open in Promptea](https://www.promptea.me/en/analyzer?prompt=Classify+the+sentiment+of+each+text+as%3A+Positive%2C+Negative%2C+or+Neutral.%0A%0AExamples%3A%0AInput%3A+%22The+delivery+was+fast+and+the+product+works+great.%22%0AOutput%3A+Positive%0A%0AInput%3A+%22Arrived+damaged+and+customer+support+didn%27t+help.%22%0AOutput%3A+Negative%0A%0AInput%3A+%22Package+arrived+on+Tuesday.%22%0AOutput%3A+Neutral%0A%0A---%0A%0ANow+classify+these%3A%0AInput%3A+%22%5Btext+1%5D%22%0AOutput%3A%0A%0AInput%3A+%22%5Btext+2%5D%22%0AOutput%3A%0A%0AReturn+ONLY+the+classification+label+for+each.+No+explanation.&purpose=data&target=gpt)

### Rewrite in a specific style using examples

```text
Rewrite the text in the style shown by the examples below.

Style characteristics shown in examples:
- [e.g. short sentences, active voice, no jargon, direct address]

Example 1:
Original: "The implementation of the new feature requires coordination between multiple stakeholders."
Rewritten: "This feature needs three teams to sync. Set up a kickoff this week."

Example 2:
Original: "There are several considerations that must be taken into account before proceeding."
Rewritten: "Check these three things before you start: [list them]."

---

Now rewrite this text:
"""[paste your text]"""
```

[Open in Promptea](https://www.promptea.me/en/analyzer?prompt=Rewrite+the+text+in+the+style+shown+by+the+examples+below.%0A%0AStyle+characteristics+shown+in+examples%3A%0A-+%5Be.g.+short+sentences%2C+active+voice%2C+no+jargon%2C+direct+address%5D%0A%0AExample+1%3A%0AOriginal%3A+%22The+implementation+of+the+new+feature+requires+coordination+between+multiple+stakeholders.%22%0ARewritten%3A+%22This+feature+needs+three+teams+to+sync.+Set+up+a+kickoff+this+week.%22%0A%0AExample+2%3A%0AOriginal%3A+%22There+are+several+considerations+that+must+be+taken+into+account+before+proceeding.%22%0ARewritten%3A+%22Check+these+three+things+before+you+start%3A+%5Blist+them%5D.%22%0A%0A---%0A%0ANow+rewrite+this+text%3A%0A%22%22%22%5Bpaste+your+text%5D%22%22%22&purpose=text&target=claude)

## Frequently asked questions

### How many examples should I include?

2-3 examples cover most cases. More than 5 rarely improves results and burns token budget. The quality of examples matters more than quantity — diverse, representative examples beat many similar ones.

### Can few-shot prompting fix hallucinations?

Not directly, but it helps with format hallucinations — cases where the model invents fields, adds extra text, or uses the wrong structure. For factual accuracy, you still need grounding (citing sources or providing reference data).
