Few-shot prompting: show the AI what good looks like
How giving one to three examples in your prompt locks in tone, structure and quality — with templates for product descriptions, data extraction and classification.
By the AiTrain editorial team · Reviewed under our editorial standards
"Few-shot prompting" simply means including a few examples of the output you want inside your prompt. It is the most reliable way to get consistent tone and format, and it often works better than paragraphs of description.
Key takeaways
- Examples communicate style more precisely than adjectives like "punchy" or "professional".
- One to three good examples are usually enough.
- Make examples varied enough that the model learns the pattern, not the specific content.
- Clearly separate examples from the new input.
Why examples work
Language models are pattern machines. If you describe the style you want, the model has to translate your description into a pattern. If you show the pattern, it can copy it directly. Telling someone "write it like our brand" is vague; handing them two past posts that nailed the brand voice is not.
Template 1: product descriptions
Write a product description in the same style as the examples.
Example 1
Product: Linen apron, natural colour
Description: Stone-washed linen that softens with every wash. Deep front pocket, adjustable neck strap, and long ties that wrap to the front. Made to be used, not saved for best.
Example 2
Product: Walnut cutting board, large
Description: One solid piece of oiled walnut, big enough for a whole loaf. Juice groove on one side, flat serving face on the other. Wipe clean, oil monthly, keep for decades.
Now write one for:
Product: Cast-iron skillet, 26 cm
Description:
Notice what the examples teach without saying it: three short sentences, concrete materials, a practical detail, and a closing line with personality.
Template 2: extracting data
Extract the company name, contact person and requested date from each message. Return one line per message as: company | person | date. Use "unknown" if missing.
Message: "Hi, this is Priya from Northfield Dental — could we book the workshop for 14 March?"
Output: Northfield Dental | Priya | 14 March
Message: "Hello, we'd like a quote for training our staff sometime in spring."
Output: unknown | unknown | spring
Message: [paste new message]
Output:
The second example is important: it shows the model what to do when information is missing, which prevents it from inventing a company name.
Template 3: classification
Classify each support ticket as Billing, Technical, Account or Other.
Ticket: "I was charged twice this month." → Billing
Ticket: "The export button does nothing on Safari." → Technical
Ticket: "How do I add a second admin?" → Account
Ticket: [new ticket] →
Common mistakes
- Examples too similar. If every example is about shoes, the model may assume everything is about shoes.
- One bad example. The model copies flaws as faithfully as strengths. Choose your best work.
- No separator. Use labels like "Example 1", "Input", "Output" so the boundary is obvious.
- Too many examples. Beyond a handful, you mostly add length. Increase only if quality is still inconsistent.
When to use zero examples
For one-off creative tasks where you want surprise, examples can limit the model. Start without them, and add examples once you know what you like.
Next step
Combine examples with the five-part prompt and save the result as a template your whole team can reuse.