Need AI Training/Help?CloudYeti.io/meet
MarkdownMe
Prompt optimizer guide

Few-Shot Prompting: Add Examples to Your Prompt

Show the model one to three input-output examples so it copies the pattern you want.

Direct answer

Few-shot prompting means including a few example input-output pairs in the prompt so the model imitates the pattern. Add one to three consistent examples that match the exact format you want. Use zero-shot for simple tasks and few-shot when tone, structure, or edge cases matter.

Open the Prompt Optimizer

When to use this

  • The model gets the task but not the format or tone you want.
  • You have a specific output shape that is hard to describe in words.
  • You want consistent results across many inputs.

Steps

  1. Describe the task, then add an Examples section.
  2. Give one to three input-output pairs in the exact format you want.
  3. Keep the examples consistent — same structure, labels, and tone.
  4. End with the real input labeled the same way as the examples.
  5. If results drift, add one more example that covers the edge case.

Example

Rough prompt idea
Task: classify support messages as Bug, Billing, or Other.
(no examples)
Optimized prompt
Task: classify support messages as Bug, Billing, or Other.

Examples:
Message: "I was charged twice" -> Billing
Message: "The app crashes on login" -> Bug
Message: "Do you have an Android app?" -> Other

Message: "My invoice total looks wrong" ->

Common mistakes

  • Inconsistent examples teach an inconsistent pattern; keep the format identical.
  • Too many examples waste tokens and can overfit to those cases; one to three is usually enough.
  • Examples that contradict your instructions confuse the model — align them.

FAQ

What is few-shot prompting?
It is adding a few example input-output pairs to your prompt so the model copies the pattern. It contrasts with zero-shot prompting, which gives no examples.
How many examples should I include?
Usually one to three. Enough to show the pattern and edge cases without wasting tokens or overfitting to the examples.
When should I use zero-shot instead?
For simple, well-known tasks where a clear instruction is enough. Reach for few-shot when format, tone, or tricky cases matter.

Related Prompt Optimizer guides