What is the difference between zero-shot and few-shot prompting, and when would you add examples to a prompt?
technical-conceptual · Junior level · data-ml
What the interviewer is really asking
Assess whether the candidate understands in-context learning and can decide when worked examples earn their place in the context window versus a plain instruction.
What to say
- Define both: zero-shot is asking the model to do the task from the instruction alone; few-shot includes a handful of input-output examples in the prompt so the model infers the pattern from them (in-context learning), without any weight updates.
- Say when few-shot pays off: when the output format is specific (a fixed JSON shape, a label set, a tone) or the task is ambiguous from words alone, a couple of representative examples pin down what 'good' looks like far better than describing it.
- Note the cost and the trade-off: examples consume context tokens and add latency, and a strong instruction often beats weak examples — so start zero-shot, and reach for few-shot only when the model is getting the format or edge cases wrong.
What to avoid
- Claiming few-shot 'trains' or 'fine-tunes' the model — it conditions a single inference on examples in the prompt, it never updates weights.
- Saying more examples are always better — past a few, you spend tokens and latency for diminishing returns, and biased or non-representative examples actively mislead the model.
- Treating few-shot as the default for every task when a clear zero-shot instruction would be cheaper and just as accurate.
Example answers
Strong: For a ticket-classification prompt the model kept inventing label names under a zero-shot instruction, so I added four examples — one per category, including a tricky borderline ticket — and it locked onto my exact label set with no extra wording.
Weak: Few-shot prompting means you fine-tune the model on a few examples so it learns your task permanently.
Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.