LearnFrenzy
Sign in Take a free test

Core Techniques · Lesson 2 of 5

Zero-Shot vs Few-Shot Prompting: Teaching AI with Examples

Instead of describing the output you want, show it. How a couple of good examples make AI answers consistent — with ready-to-use prompts.

9 min read Beginner Updated Nov 5, 2026 Reviewed by Saurabh Samir

Describing exactly what you want in words is surprisingly hard. Showing an example is easy. That is the whole idea behind few-shot prompting.

Zero-shot: just ask

A zero-shot prompt gives the task with no examples:

Classify this customer review as Positive, Negative or Neutral:
"Delivery was late but the product quality is excellent."

For common tasks this works well. Modern models have seen countless examples of sentiment classification during training.

Few-shot: show, then ask

When you need a particular style, label set or format, give a few examples first:

Convert each topic into a one-line revision note with a memory trick.

Topic: Primary key
Note: Uniquely identifies each row — think "Aadhaar number of a table".

Topic: Foreign key
Note: Links to a primary key in another table — think "roll number
written on your library card".

Topic: Index
Note:

The model now copies the pattern: one line, a definition, and a relatable Indian-context memory trick. Describing that style in words would take a paragraph and still be less reliable.

Remember: the model copies your examples closely — their length, tone and structure. Bad examples produce bad output, so choose them carefully.

When to use which

Use zero-shot whenUse few-shot when
The task is common and simpleYou need a specific format or style
Any reasonable answer is fineYou need consistent output across many items
You are exploring an ideaYour labels or categories are unusual

Tips for good examples

  • Two to five examples are usually enough. More is rarely better and costs tokens.
  • Cover the variety you expect — include an easy case and a tricky one.
  • Keep the format identical across examples, including labels like "Topic:" and "Note:".
  • Do not let all examples share one answer. If every example is "Positive", the model will lean towards "Positive".

A real use: consistent interview answers

Rewrite my answers in the STAR format, under 80 words each,
like this example:

Question: Tell me about a challenge you faced.
Answer: (S) In my final-year project our dataset had 30% missing values.
(T) I had to make the model usable before the review. (A) I compared
three ways of filling the gaps and chose the one that kept accuracy
highest. (R) We presented on time and scored the best in our batch.

Now rewrite:
Question: Tell me about a time you worked in a team.
My rough answer: [paste]

Try it yourself: Pick a task you repeat often — summarising articles, writing commit messages, tagging questions by topic. Write a few-shot prompt with three examples and save it. Reuse it every time.

Common interview questions

Try answering each one aloud before you open it.

1What is few-shot prompting?

Including a small number of input-output examples in the prompt so the model learns the desired pattern, format or labels before handling the new input.

2When would you prefer zero-shot over few-shot?

For simple, common tasks where the model already performs well and the exact format is not important — zero-shot is shorter and cheaper.

Practise this

Build something with it

FAQs

How many examples should I give?

Usually two to five. Start with two; add more only if the output is still inconsistent.

Is few-shot the same as fine-tuning?

No. Few-shot examples live only in the prompt for that request. Fine-tuning changes the model itself using a training dataset.

References & further reading

Finished this lesson?

Mark it complete. Create a free account to save it on every device.

Next lesson

Search LearnFrenzy

Esc

Quick links