Instruction design and structured outputs · Module 1: Instruction design and structured outputs in practice
Few-shot examples and counterexamples
Learning outcome: Use examples to teach boundaries as well as style.
A few-shot prompt includes examples of the desired input and output pattern. Examples can clarify a judgement that is hard to describe, but a narrow set can teach an unintended shortcut. If every urgent message mentions a director, the model may learn seniority rather than urgency.
Choose examples that separate the actual rule from distracting details. Include a near miss and explain the deciding feature. Keep the labels consistent and do not put private real messages into a shared prompt library. Test on fresh examples that were not used to demonstrate the rule. Success on the supplied examples alone says little about generalisation.
Worked example
A fictional triage rule marks a message urgent only when a service is currently unavailable. “Director asks about next month's launch” is routine. “Reception cannot accept any calls now” is urgent. Including both breaks the shortcut that a senior sender makes a request urgent. A scheduled maintenance warning is a useful boundary case.
Try it yourself
Write two urgent and two routine fictional messages. Make one routine message sound dramatic and one urgent message sound calm. Add a fifth unseen test message.
You can do this exercise on paper. If using an assistant, keep to the fictional material and an approved tool.
Compare your approach
Label by the defined service impact, not emotion or job title. State whether planned maintenance fits the rule before testing. If the rule is ambiguous, fix the rule rather than blaming the model for guessing.
Check your understanding
Why include a dramatic message that is still routine?
- To guarantee all later classifications are correct
- To test the real urgency rule rather than emotional wording
- To make the prompt longer
Show the answer and explanation
Answer: To test the real urgency rule rather than emotional wording. The counterexample separates emotional wording from the actual urgency rule. This helps expose a shortcut; it does not guarantee the model will handle every future message correctly.
Workbook
Download the course workbook to record your answer and compare it after the knowledge check.