LESSON 2 of 6 Intermediate

Few-shot & One-shot Prompting

How to use examples effectively (few-shot) and when one-shot or zero-shot works better.

6 min read 2 quiz questions

Zero-shot, one-shot, and few-shot are ways to give the model examples inside your prompt.

What they mean (very simple):

  • Zero-shot: No examples. You explain the task and the model tries to do it.
  • One-shot: You show one example to teach the style.
  • Few-shot: You show a few examples (usually 2–5) that demonstrate the pattern you want.

When to use each:

  • Zero-shot: Use for straightforward tasks or when examples might bias results.
  • One-shot: Cheap nudge to show style without many tokens.
  • Few-shot: Use when format or mapping is tricky and examples help guide the model.

How to pick good examples:

  • Keep them short and focused.
  • Make examples cover typical and a couple of edge cases you care about.
  • Avoid many similar examples — variety teaches the model the pattern.

Trade-offs:

  • More examples usually mean better guidance but higher token cost.
  • Examples can bias behavior; test your template on many inputs to catch problems.

Quick rule: start with 1–3 examples, test, then add more if the model still misunderstands the task.

Quick Quiz

Test what you just learned. Pick the best answer for each question.

Q1 Few-shot prompting includes:

Q2 When is zero-shot preferable?