TokenPad

Prompting

Few-shot prompting

Few-shot prompting supplies a handful of worked examples in the prompt so the model infers the pattern rather than being told it.

Also written: in-context learning

Two or three well-chosen examples routinely outperform several paragraphs of instruction, particularly for output format compliance. Showing the shape is more reliable than describing it.

They are also the most expensive part of a prompt per unit of instruction, and they are resent on every request — which makes the trade worth making deliberately.

In practice

One example gets copied as a template. Two or more communicate a pattern. The example that earns its tokens is a hard case, not a third easy one — and if an example and an instruction disagree, the example wins silently, which is why a stale example is worse than a missing one.

Common questions

How many examples should I include?

Two to five for most tasks. One gets copied as a template rather than read as a pattern. Past five, returns fall off quickly while every request keeps paying for the tokens.

What makes a good example?

A hard case, formatted exactly as the instructions describe. Easy examples confirm the model already knew what to do, and where an example contradicts an instruction, the example wins silently.

Measure it

More in Prompting