Promptea

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.

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
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.
Opens on home with the prompt prefilled.
Open in Promptea
Rewrite in a specific style using examples
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]"""
Opens on home with the prompt prefilled.
Open in Promptea
FAQ
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).