Few-shot examples, input boundaries and acceptance criteria
Choose between zero-shot and few-shot prompts, fence off input with clear delimiters and test the examples for contradictions and gaps.
By Invicly Tech, , in Prompt Engineering and Vibe Coding. About 9 minutes to read.
In short
Examples show a model the pattern you want, and delimiters such as tags or fences show where your instructions end and the data begins. Acceptance criteria turn 'good answer' into a checklist. Together they make answers more consistent and easier to test.
Think of it like this: An example is like showing a new cook a finished dish; a delimiter is like a labelled tray that keeps the ingredients apart from the recipe.
Explained simply
Sometimes it is easier to show than to tell. A few-shot prompt includes a small number of examples: an input and the answer you want for it. The model follows the pattern. A zero-shot prompt has instructions only and no examples.
Examples are powerful, so they need care. If your examples all look alike, the model learns that every input looks like that. If two examples disagree, for instance one ends with a thank-you line and one does not, the model may copy either.
Your prompt usually also contains text you do not control, such as an email or a web page. Wrap it in delimiters, which are marks like XML-style tags or triple backticks. This shows the model where the data starts and stops. It also makes it harder for the data to be mistaken for your instructions.
Finally, write acceptance criteria. These are yes or no rules for a good answer, such as 'one label from the list' or 'no more than 60 words'. They help you and the model know when the job is done.
Press Play on a diagram to walk through it one step at a time.
- Instructions only, no examples
- Short and cheap
- Fine for common, simple tasks
- Format may drift
- Instructions plus 2 to 5 examples
- Longer prompt
- Locks in tone and format
- Examples must not contradict each other
- 1Instructions
What to do and the rules
- 2Examples in tags
Input and expected output pairs
- 3Input in tags
The untrusted or variable text
- 4Acceptance criteria
A checklist the answer must pass
- Data looks like instructions
- Easy to misread
- Hard to reuse the prompt
- Clear start and end
- Named in the instructions
- Template stays reusable
In depth
Zero-shot first, few-shot when needed
Start with clear instructions and no examples. Modern models do well on common tasks like summarising or translating. If the answer has the wrong format, tone or label set, add examples.
Two to five examples is a common range. More examples cost tokens and can make the prompt rigid. Put examples in their own tags so the model can tell them apart from the real input. Use the same format in every example, and make the final input look exactly like the example inputs, with the answer left open.
- Start zero-shot, add examples when output drifts
- Use two to five examples
- Wrap examples in their own tags
- Keep the layout identical across examples
Choosing examples that cover the edges
Pick examples to teach the hard parts, not the easy ones. For a label task with billing, bug and other, include a message that looks like billing but is a bug, one that is empty, and one that mixes two topics. Say in the prompt what to do with the mixed case.
Vary the examples on purpose: different lengths, different wording, different labels. If every example is a short polite message, the model may fail on a long angry one. Keep a note of why each example is there.
- Clear cases
- Plain billing
- Plain bug
- Look-alikes
- Payment page crashes: bug, not billing
- Odd inputs
- Empty message
- Mixed topics
- Other language
Delimiters keep data and instructions apart
Tags such as a message tag with an opening and closing mark, or fenced blocks, mark exactly what the model should treat as data. Name the tags in your instructions: 'The text to label is inside the message tags.' Use clear, consistent names and nest them if the content has parts.
Delimiters are not a security wall. A determined input can still try to give orders. They do make the structure clear and reduce accidents, and later modules cover untrusted content in more depth.
Acceptance criteria and testing the examples
Acceptance criteria are a checklist of yes or no rules: the label is one of three; the reply is under 60 words; no personal data is repeated. Put them in the prompt and use the same list when you review answers.
Then test your examples. Read them in pairs and ask: would these two ever give different answers for the same input? Look for gaps by writing three inputs that match none of your examples and see what the model does. Fix the examples or add a rule, then run again.
- 1Write examples
Cover easy and hard cases
- 2Read in pairs
Look for contradictions
- 3Add unseen inputs
Find gaps
- 4Check criteria
Yes or no per rule
- 5Fix and rerun
One change at a time
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Compare zero-shot and few-shot prompts~30m
- 2Pick examples that cover the edge cases~30m
- 3Delimit input with tags or fences~30m
- 4Write acceptance criteria for the answer~30m
- 5Find contradictions and gaps in examples~30m
Key points
- Try zero-shot first. Add examples when the format or tone keeps coming out wrong.
- Pick examples that cover the edge cases: empty input, odd wording, the case that looks like another label.
- Wrap the input in tags or fences so the model treats it as data, not as new instructions.
- Write acceptance criteria you can check yes or no: 'under 60 words', 'one label from the list'.
- Read your examples side by side. If two disagree, the model will pick one at random.
Key terms
Tap a card to flip it. 0/5 known
Examples
Label each message as billing, bug or other. Reply with the label only.
<example>
<message>I was charged twice this month.</message>
<label>billing</label>
</example>
<example>
<message>The export button crashes the app.</message>
<label>bug</label>
</example>
<message>
Do you have a student discount?
</message>Few-shot labelling with fenced input.
Fixing a contradiction between examples
A prompt labels messages as billing, bug or other. Example 1 labels 'The app charged me and crashed' as billing. Example 3 labels 'Checkout crashed when I paid' as bug. These two overlap. Step 1: spot the overlap by reading side by side. Step 2: decide the rule, for instance 'if the app crashes, label it bug, even if money is mentioned'. Step 3: write the rule in the instructions. Step 4: change example 1 to match, then rerun your test inputs.
Rules:
- If the app crashes or errors, label bug, even if money is mentioned.
- Questions about prices or invoices without an error are billing.
- Anything else is other.Acceptance criteria for a summary
You ask for a summary of meeting notes. Write criteria first: at most 5 bullets, each under 20 words, every action item has an owner, no names that are not in the notes. After the model answers, tick each rule. If an item fails, add that rule to the prompt rather than only fixing this one answer, so the next run is better too.
Quick reference
- Zero-shot: instructions only. Few-shot: instructions plus examples
- Start zero-shot. Add two to five examples if output drifts
- Cover look-alike and odd inputs, not only easy ones
- Wrap examples and input in tags and name them in the text
- Use the same layout in every example
- Write acceptance criteria as yes or no rules
- Read examples in pairs to find contradictions
Common mistakes
- Using only easy examples, so the model fails on the first odd input.
- Examples that disagree, such as one with a polite closing line and one without.
- Putting user text straight into the instructions with no fence around it.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Write a zero-shot prompt that labels a message as billing, bug or other. Then list two inputs that might confuse it.
- Exercise 2medium
Turn your prompt into a few-shot prompt with three examples, using tags, and add one rule for the confusing case.
- Exercise 3hard
Create 8 test inputs for your few-shot prompt, including 3 that match no example. Run them, record results and fix one problem you find.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- How many examples should I use?
- Two to five is common. Add one only when it teaches something the others do not.
- Do delimiters stop prompt injection?
- No. They make structure clear and reduce mistakes, but they are not a complete defence against hostile text.
- Can examples hurt?
- Yes. Models copy the pattern closely, so narrow or contradictory examples can limit or confuse the answers.