Working With AI

Teaching by Example: Why a Few Good Samples Beat a Long Instruction

A practitioner guide to few-shot prompting (in-context learning): teaching an AI system your standard by showing it examples instead of describing rules.

Free, no email requiredRead onlineWorking With AI

Who it is for

People who already use AI and want more consistent output.

After reading it

You will know how to pick examples that cover the real range, when to show versus describe, and when an explicit rule is still required.

Describing a standard in words is hard. Showing it is easier, and often works better. The technique has a name: few-shot prompting, also called in-context learning. You give the model a small number of example input-and-output pairs inside the prompt, and it infers the pattern from them. No retraining is involved. The examples do the teaching.

Why a few good examples beat a long rule

A written rule like "keep the tone warm but professional" leaves a lot open. Warm to whom? Professional how? Three or four worked examples pin it down in a way sentences struggle to. A model shown a handful of good before-and-after pairs will usually match your standard more closely than one handed a paragraph of description, because it can see the target instead of interpreting a description of it.

Pick examples that cover the range

The common mistake is to show only easy cases. If every example is a clean, simple one, the model learns to handle clean, simple ones and stumbles on the rest. Choose examples that span the real range: a short case and a long one, a friendly reply and a firm one, the ordinary case and the awkward edge. The spread is what teaches judgment, not just format.

Show, do not describe

Compare these two ways of asking for a better tone. The first describes:

Rewrite this to sound more approachable.

The second shows:

Here are two rewrites in the voice I want:
Before: "Your appointment is confirmed for 2pm." After: "You are all set for 2pm. I will see you then."
Before: "Payment is required prior to service." After: "I collect payment before we start, so we can keep the visit simple."
Now rewrite this one in the same voice: "Documents must be submitted 24 hours in advance."

The second gives the model a pattern to match. It will produce something in the same register, because it has two concrete points to triangulate from.

When examples are not enough

Examples teach a pattern, but some things need an explicit rule. If there is a hard constraint, a phrase you never use, a legal line you cannot cross, a format that must be exact, state it as a rule in addition to the examples. Examples shape the style. Rules enforce the non-negotiables. Use both when the stakes are high, and when an AI assistant drafts against them, keep a person on the approval step for anything that goes out under your name.

Where this leaves you

If you have ever said "just do it like this one," you already understand few-shot prompting. Collect three to eight good examples that cover the real range, show them instead of describing them, and add an explicit rule where a rule is required. That is often the fastest way to get an AI system to meet your standard.