Crafting Perfect Examples

How to design examples that teach AI exactly the right pattern.

6 min read
2 quiz questions

Not all examples are created equal. Poorly chosen examples confuse the AI; well-crafted examples teach it exactly the pattern you want. The quality of your examples is often more important than the quantity.

  1. Be consistent: All examples should follow the exact same format. If one example uses dashes and another uses bullets, the AI won't know which to follow.
  2. Show variety: Examples should cover different types of inputs so the AI learns the general pattern, not just one specific case.
  3. Include edge cases: Add one example of an unusual or tricky input so the AI knows how to handle it.
  4. Match difficulty: Your examples should be similar in complexity to the actual task.
  5. Keep them realistic: Use real or realistic data in examples, not obvious placeholders like "foo" and "bar."

If all your examples are similar, the AI overfits to that narrow pattern. Diverse examples teach the AI the abstract rule, not just specific cases.

Bad: All examples are positive reviews Input: "Great product, love it!" → Positive Input: "Amazing quality, highly recommend!" → Positive Input: "Best purchase ever!" → Positive The AI might classify everything as positive because it's never seen a negative example. Good: Examples cover all categories Input: "Great product, love it!" → Positive Input: "Broke after one week, terrible quality" → Negative Input: "It's okay, nothing special but does the job" → Neutral

Use consistent delimiters between the input and output in your examples. Common patterns include arrow notation, labeled fields, or clear line breaks.

  • Arrow notation: Input → Output
  • Labeled fields: Input: "..." / Output: "..."
  • Separator lines: --- between examples
  • Numbered examples: Example 1: ... / Example 2: ...
The format of your examples IS the instruction. If you put a blank line between each example, use the same blank line before the actual input. If you end each example with a period, end your input the same way. Consistency matters.

Well-Crafted Few-Shot Template

Shows diverse, realistic examples with consistent formatting for meeting note extraction.

Convert these meeting notes into action items. Each action item should have: an owner, a task, and a deadline.

---
Notes: "John will update the homepage copy by Friday. Sarah needs to review the Q3 budget. The team should schedule a follow-up next Tuesday."
Action items:
- John: Update homepage copy (Deadline: Friday)
- Sarah: Review Q3 budget (Deadline: not specified)
- Team: Schedule follow-up meeting (Deadline: next Tuesday)
---
Notes: "We agreed to pause the ad campaign. Mike volunteered to draft the new proposal by end of month."
Action items:
- Team: Pause ad campaign (Deadline: immediately)
- Mike: Draft new proposal (Deadline: end of month)
---
Notes: "[YOUR MEETING NOTES]"
Action items:

Prompt Templates

Edge-Case Inclusive Example Set

Template ensuring your examples cover standard, varied, and edge cases.

[TASK INSTRUCTION]

Example (standard case):
Input: [TYPICAL INPUT]
Output: [EXPECTED OUTPUT]

Example (different type):
Input: [DIFFERENT INPUT]
Output: [EXPECTED OUTPUT]

Example (edge case):
Input: [TRICKY OR UNUSUAL INPUT]
Output: [HOW TO HANDLE IT]

Now process:
Input: [YOUR ACTUAL INPUT]
Output:

Format-Teaching Examples

Forces the AI to match your exact output format by showing the pattern three times.

I want outputs formatted exactly like these examples. Match the structure, punctuation, and style precisely.

Example 1:
[COMPLETE EXAMPLE IN YOUR DESIRED FORMAT]

Example 2:
[COMPLETE EXAMPLE IN YOUR DESIRED FORMAT]

Example 3:
[COMPLETE EXAMPLE IN YOUR DESIRED FORMAT]

Now generate in the same format for:
[YOUR INPUT]

Test Your Knowledge

Knowledge Check

1 / 2

What happens when all few-shot examples are too similar?

Key Takeaways

  • Example quality matters more than quantity
  • Consistent formatting across all examples is essential
  • Diverse examples teach general patterns; similar examples cause overfitting
  • Include at least one edge case example for robustness
  • The format of your examples IS the instruction — be meticulous about consistency