Input-Output Examples in Prompts
What you'll learn: How to embed formatted input-output pairs directly in your prompts to guide model behavior without full few-shot learning.
The Core Idea
When you need to show a language model exactly what format or pattern you want, you can include explicit input-output examples right in your prompt. This is lighter than traditional few-shot learning because you're using these examples primarily as format templates rather than for pattern recognition across diverse instances.
Think of it like showing someone a filled-out form before asking them to complete their own. You're not teaching them the entire task from scratch—you're showing them the expected structure.
How It Differs from Few-Shot
While few-shot prompting uses multiple examples to help the model learn the task itself, input-output examples in prompts focus on demonstrating structure and format. You might use just one or two examples, and they serve as a visual guide rather than training data.
Practical Pattern
Task: Extract product name and price from reviews.
Format example:
Input: "I love my new BlueWave headphones! Only $79.99"
Output: {"product": "BlueWave headphones", "price": "$79.99"}
Now process this:
Input: "The SmartHome Hub is amazing at $149"
Output:
Here, the example shows the JSON structure, key names, and how to extract information—without requiring multiple diverse examples for the model to "learn" extraction.
When to Use This Approach
- You need strict output formatting (JSON, CSV, specific delimiters)
- The task is straightforward but the format is particular
- You want to minimize prompt length while maintaining clarity
- You're combining this with clear task instructions from earlier prompt components
Key Takeaway: Input-output examples in prompts act as formatting blueprints, showing the model the exact structure you want without the overhead of full few-shot learning—perfect when format matters more than task learning.