Entry

Zero-shot vs few-shot prompting: when do you use each?

I start by thinking about how much structure the task needs. For a common task with a simple format, I use zero-shot prompting: I describe the task and give any necessary context, but no demonstrations.

How to answer it in an AI engineer interview: what is being tested, a step-by-step framework, a sample answer and the mistakes to avoid.

$19.99 on Gumroad, instant download

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Practiced one out loud? Paste your answer into the free self-check and get a score in 30 seconds

What the interviewer is testing

Whether you know when zero-shot is enough, can identify cases that need few-shot examples, and can design balanced examples without copying surface patterns into the output.

Answer framework

  1. Zero-shot prompting: give the instruction and any needed context without demonstrations.
  2. Few-shot prompting: include several labeled input and output examples in the prompt.
  3. Use zero-shot for common tasks with simple formats and little ambiguity.
  4. Use few-shot for unusual formats, subtle labels, or strict style and output consistency.
  5. Choose balanced, varied examples that cover hard cases, since models can copy their surface patterns.

Sample answer

I start by thinking about how much structure the task needs. For a common task with a simple format, I use zero-shot prompting: I describe the task and give any necessary context, but no demonstrations. That is quicker to maintain and avoids spending context window space on examples. If the model already understands the labels and the expected output is easy to recognize, zero-shot is usually the cleaner choice.

I switch to few-shot prompting when the format is unusual, the labels are subtle, or I need consistent style. I put a few input and output examples directly in the prompt, usually with a clear separation between examples and the final query. I select examples that cover the hard cases, vary the inputs, and make the labels balanced. I also test whether the examples are actually changing behavior, rather than assuming that more examples always help.

I see one failure mode as surface-pattern copying. If every example has a positive label, the model may treat positive as the default, even when the input calls for another label. I would catch that with a small set of edge cases, including examples with the opposite label, and adjust the examples if needed. In short, I use zero-shot for straightforward tasks and few-shot when examples communicate the missing pattern. I also treat examples as data that needs evaluation, not as decoration.

Likely follow-ups

When is few-shot prompting not worth the extra tokens? I would use zero-shot when the task is straightforward, the model already understands the format, and added examples would mainly increase cost and latency.
How should I choose few-shot examples? I would cover hard cases, vary the inputs, balance the labels, and check that surface details in the examples are not driving the outputs.
What if every few-shot example has the same label? I would rebalance the examples and include the opposite label, then test edge cases because the model may treat the repeated label as the default.

Common mistakes

The PlaybookWant the full method?

The 0 to 1 AI Engineer Interview Playbook covers the answer frameworks, system-design walkthroughs and an 8-week plan.

Get the playbook

Smaller start: Score your answers against 50 rubrics, $9. 50 AI engineer questions, one rubric each, PDF on Gumroad.

Interviewing for PM or TPM? See the full PM package, $59 on Gumroad: a resume system, a PM, TPM and PGM interview handbook, a 1:1 cheat sheet and a PM playbook. PM and TPM content, not AI engineer prep.

Related questions

Based on question #17 in the full question bank.

AI Engineer Interview PlaybookStructured practice for AI engineer interviews

A structured interview practice pack with prompts and scoring notes for AI engineer rounds. Price is $19.99.

Get the AI Engineer Interview Playbook, $19.99

Also: Grok Bot Team Setup Pack ($49)