Few-Shot Prompting — Teaching By Example
Swipe to show menu
There are tasks where telling the AI what you want isn't enough — you need to show it. This is the core principle behind few-shot prompting: instead of (or in addition to) writing instructions, you include one or more examples of the kind of output you're looking for, and let the model use those as a template.
Few-shot prompting is one of the highest-leverage techniques available to you, especially for tasks that need to match a specific voice, format, or style that's difficult to describe in words.
How Few-Shot Prompting Works
The structure is straightforward. You provide:
- A brief instruction (the task);
- One or more examples showing input → output pairs;
- The actual input you want the model to process.
The model reads the examples, identifies the pattern, and applies it to the new input.
Example structure:
Here is how our team writes internal status updates:
Input: The API integration is delayed due to a dependency issue on the vendor side. ETA unclear. Output: API integration delayed — vendor dependency unresolved. No ETA yet. Flagged to [Owner]. Next update: Friday.
Input: Design review completed. Three minor revisions requested by stakeholders. Changes expected by end of week. Output: Design review done — 3 revisions requested. Changes due EOW. Owner: Design team.
Now apply the same format to this update: Input: The onboarding flow testing is 80% complete. Two edge cases still being resolved by the dev team. Expected completion by Thursday.
How Many Examples Do You Need?
The name "few-shot" reflects the fact that you typically don't need many examples to anchor the pattern:
- One example (one-shot) is often sufficient for simple formatting or style matching;
- Two to three examples cover most professional use cases and give the model enough variation to generalize correctly;
- More than five is rarely necessary and can make the prompt unwieldy.
The quality of your examples matters more than the quantity. One well-chosen example that clearly demonstrates the pattern is more effective than three inconsistent ones.
Choosing The Right Examples
Your examples should be:
- Representative — they should reflect the full range of what you're asking for, not just the easiest cases;
- Consistent — the style, format, and level of detail should be uniform across all examples;
- Real where possible — using examples from your actual work produces more accurate style matching than invented ones;
- Correctly formatted — the model will replicate formatting choices, including mistakes. If your example has a structural error, expect the output to as well.
When Few-Shot Prompting Is Worth The Extra Effort
Few-shot is more work to set up than zero-shot. It pays off when:
- You need output to match a specific existing voice or format (your company's writing style, a report template, a tone guide);
- Zero-shot attempts have produced outputs that are consistently close but not quite right;
- You're building a reusable prompt template that will be used repeatedly — the setup cost is a one-time investment;
- The task involves subjective quality judgments (what makes a subject line good, what makes a summary concise) that are easier to demonstrate than explain.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Few-Shot Prompting — Teaching By Example
There are tasks where telling the AI what you want isn't enough — you need to show it. This is the core principle behind few-shot prompting: instead of (or in addition to) writing instructions, you include one or more examples of the kind of output you're looking for, and let the model use those as a template.
Few-shot prompting is one of the highest-leverage techniques available to you, especially for tasks that need to match a specific voice, format, or style that's difficult to describe in words.
How Few-Shot Prompting Works
The structure is straightforward. You provide:
- A brief instruction (the task);
- One or more examples showing input → output pairs;
- The actual input you want the model to process.
The model reads the examples, identifies the pattern, and applies it to the new input.
Example structure:
Here is how our team writes internal status updates:
Input: The API integration is delayed due to a dependency issue on the vendor side. ETA unclear. Output: API integration delayed — vendor dependency unresolved. No ETA yet. Flagged to [Owner]. Next update: Friday.
Input: Design review completed. Three minor revisions requested by stakeholders. Changes expected by end of week. Output: Design review done — 3 revisions requested. Changes due EOW. Owner: Design team.
Now apply the same format to this update: Input: The onboarding flow testing is 80% complete. Two edge cases still being resolved by the dev team. Expected completion by Thursday.
How Many Examples Do You Need?
The name "few-shot" reflects the fact that you typically don't need many examples to anchor the pattern:
- One example (one-shot) is often sufficient for simple formatting or style matching;
- Two to three examples cover most professional use cases and give the model enough variation to generalize correctly;
- More than five is rarely necessary and can make the prompt unwieldy.
The quality of your examples matters more than the quantity. One well-chosen example that clearly demonstrates the pattern is more effective than three inconsistent ones.
Choosing The Right Examples
Your examples should be:
- Representative — they should reflect the full range of what you're asking for, not just the easiest cases;
- Consistent — the style, format, and level of detail should be uniform across all examples;
- Real where possible — using examples from your actual work produces more accurate style matching than invented ones;
- Correctly formatted — the model will replicate formatting choices, including mistakes. If your example has a structural error, expect the output to as well.
When Few-Shot Prompting Is Worth The Extra Effort
Few-shot is more work to set up than zero-shot. It pays off when:
- You need output to match a specific existing voice or format (your company's writing style, a report template, a tone guide);
- Zero-shot attempts have produced outputs that are consistently close but not quite right;
- You're building a reusable prompt template that will be used repeatedly — the setup cost is a one-time investment;
- The task involves subjective quality judgments (what makes a subject line good, what makes a summary concise) that are easier to demonstrate than explain.
Thanks for your feedback!