Few-shot prompting

5 min read · Updated 2026-08-10

Few-shot prompting means putting a handful of worked examples — input and the ideal output — in the prompt before the real input. The model infers the pattern from your examples (“in-context learning”). It’s the fastest way to lock in a format or a subtle behavior that instructions alone don’t reliably produce.

When to use it

Reach for examples when the target is easier to show than to describe:

  • A precise output format the model keeps almost-but-not-quite getting right.
  • A tone or style that’s hard to specify in words.
  • Edge cases — how to handle empty input, ambiguous cases, or things it should refuse.

If clear instructions already produce reliable output (zero-shot), don’t add examples — they cost tokens and can over-constrain.

How many examples

Start at zero and add the fewest that make the output reliable — usually one to five. Diminishing returns set in fast, and too many examples can bias the model toward the surface patterns of your examples (it starts copying their phrasing or their specific values). If you find yourself needing 15 examples, that’s a signal to consider fine-tuning instead.

Choose examples deliberately

Examples are training data — a bad one teaches the wrong thing.

  • Cover the variety you expect, not three near-identical cases.
  • Include an edge case (e.g., an input where the right answer is “unknown” or a refusal).
  • Keep them correct and short. A subtly wrong example is worse than no example.
  • Balance the classes. If you show three “high priority” examples and one “low,” the model leans toward “high.”

Format them consistently

Use the same clear delimiters for every example and for the real input, so the model sees an obvious pattern to continue:

Input: "Payment failed twice, customer is furious, demo in 1 hour."
Output: { "priority": "high", "summary": "Repeated payment failures before a time-sensitive demo." }

Input: "Typo on the pricing page."
Output: { "priority": "low", "summary": "Cosmetic typo on the pricing page." }

Input: "{{ticket}}"
Output:

Consistency matters more than cleverness: the model is completing a pattern, so make the pattern unmistakable.

Few-shot vs. fine-tuning

Few-shot lives in the prompt: zero setup, instantly editable, but it costs input tokens on every call and is capped by context. Fine-tuning bakes the behavior into a model: cheaper per call and no example tokens, but it’s a training step and ties you to one model. Rule of thumb: prototype with few-shot; fine-tune only when the examples get large and the task is stable.

Checklist

  • You tried zero-shot first and only added examples where needed.
  • Examples cover the real variety, including an edge case.
  • Every example is correct and consistently formatted.
  • Classes/labels are balanced, not skewed.
  • The example block isn’t so large it dominates your token budget.

Ship these practices, don't just read them

VernaOne turns prompts into versioned, model-agnostic endpoints with structured output, evals, and automatic fallback — so the best practices here become defaults, not discipline.

Try VernaOne free →