Prompt Engineering interview question

Generative AIPrompt Engineeringbasic

What is the difference between zero-shot and few-shot prompting?

  1. AZero-shot uses the pretrained weights as they are; few-shot first fine-tunes the weights on a handful of labelled examples.
  2. BZero-shot asks the model for one answer; few-shot samples several answers to the same prompt and returns the most common one.
  3. CZero-shot gives only the task instruction; few-shot also adds a few worked input–output examples to the prompt, with no weight updates.
  4. DZero-shot means the prompt contains no instruction at all; few-shot means it contains only a short instruction of a few sentences or less.
Show the answer and explanation

Correct answer: C, Zero-shot gives only the task instruction; few-shot also adds a few worked input–output examples to the prompt, with no weight updates.

Explanation Prompt Engineering

Zero-shot prompting gives the model only the task description ("Classify this review as positive or negative"). Few-shot prompting adds a small number of worked examples (input → output pairs) before the real input. In both cases the weights stay frozen: the examples act only through the context. The terms were popularised by the GPT-3 paper (Brown et al., 2020).

Why the other descriptions are wrong:

  • Few-shot does not update weights; training on labelled examples is fine-tuning, a separate step.
  • Sampling several answers and taking the majority is self-consistency, not few-shot prompting.
  • A zero-shot prompt still has an instruction; "shot" counts examples, not sentences of instruction.

Few-shot examples can help pin down the output format, label conventions and edge cases, at the cost of extra input tokens.

Interview tip: say "start zero-shot, add a few examples when the format or labels are ambiguous, and measure the gain on an eval set".

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Generative AI questions

  1. What is retrieval-augmented generation (RAG)?
  2. What does it mean to fine-tune a pretrained LLM?
  3. A chatbot's conversation history is growing longer than the model's context window. What is a common way to handle it?
  4. Asked for "revenue and number of orders that contain electronics, by customer segment", a text-to-SQL bot generated the query below. The Gold segment has…
  5. The table shows the next-token distribution at one decoding step for the context "The customer wants to ___". With top-p = 0.9 (nucleus sampling, no top-k),…