Many people write long prompts, complete with context, roles, and output formats, yet the AI results still feel off. The problem often lies not in the lack of detail in the instructions, but rather because the AI does not have a concrete picture of what a correct answer looks like.
This is where the example-based prompting technique comes in handy. Simply put, we not only tell the AI what to do, but also show examples of the desired results. To clarify the boundaries, we can add counterexamples: results that seem reasonable but are actually incorrect.
This technique is suitable for tasks that require consistent style, structure, or decisions—such as writing product descriptions, categorizing customer tickets, summarizing reports, or transforming rough notes into a specific format.
Why are examples often more effective than long instructions?
Human language can easily lead to multiple interpretations. For instance, if we ask the AI to write in a “concise, friendly, and professional” style, for one person, that means two short paragraphs. For another, it means one paragraph with formal language and no greetings.
Examples help reduce that interpretive space. The AI can identify patterns that need to be maintained, such as sentence length, word choice, information order, and level of formality.
Imagine asking a new coworker to fill out a report in a specific format. Explaining all the rules is helpful, but showing two or three correctly formatted reports is usually much quicker to understand.
Differentiate between positive examples and counterexamples
Positive examples are those that represent the results you want. These examples show the patterns to be followed.
Counterexamples are results that appear correct at first glance but have specific issues. Counterexamples help the AI understand limitations that are not always easy to explain with just prohibitive sentences.
For example, if you want to create a summary of customer complaints, a positive example can show a summary that focuses on the issues and actions needed. The counterexample can show a summary that repeats the customer's emotions too long or concludes something that was never mentioned.
Use counterexamples sparingly. If there are too many, the prompt can become cumbersome, and the AI may get confused about which main pattern to follow.
Prompt structure you can use directly
Here’s a simple framework you can customize:
You help me transform input into output with the following rules:Objective:[Explain the task to be done]Rules:- [First rule]- [Second rule]- [Things to avoid]Example of correct output:Input: [example input]Output: [desired example output]Example of incorrect output:Input: [example input]Output: [incorrect example output]Problem: [explain why the output is incorrect]Now work on the following input:[actual input]Example: transforming meeting notes into an action list
Suppose you have messy meeting notes and want to turn them into an action list. Don’t just ask the AI to “tidy up the notes.” Show the format of the result you need.
Transform meeting notes into an action list. For each action, display: task, responsible person, deadline, and status information. If the responsible person or deadline is not mentioned, write “not determined.” Do not guess information that is not available.
Correct example:
Notes: The content team will update the pricing page. Rina will work on it next week.
Output: Task: update the pricing page. Responsible person: Rina. Deadline: next week. Status information: ready to work on.
Incorrect example:
Output: Rina will update the pricing page next Monday.
Problem: Monday was never mentioned, so the AI should not add it.
Note that the examples not only show the format but also clarify how to handle incomplete information. This is important because AI tends to make answers sound complete, even though some details are actually guesses.
Use examples that represent real cases
Examples that are too ideal often do not help much. If your work typically involves short, ambiguous, or typo-ridden inputs, include those conditions in your examples.
For classification systems, for instance, don’t just provide examples of very clear tickets. Also include tickets that could fit into two categories. Then explain the decision you want.
- Clear example: “I cannot log in because the OTP code is not accepted.” Category: login issue.
- Ambiguous example: “The app keeps asking for the code, even though I have entered it.” Category: login issue, as the core problem still lies in the authentication process.
- Counterexample: “I want to change my phone number to receive the OTP.” Category: account data change, not a login issue.
Such ambiguous cases are often more valuable than overly simple examples because they demonstrate how to think in gray areas.
Do not create conflicting examples
If two examples provide different patterns, the AI will struggle to determine which rule is more important. For instance, one example uses formal language, while another uses casual language, yet you did not explain when each style is used.
Review your examples with three questions:
- Do all examples follow the same output format?
- Do the examples apply the same rules?
- Are the differences in results indeed caused by differences in input, not because the examples were created inconsistently?
If the answers are not clear, tidy up the examples first. A shorter but consistent prompt is usually more useful than a long prompt filled with exceptions.
Refine prompts based on error patterns
Do not keep adding instructions every time the AI results are inaccurate. Save some problematic outputs, then look for patterns in the errors.
If the AI often adds facts, include counterexamples that show that prohibition. If the AI is too lengthy, provide examples of appropriate length. If the AI misreads priorities, show examples when two pieces of information contradict each other.
This approach transforms the prompt from a growing rule document into a guide built from real experiences.
What you can do now
- Choose one AI task that often produces inconsistent answers.
- Take two outputs that you believe are correct.
- Take one output that looks good but has a significant error.
- Write a brief reason why each output is correct or incorrect.
- Incorporate those examples into the prompt and test with new input.
- Note any recurring errors, then add examples that represent those mistakes.
Examples and counterexamples are not a substitute for human judgment. Both simply make our intentions easier for the AI to read. For tasks involving sensitive data, important decisions, or factual information, results still need to be checked before use.
If the prompt is a briefing for digital workers, examples are their portfolio. The more relevant and consistent the examples provided, the less likely the AI is to guess what we mean.
– Rio Yotto @rioyotto
