25.4 Zero, one or many examples
- Approved by
- Panaversity ·
In everyday life. A teacher asks a class to write a short letter of complaint. She explains the parts, and half the letters come back with no date and no greeting. So she writes one model letter on the board. Now every letter has a date and a greeting, and every one opens with the same sentence as hers, about a late bus. One example showed the form better than her words did, and it also narrowed what the class wrote. The next week she shows three letters, about three different problems, and the class copies only what the three have in common.
What you will learn. Lab 25's prompt has no example. In Task 1 you say why its fix is a clearer instruction and not an example.
- When is no example the right number?
- What does one example add, and what does it narrow?
- How many, when two sources give two numbers?
- How do I ask for reasoning before the answer?
Why it matters. Some forms are easier to show than to say. An example is the person's first job, knowing the form, shown where words fail.
At work. INV-8340 came in a new layout. The constraint from 25.3 lists the five terms. It cannot easily say where the terms are printed on a page it has never seen. It also cannot easily say that a vendor who prints "Net 30 days" means Net 30. A person who has handled a hundred invoices knows the form from having seen it. Ana has. So the question for her is the Co-build one: which invoices would she show a new clerk on their first day?
When is no example the right number?
At the start, and for as long as the suite passes. An instruction with no example is called zero-shot. It is the cheapest prompt to send and to maintain. Start there, with clear instructions and an output constraint, and add an example only when a failure asks for one. Anthropic's advice for agents is the same: aim for "the minimal set of information that fully outlines your expected behavior".1
The prep course gives the test for when to add one. If the task is right and the structure is invented, the prompt lacks an example. If the output is clean on tested inputs and broken on a variant, it lacks an example or a constraint that names the variant.2
What does one example add, and what does it narrow?
It adds the exact form, and it narrows the answers toward itself. One example, called single-shot or one-shot, is an input paired with the correct output. It shows the form in a way a description cannot:
<example>
<invoice>
Midwest Packaging Co. Invoice INV-8301
Terms: Net 30 PO-7001
...
</invoice>
<answer>
{"number": "INV-8301", "vendorId": "V001", "terms": "Net 30",
"poNumber": "PO-7001", ...}
</answer>
</example>Its price is the late bus in the teacher's letter. Anthropic writes that "Claude 4.x and similar advanced models pay very close attention to details in examples".3 With this one example alone, the model may learn that the vendor is always V001, or that the terms are always Net 30. It may learn that every invoice has a purchase order. The example fixed the form and narrowed the answers.
How many, when two sources give two numbers?
As few as the need asks for: none, then one, then a few that differ. Several examples are called multi-shot or few-shot. The sources do not agree on the number:
| Source | What it says |
|---|---|
| Anthropic's prep course for the developer exam | One correct input and output pair is enough to show an exact shape2 |
| Anthropic's documentation | "Include 3–5 examples for best results"4 |
They disagree on the number because each answers a different need, and the need is what you choose by:
- None, while the instruction and the constraint pass the suite.
- One, when the form is wrong and the task is simple. The same article gives this order: "Start with one example (one-shot). Only add more examples (few-shot) if the output still doesn't match your needs".3
- A few, each different, when one example narrowed the output, or when hard cases need showing. The documentation asks that examples be relevant, wrapped in
<example>tags, and diverse: they should "vary enough that Claude doesn't pick up unintended patterns".4
For Brightline, different means the examples differ where real invoices differ. One is INV-8301 from Midwest Packaging Co., on Net 30, with PO-7001. One is INV-8317 from Scioto Office Products, on Net 45, with PO-7013. One is INV-8316 from Buckeye Janitorial Supply, on Net 15, with no purchase order, so that its answer shows "poNumber": null. What the three share is only the form.
Every example is sent with every call, so each one costs input tokens on every invoice. And an example must never be one of the suite's cases. A case shown to the model in the prompt no longer tests anything.
How do I ask for reasoning before the answer?
Turn on the model's own thinking, and do not ask for the reasoning in the answer. A model writes from left to right. If it works a problem through before it gives the answer, the answer can build on that work.
Native thinking is the model's own reasoning step, which the API returns apart from the answer. Prompted reasoning is asking for the reasoning in the answer's own text. On current models, choose native thinking. The documentation calls writing the reasoning out by hand a fallback, a second choice, for when thinking is off.4 It also warns: "Some models might decline a prompt that asks them to write their reasoning".4
That gives one rule for your schema. Never name a field reasoning, thinking or trace. A field with one of those names in JSON output can make the model decline, with the category reasoning_extraction. So can <thinking> tags inside your examples. A request that the model declines this way is not retried: you change the prompt.5 When you want to see why the model chose an answer, "Ask for a short explanation instead".6 Use a field named explanation, placed before the answer, as Chapter 24's judge has it.
The extraction step needs neither. It copies values from a page and decides nothing. Reasoning is worth its cost where the model must compare and decide, and the cost is tokens and time on every call.
The operating rule: start with no example. Add one to show a form, and a few different ones to stop the model copying. Let thinking carry the reasoning.
Do this now. Ask your coding agent to check the examples in one prompt. Copy this line:
Read the examples in this prompt. List what all of them have in common that is not part of the form I want, such as the same vendor, the same terms or the same length. Tell me if any example is also a test case, and if any field or tag is named reasoning, thinking or trace. Change nothing.
Check yourself
Question 1 / 7
0 answered
When is a prompt with no example, called zero-shot, the right choice?
Sources
- Owner
- Panaversity