LearnThatStack Ace your next interview
Prompt Engineering · question
Question 2 of 55

Explain zero-shot versus few-shot prompting. When would you choose each?

beginner
← All Prompt Engineering questions
Re-explain

Zero-shot prompting gives the model instructions only. Few-shot prompting adds a few worked examples that show an input and the output you want.

Classify the review sentiment as positive or negative.

Review: "Battery died within an hour."
Sentiment: negative

Review: "Setup took two minutes."
Sentiment: positive

Review: "The screen scratches easily."
Sentiment:
Zero-shot Few-shot
Prompt content Instructions only Instructions plus 2-5 example pairs
Cost per call Shorter and cheaper Examples are resent on every call
Best for Tasks you can describe in words Formats or judgment calls easier to show

Start zero-shot. Instruction-tuned models handle common, clearly described tasks without examples, and the shorter prompt is cheaper.

Add examples when a written instruction cannot pin down what you want: an exact output shape, a house tone, or a fuzzy label boundary.

Examples also steer strongly. A skewed mix of labels biases predictions, and the model may copy wording from your examples.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for Prompt Engineering One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

  • How would you pick which examples go into a few-shot prompt? A strong answer picks examples that look like real inputs, covers the hard edge cases, balances the labels, and checks the set on a test set.
  • Your few-shot classifier predicts one label far too often. What do you check first? A strong answer checks the label mix and the order of the examples, rebalances them, and reruns on a labeled set before rewriting the instructions.
  • How would you show that adding examples beat the zero-shot prompt? A strong answer runs both prompts on the same labeled eval set, compares accuracy and cost per call, and reads the failures instead of a few hand-picked tries.
  • At millions of calls a day, the examples cost real money. How would you cut that? A strong answer trims to the fewest examples that keep accuracy, puts them in a stable prefix so prompt caching applies, and considers fine-tuning at that volume.
  • Does your choice change when the task needs multi-step reasoning? A strong answer contrasts telling the model to reason step by step with examples that show worked reasoning, and says when the extra tokens are worth it.

What you can say

  1. Zero-shot means I give the model instructions only, and few-shot means I add a few worked examples that show an input and the exact output I want.
  2. I start zero-shot, because instruction-tuned models handle common, clearly described tasks without examples, and the shorter prompt is cheaper on every call.
  3. I add examples when a written instruction can't pin down what I want, like an exact output shape, a house tone, or a fuzzy boundary between two labels.
  4. For a sentiment classifier, two or three labeled reviews before the new one can show where the line between labels sits better than another paragraph of rules.
  5. The catch is that examples steer hard, so a skewed label mix biases predictions, the model may copy their wording, and I pay for them again on every call.

Weak answers to avoid

  • Says few-shot is always more accurate Examples cost tokens on every call and can bias labels or get copied. Say you start zero-shot and add examples only when instructions can't pin down the output.
  • Defines both terms, never says when The question asks when to choose each. Name what calls for examples, such as an exact output format, a house tone, or a fuzzy label boundary.
  • Treats examples as neutral Examples steer strongly. A skewed label mix biases predictions and the model copies phrasing, so balance the labels and vary the wording across examples.
  • Confuses few-shot with fine-tuning Few-shot examples live in the prompt and change no weights. They are resent on every call, which is where the cost trade-off comes from.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the Prompt Engineering cheatsheet.

← Back to all Prompt Engineering questions
Pro · $10/mo

48 of 55 Prompt Engineering answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime