Zero-Shot vs Few-Shot Prompting: When Examples Help or Hurt
Zero-shot prompts give only instructions; few-shot prompts add examples. Learn when examples improve output, and when they cause copying, bias and drift.
Examples
Few-shot prompting means including a handful of worked examples (input and the output you want) in the prompt so the model copies the pattern. It is the fastest way to pin down a format or a labeling style. The catch is that models copy everything, including quirks you did not intend, so the choice and balance of examples matters as much as the instruction.
Your app parses the model’s JSON, but sometimes the reply starts with “Sure! Here is the JSON:”. What is the most robust fix?
Your 3 examples for a sentiment classifier are all labeled “positive”. What is the most likely side effect?
B. The model leans toward answering “positive” Models pick up the distribution of labels in the examples. Unbalanced examples bias the output, so mix labels and include a borderline case.
Zero-shot gives only an instruction. Few-shot adds a few input-output examples of the task. Examples help most when the format or judgment is hard to describe in words.
Usually two to five well-chosen, varied examples. More examples cost tokens and can make the model over-copy surface details.
Zero-shot prompts give only instructions; few-shot prompts add examples. Learn when examples improve output, and when they cause copying, bias and drift.
Getting valid JSON from an LLM takes more than asking nicely. Use schemas, structured output modes, validation and retries, and avoid the usual failure modes.
The prompt engineering mistakes that cause most bad AI output, from missing context to conflicting rules and untested changes, each with a concrete fix.
Short quizzes on real prompting decisions, with an explanation for every answer. Free to start on iPhone and Android.