← Back to list

Zero-Shot, One-Shot, and Few-Shot Prompting Guide

Prompting is the way you tell an AI model what you want it to do. A good prompt gives the model enough direction to produce a useful…

QuarkAndCode · 2026-07-01 11:01 · 2 claps · 13.4 min read paywalled
#ai-prompting #few-shot-prompting #zero-shot-learning #prompt-engineering #ai-workflow
Open on Medium ↗
Wiki topics: PE · Prompt Engineering EDU · Education & Learning

Zero-Shot, One-Shot, and Few-Shot Prompting Guide

Prompting is the way you tell an AI model what you want it to do. A good prompt gives the model enough direction to produce a useful answer, whether you are asking it to summarize an article, write an email, classify customer feedback, extract data, or explain a difficult topic.

One of the easiest ways to improve prompts is by using examples. In AI prompting, a “shot” means an example. That is why you will often hear people talk about zero-shot, one-shot, and few-shot prompting.

The difference is simple:

These methods do not permanently train the model. They only guide the model within the current prompt or conversation. Think of them as giving instructions in different levels of detail.

Zero-shot says, “Do this.”

One-shot says, “Do this, and here is one example.”

Few-shot says, “Do this, and here are several examples to follow.”

What Is Zero-Shot Prompting?

Zero-shot prompting means asking the model to complete a task without giving it any examples first. You provide the instruction, add any necessary context, and let the model use its general knowledge and language ability to respond.

A simple zero-shot prompt might look like this:

Summarize the following article in five bullet points.

Article:
[Paste article here]

Another example:

Classify this customer review as Positive, Negative, or Neutral.

Review:
"The headphones sound great, but the battery only lasts two hours."

In both cases, the model receives no input or output samples. It has to understand the task from the instruction alone.

Zero-shot prompting is usually the best place to start because it is quick, clean, and efficient. You do not need to spend extra space on examples unless the task requires them.

When Zero-Shot Prompting Works Best

Zero-shot prompting works well when the task is clear and common. For example, you can often use it for:

· Summarizing text

· Rewriting sentences

· Translating content

· Brainstorming ideas

· Drafting emails

· Explaining basic concepts

· Extracting simple information

· Classifying straightforward text

The key is to be specific. A vague prompt gives the model too much room to guess.

Weak prompt: Write about email marketing.

Stronger prompt: Write a beginner-friendly guide to email marketing for small online store owners. Use a warm, practical tone. Include sections on building an email list, welcome emails, customer segmentation, and measuring results.

The second prompt is better because it gives the model a clear audience, topic, tone, and structure. It does not leave the model wondering what kind of article you want.

How to Write a Good Zero-Shot Prompt

A strong zero-shot prompt usually includes four things:

The task: What do you want the model to do?

The context: Who is the content for, and what background should the model know?

The format: Should the answer be a paragraph, list, table, email, JSON, script, or article?

The constraints: Are there rules about tone, length, style, audience, or what to avoid?

Here is a useful format:

Task: Explain zero-shot prompting.

Audience: Beginner marketers who use AI tools but do not have a technical background.

Format: Short article with headings and examples.

Style: Friendly, clear, and practical.

Constraints: Avoid jargon. Keep the explanation under 800 words.

This kind of prompt is effective because it clears up any confusion. Rather than just asking for a “good article,” you explain what “good” actually means.

Zero-shot prompting can fail when a task seems simple but has hidden expectations. For example, if you ask to “extract the important details,” it might sound clear, but the model still needs to know what you consider important. Are you looking for names, dates, prices, risks, action items, product features, or everything?

The more specific your instruction, the better the result.

What Is One-Shot Prompting?

One-shot prompting means giving the model one example before asking it to complete a similar task. The example acts as a demonstration.

Here is a simple one-shot prompt:

Rewrite product descriptions in a warmer, more helpful tone.

Example:

Input: This backpack has 20L capacity, water-resistant fabric, and padded straps.

Output: A practical everyday backpack with enough room for your essentials, water-resistant fabric for unpredictable weather, and padded straps that make it comfortable to carry.

Now rewrite this:

Input: This desk lamp has adjustable brightness, USB charging, and a flexible neck.

Output:

The model can now see the type of answer you want. It understands the tone, sentence structure, and level of detail more clearly than it would from the instruction alone.

One-shot prompting is useful when the task is not difficult, but the style or format matters.

When One-Shot Prompting Works Best

One-shot prompting is a good middle ground between a simple instruction and a longer few-shot prompt. Use it when zero-shot prompting yields a decent answer but not quite the one you want.

One-shot prompting is especially helpful when you want the model to:

· Match a certain tone.

· Follow a specific structure.

· Use a particular output format.

· Rewrite text in a consistent style.

· Understand how you define a label or category.

· Produce responses that follow a clear pattern.

For example, suppose you want to classify support tickets by urgency. The word “urgent” can mean different things to different teams. A single example can help anchor the meaning.

Classify support tickets as Low, Medium, or High urgency.

Example:
Ticket: "Our checkout page is down and customers cannot place orders."
Urgency: High

Now classify this ticket:
Ticket: "Can you update the spelling of our company name on the invoice template?"
Urgency:

The example shows that a business-blocking issue is “High” urgency. The model can use that pattern when judging the next ticket.

What Is Few-Shot Prompting?

Few-shot prompting means giving the model several examples before asking it to complete the task. These examples show the model the pattern you want it to follow.

A few-shot prompt might look like this:

Classify each customer review as Positive, Negative, or Neutral.

Example 1:
Review: "The setup was easy and the app works perfectly."
Label: Positive

Example 2:
Review: "The product arrived late, and the box was damaged."
Label: Negative

Example 3:
Review: "It works fine, but I expected better battery life."
Label: Neutral

Now classify this:
Review: "The camera quality is excellent, but the microphone sounds muffled."
Label:

Few-shot prompting gives the model more guidance than one-shot prompting. Instead of relying on a single example, the model can compare multiple examples and learn the pattern more reliably.

This is especially useful when the task involves custom rules, subtle differences, or edge cases.

Why Few-Shot Prompting Works

Few-shot prompting works because AI models are good at recognizing and continuing patterns. When you provide several examples, you are not just telling the model what to do. You are showing it what a correct answer looks like.

This is helpful when the task depends on your own standard. For example, a business may have specific rules for tagging customer feedback, qualifying leads, writing product descriptions, reviewing applications, or summarizing sales calls.

A generic instruction may not capture those preferences. A few strong examples often can.

For instance, the instruction “classify this lead as qualified or unqualified” is not enough by itself. One company may consider a lead qualified if the lead has budget and decision-making authority. Another may care more about company size, industry, or timeline. Few-shot examples can show the model how your organization makes that decision.

Zero-Shot vs. One-Shot vs. Few-Shot Prompting

The main difference is the amount of guidance you provide.

Zero-shot prompting gives the model a direct instruction with no examples.

One-shot prompting gives the model one example to follow.

Few-shot prompting provides the model with multiple examples, enabling it to recognize stronger patterns.

A simple way to choose is this:

Use zero-shot prompting when the task is clear, simple, and familiar.

Use one-shot prompting when you need to show a specific tone, format, or style.

Use few-shot prompting when consistency matters or when the task includes custom rules, tricky categories, or edge cases.

The best approach is usually to start simple. Try zero-shot first. If the result is not consistent enough, add one example. If one example is still not enough, use a few carefully chosen examples.

Practical Example: Extracting Product Details

Suppose you want the model to extract product information from a short description.

A zero-shot prompt could be:

Extract the product name, price, color, and warranty from the text below.

Text:
The AeroLite Carry-On comes in navy blue, costs $129, and includes a two-year warranty.

Return the answer as JSON.

This may work well for a simple input. But what happens when a detail is missing? What should the JSON keys be called? Should missing information be left blank, written as “not available,” or marked as null?

A few-shot prompt can make the rules clearer:

Extract product details from each text.

Return JSON using these keys:
product_name, price, color, warranty

If a detail is missing, use null.

Example 1:
Text: The Terra Mug is available in forest green for $24. It includes a 1-year warranty.
JSON:
{
  "product_name": "Terra Mug",
  "price": "$24",
  "color": "forest green",
  "warranty": "1-year warranty"
}

Example 2:
Text: The CloudDesk Pro costs $399 and comes with a 3-year warranty.
JSON:
{
  "product_name": "CloudDesk Pro",
  "price": "$399",
  "color": null,
  "warranty": "3-year warranty"
}

Now extract the details:
Text: The AeroLite Carry-On comes in navy blue, costs $129, and includes a two-year warranty.
JSON:

This version is longer but also more reliable. The examples show the exact format, the expected keys, and how to handle missing information.

The Anatomy of a Strong Few-Shot Prompt

A good few-shot prompt is not just a collection of examples. It should be organized clearly so the model can understand the task, the rules, and the expected output.

A strong few-shot prompt usually includes:

  1. A short role or context

  2. A clear task instruction

  3. Output rules

  4. Examples

  5. The new input

  6. A clear place for the answer

Here is a reusable template:

You are helping classify customer feedback for a product team.

Task:
Classify each message into one of these categories:
- Bug
- Feature Request
- Pricing
- Usability
- Other

Rules:
- Return only the category name.
- Choose the most specific category.
- If the message includes more than one issue, choose the main issue.

Examples:
Message: "The app crashes every time I upload a photo."
Category: Bug

Message: "Please add dark mode to the dashboard."
Category: Feature Request

Message: "I like the tool, but the monthly plan is too expensive."
Category: Pricing

Message: "I cannot find where to change my notification settings."
Category: Usability

Now classify this message:
Message: "The export button is hard to find, and I had to search for five minutes."
Category:

This prompt works because it gives the model clear categories, strict output rules, and examples for each major case.

How to Choose Good Examples

Few-shot prompting depends heavily on the quality of the examples. Poor examples can confuse the model. Strong examples make the task easier to understand.

Good examples should be:

Relevant: They should look like the real inputs you expect the model to handle.

Varied: They should cover a range of situations, labels, tones, lengths, and edge cases.

Consistent: They should use the same structure from one example to the next.

Clear: Each example should have an answer that makes sense.

Balanced: For classification tasks, avoid showing too many examples of one label unless that imbalance reflects the real task.

For example, if you are building a sentiment classifier, do not show only positive examples and then expect the model to handle negative and neutral cases well. Include a range of examples so the model can distinguish between categories.

If your real data is messy, your examples should reflect that. Customer reviews, support tickets, meeting notes, and social media posts often include typos, slang, incomplete sentences, and mixed opinions. If your examples are too perfect, the model may not handle real-world text well.

How Many Examples Should You Use?

There is no perfect number of examples for every task. In many cases, one to five examples are enough. More complex tasks may need more.

However, more examples are not always better. Too many examples can make the prompt long, expensive, and harder to manage. They can also introduce accidental patterns.

For example, if every “Positive” review in your examples is short and every “Negative” review is long, the model may start associating length with sentiment. If every example uses the same sentence structure, the model may copy that structure even when it is not appropriate.

A good rule is to add examples until your results are consistent, then stop. If your prompt gets too long, try making your instructions clearer or swapping out weaker examples for better ones, rather than just adding more.

Why Formatting Matters

Formatting matters more than most people realize. Using clear labels and consistent separators helps the model see where instructions stop, examples start, and the main task begins.

For example:

Review: Great quality and fast shipping.

Sentiment: Positive

is cleaner than:

Great quality and fast shipping = good

Both may work, but the first version is easier to follow and more consistent.

For best results, use simple labels such as:

Input:
Output:

or:

Text:
Label:

or:

Question:
Answer:

Keep the same format across all examples. Do not switch labels halfway through the prompt unless you have a reason to do so.

It also helps to separate sections with headings such as:

Task:

Rules:

Examples:

Now complete this:

This makes the prompt easier for both humans and models to read.

Best Practices for Zero-Shot, One-Shot, and Few-Shot Prompting

Start with the simplest prompt that could work. If zero-shot gives you a strong result, there is no need to add examples.

Be clear about the task. Do not rely on the model to guess what you mean by words like “better,” “important,” “professional,” or “detailed.”

Define the output format. Tell the model whether you want a list, table, paragraph, JSON object, email, headline, summary, or report.

Use examples when style or consistency matters. A single example can often improve tone and structure. Several examples can improve reliability for more complex tasks.

Keep examples consistent. Use the same labels, formatting, and level of detail throughout the prompt.

Include edge cases. If the model will face missing information, mixed sentiment, unclear wording, or borderline categories, include examples that show how to handle them.

Avoid conflicting instructions. If your rule says “Return only the category name,” your examples should not include full-sentence explanations.

Put the final input last. After the examples, place the new item you want the model to answer. This makes the next step obvious.

Test the prompt on new inputs. A prompt is not reliable just because it works on one example. Try it on several realistic cases before using it in an important workflow.

Common Mistakes to Avoid

One common mistake is using examples to fix an unclear instruction. If the task is vague, examples may help, but they may not solve the real problem. Start by making the instruction clearer.

Another mistake is giving examples that do not match the rules. If the instruction and the examples disagree, the model may follow the examples rather than the written rule.

A third mistake is using unrealistic examples. If real customer messages are short, emotional, and full of typos, do not use perfect corporate sentences as your only examples.

A fourth mistake is adding too many examples. Long prompts can become harder to maintain and may leave less room for the actual input.

Another mistake is forgetting to explain what to do when information is missing. For extraction tasks, always tell the model whether missing fields should be left blank, marked as null, or handled another way.

When Few-Shot Prompting Is Better Than Fine-Tuning

Few-shot prompting is usually the best option if you want flexibility. You can easily swap out examples, try new styles, and adjust the prompt for different tasks without having to create a training dataset.

Few-shot prompting is useful when:

· You are still experimenting.

· The task changes often

· You need fast results.

· You do not have many training examples.

· You want to test a workflow before investing more time.

Fine-tuning is helpful if you need consistent results at scale, have lots of good training examples, or want shorter prompts. However, it requires more setup. For most daily tasks, a clear prompt with a few good examples usually works well.

Examples by Use Case

Sentiment Classification

Classify the sentiment as Positive, Negative, or Neutral.

Examples:

Text: “The delivery was fast, and the product works perfectly.”

Sentiment: Positive

Text: “The item broke after two days.”

Sentiment: Negative

Text: “The design is nice, but shipping took longer than expected.”

Sentiment: Neutral

Now classify:

Text: “The software is easy to use, although the setup took some time.”

Sentiment:

Tone Rewriting

Rewrite the message to sound polite, calm, and professional.

Example:

Original: “You didn’t send the files, so we can’t do anything.”

Rewrite: “We have not received the files yet, so we are unable to move forward at the moment.”

Now rewrite:

Original: “Your team gave us the wrong numbers again.”

Rewrite:

Data Extraction

Extract the meeting details as JSON.

Use these keys:
date, time, attendees, decision, next_step

Example:
Notes: "On March 4 at 2 PM, Lena and Omar agreed to delay the launch by one week. Omar will update the timeline."
JSON:
{
  "date": "March 4",
  "time": "2 PM",
  "attendees": ["Lena", "Omar"],
  "decision": "Delay the launch by one week",
  "next_step": "Omar will update the timeline"
}

Now extract:
Notes: "Yesterday at 10:30 AM, Priya, Marco, and Chen decided to keep the current pricing. Priya will prepare the announcement."
JSON:

Product Description Writing

Write product descriptions in a friendly, practical brand voice.

Example:

Product: Insulated Lunch Bag

Features: leak-resistant lining, adjustable strap, two compartments

Description: Keep lunch simple wherever the day takes you. This insulated bag has a leak-resistant lining, an adjustable strap, and two compartments to keep snacks and meals neatly separated.

Now write:

Product: Compact Travel Umbrella

Features: wind-resistant frame, quick-dry canopy, wrist strap

Description:

Customer Support Replies

Write a customer support reply that is warm, brief, and solution-focused.

Example:

Customer: “My order says delivered, but I never received it.”

Reply: “I’m sorry your order has not arrived. Please check around your delivery area and with neighbors first. If it still does not turn up, send us your order number, and we’ll help you open a delivery investigation.”

Now reply:

Customer: “I entered the wrong shipping address. Can I change it?”

Reply:

Quick Decision Guide

Use zero-shot prompting when the task is simple, and the model can understand it from a direct instruction.

Use one-shot prompting when you need to show one example of the desired tone, structure, or format.

Use few-shot prompting when the task needs consistency, custom rules, multiple categories, or careful handling of edge cases.

Avoid few-shot prompting when the examples are weak, the prompt is already too long, or the task needs information the model has not been given.

Final Checklist

Before using a prompt, ask:

· Is the task clear?

· Is the audience defined?

· Is the output format specified?

· Are the rules easy to follow?

· Would one example improve the result?

· Do the examples match real inputs?

· Are the examples consistent?

· Have edge cases been covered?

· Does the prompt explain what to do with missing information?

· Has the prompt been tested on new examples?

Conclusion

Zero-shot, one-shot, and few-shot prompting are simple but powerful ways to guide AI models.

Zero-shot prompting works well for direct tasks that do not need examples. One-shot prompting is helpful when you want to demonstrate a specific style or format. Few-shot prompting is better if you need consistency, custom rules, or want to handle tricky cases.

The best prompt is not always the longest. It should give the model enough direction to do the job well without making things too complicated. Begin with a clear instruction, add examples only if they help, and test your prompt with real inputs before using it.


메타데이터
post_id
6c98721bc249
slug
zero-shot-one-shot-and-few-shot-prompting-guide-6c98721bc249
url
https://medium.com/@QuarkAndCode/zero-shot-one-shot-and-few-shot-prompting-guide-6c98721bc249
canonical_url
https://medium.com/@QuarkAndCode/zero-shot-one-shot-and-few-shot-prompting-guide-6c98721bc249
author_url
https://medium.com/@QuarkAndCode
status
ok
fetched_at
2026-09-20 04:15:15