We rebuilt PromptSewa — and your prompts were reset

Lesson 7 · 6 min

Few-shot examples that actually teach

One good example beats a paragraph of description — if it shows the decision, not just the format.

An example is the most compact way to communicate a pattern the model cannot infer from rules. Two or three well-chosen examples often outperform a page of instructions, because they show the mapping from input to output rather than describing it. The catch is that examples teach everything they contain, including the things you did not mean to teach.

Show the decision, not the decoration

A useful example demonstrates a judgement call: how a long complaint becomes a two-sentence summary, how a messy email becomes three action items, how a casual sentence becomes a formal one. An example that only shows the wrapper — a heading, a JSON brace — teaches the wrapper. If your examples differ only in content and never in the kind of decision, the model will copy the shape and guess the judgement.

Keep the set small and contrastive

Two examples usually beat ten. Choose them to cover the boundary: one typical case and one edge case that would otherwise be handled wrongly. Ten near-identical examples add tokens without adding information, and they increase the chance the model latches onto an incidental detail such as a particular phrasing or a date format. If you need more coverage, vary the kind of case, not the length of the list.

Match the target exactly

Format drift is contagious. If your examples use lowercase keys, the output will use lowercase keys. If they include a friendly closing line, the output will include one. That is useful when you want the style, and dangerous when the examples are sloppy. Build the examples from real accepted output, not from a quick sketch, and check that every field you require appears in at least one of them.

Example: for a classification prompt, one example of a clear case and one of an ambiguous case with the reasoning line included. The second example is the one that teaches the boundary, and it is the one people leave out.

Where examples hurt

Examples can anchor too hard. Ask for a summary and give three examples all about pricing, and a summary of a security document may drift toward pricing language. They can also leak confidential content, so never paste customer data into a prompt you share or sell. And they consume context: at some point the examples crowd out the input itself. When the input is long, prefer a clear rule plus one example over five examples and half the document.

Checklist

  • Does each example show a decision, not just a format?
  • Do the examples cover a boundary case?
  • Are the examples built from real accepted output?
  • Is the set small enough to leave room for the input?

Finished this lesson?

Mark it complete to generate a certificate you can print or save as a PDF. We ask for an email only so you can be reached — no account is created.

All lessons