Modules/Module 3/Lesson 4
Lesson 4 of 8 ~10 min read

Using Examples in Your Prompt

3.4 — Using Examples in Your Prompt (Few-Shot Prompting)

Teacher showing examples on a whiteboard to students

Estimated reading time: 11 minutes


You've learned how to describe what you want with words. But sometimes the best way to explain what you want isn't to describe it — it's to show it.

This is the idea behind few-shot prompting: including one or more examples of the output you want directly inside your prompt. Instead of telling the AI "write it like this," you show the AI what "like this" actually looks like.

It sounds simple, and it is. But it's one of the most powerful techniques in prompt engineering — especially when you need consistency, a specific format, or a very particular style.


What "Few-Shot" Means

The terminology comes from machine learning, but don't let that scare you off. Here's the plain-English version:

  • Zero-shot: You give the AI a task with no examples. "Translate this sentence to French."
  • One-shot: You give the AI one example before the task. "Here's one translation I like. Do the same for this sentence."
  • Few-shot: You give the AI two to five examples. More examples means more pattern for the model to match.

In everyday use, you'll mostly use one-shot or two-shot prompting. You rarely need more than three examples for most tasks — and sometimes one is enough to completely transform the output.

Key Takeaway: Few-shot prompting teaches by example. When you can't fully describe what you want in words, showing is more powerful than telling.


Why It Works So Well

Think about how you learn in real life. If someone tells you "write a warm but professional email," you might have a vague idea of what that means. But if they show you three emails that hit that tone perfectly? Now you feel what they're going for.

AI models work similarly. When you provide examples, the model picks up on patterns you didn't explicitly describe: sentence length, paragraph structure, how formal the vocabulary is, how the ideas flow, even the kinds of sentence starters used. It reverse-engineers your style from the examples and applies it.

This is especially valuable when:

  • You have a specific voice or style you want replicated
  • You need output in a very particular format (like a recurring report or template)
  • The task involves creative judgment that's hard to describe in words
  • You're generating multiple items that need to be consistent with each other

Few-Shot Prompting in Action

Example 1: Social Media Captions

The problem: You want LinkedIn captions with a specific structure — a hook, a short insight, a practical takeaway, and a question at the end. Describing this takes a paragraph. Showing it takes one example.

Zero-shot prompt (vague):

Write a LinkedIn caption about the importance of sleep for productivity.

Result: Generic, doesn't match your style.

One-shot prompt (with example):

Write a LinkedIn caption about the importance of sleep for productivity. 
Use the same format as this example:

---
EXAMPLE:
Most people think busyness means productivity.

It doesn't.

The most effective people I know protect three things fiercely:
their mornings, their focus, and their calendar.

The rest is just noise.

What's one thing you protect that most people overlook?
---

Now write a new caption about sleep and productivity in this same style.

Result: A caption that mirrors the punchy line breaks, the direct statement, the list structure, and the closing question. Your style, not the AI's default.


Example 2: Consistent Product Descriptions

The problem: You're writing product descriptions for an online store and need them all to follow the same structure and voice.

Few-shot prompt:

Write a product description for our new item: a handmade beeswax candle, 
vanilla scent, 40-hour burn time, $28.

Here are two examples of our existing product descriptions to match:

---
EXAMPLE 1 (Lavender soy candle):
Light one. Breathe out.

Our lavender soy candle is hand-poured in small batches using 100% natural 
soy wax and pure lavender essential oil. No synthetic fragrances. No shortcuts.

45-hour burn time. Cotton wick. Reusable glass jar.

For evenings that deserve to slow down.
---

EXAMPLE 2 (Cedar & smoke candle):
Some scents take you somewhere.

This one takes you to a cabin in the woods, fire crackling, nowhere else to be.

Hand-poured with pure cedar and smoky vetiver essential oils. 50-hour burn 
time. Reusable amber glass jar.

For people who like their spaces to feel lived-in.
---

Now write a new description for the vanilla beeswax candle in the same style.

Why this works: The AI picks up on the two-word opening, the sensory language, the short factual specs, the final tagline structure, and the philosophy of the brand — all without you needing to explain any of it explicitly.

Artisan candles on a wooden table with natural light


Example 3: Categorizing and Labeling Data

The problem: You have a list of customer feedback responses and need to categorize them consistently as "Positive," "Negative," or "Neutral" — but with your specific interpretation of those categories.

Few-shot prompt:

Categorize each customer feedback item as Positive, Negative, or Neutral.
Use this classification guide:

EXAMPLES:
"Shipping was fast and everything arrived perfectly." → Positive
"The product is fine but the packaging was damaged." → Neutral  
"I waited 3 weeks and my order never arrived. Terrible experience." → Negative
"No complaints, does what it says." → Neutral
"Absolutely love it, already ordered two more!" → Positive

Now classify these new responses:

1. "Good quality but took longer than expected to arrive."
2. "Don't waste your money. Broke after one week."
3. "Works as described. Nothing special but no problems either."
4. "Outstanding customer service when I had an issue. Truly impressed."
5. "Arrived on time. Product is okay."

The examples show the AI your specific interpretations — in this case, "damaged packaging" is Neutral not Negative because the product itself was fine. Without examples, the AI would make its own judgment calls.


Example 4: Rewriting in Your Voice

This is one of the most powerful uses of few-shot prompting for individuals.

The problem: You want the AI to write in your voice, not its default style.

How to do it:

I need you to write [CONTENT TYPE] in my voice. Here are three samples of 
my actual writing so you can understand my style:

---
SAMPLE 1:
[Paste something you've written — an email, a post, a paragraph]

SAMPLE 2:
[Paste another sample]

SAMPLE 3:
[Paste a third sample]
---

Based on these samples, write [NEW CONTENT] in my same voice and style. 
Pay attention to: sentence length, how formal I am, my typical structure, 
and any distinctive phrases or patterns you notice.

This technique is a game-changer for anyone who writes regularly and wants to use AI as a genuine writing assistant — not a replacement voice.


How Many Examples Do You Need?

The short answer: start with one, add more if the output isn't matching.

Number of ExamplesBest For
0 (Zero-shot)Simple, straightforward tasks
1 (One-shot)Style matching, format matching, most everyday tasks
2-3 (Few-shot)Consistent output across multiple items, complex pattern matching
4+ (Many-shot)Rare — only when pattern is very subtle or outputs need to be highly consistent

More examples aren't always better. If you give too many examples, you risk the prompt getting too long, which can actually degrade performance. Two or three sharp, clear examples almost always beat five mediocre ones.


Where to Get Examples

You might be wondering: where do I find good examples to include?

Best sources:

  • Your own past writing (best for voice-matching)
  • Approved company documents or brand guidelines
  • Public examples of the format you want (a news headline you like, a product description style you admire)
  • An output from the AI itself that you liked ("I liked this output — use it as a style example for the next one")

That last one is particularly useful. If the AI gets something right once, tell it: "That was perfect. Use that same style for these five more items."


The Template

Here's a flexible few-shot template you can adapt for almost any task:

[TASK DESCRIPTION]

Here are [NUMBER] examples to show you what I'm looking for:

---
EXAMPLE 1:
Input: [INPUT IF APPLICABLE]
Output: [EXAMPLE OUTPUT]

EXAMPLE 2:
Input: [INPUT IF APPLICABLE]
Output: [EXAMPLE OUTPUT]
---

Now [APPLY TO NEW INPUT]:
[YOUR ACTUAL INPUT]

Or for style/voice matching:

Write [NEW CONTENT] in the same style as these examples:

EXAMPLE 1: [PASTE EXAMPLE]
EXAMPLE 2: [PASTE EXAMPLE]

Now write: [YOUR ACTUAL REQUEST]

Key Takeaway: Few-shot prompting is the fastest way to communicate a style, format, or pattern that's hard to describe in words. One good example is often worth a hundred words of description.


Practice Exercise

Pick a type of content you write regularly — social posts, client emails, weekly updates, whatever. Find two or three past examples you were happy with. Copy them. Build a prompt template that uses those examples as the style guide. Save that template somewhere you can reuse it.

This single exercise can save you enormous amounts of editing time going forward.


Next up: Lesson 3.5 — Asking AI to Think Step by Step