Nexus Learn

Log in · Create free account

Module 2: Core prompting techniques · 9 min

Teach by example (few-shot prompting)

Sometimes it is easier to show than to explain. In few-shot prompting you put two or three examples of the input and the output you want, then give a new input. The model copies the pattern.

Turn each review into one word: Positive, Negative or Mixed.

Review: The food was cold but the staff were kind.
Answer: Mixed

Review: Fast delivery and perfect packaging.
Answer: Positive

Review: The app crashed twice and support never replied.
Answer:
  • Use examples that are clearly different from each other.
  • Keep the format of every example exactly the same.
  • Two to five examples are usually enough.
  • Zero-shot means no examples. Start there, and add examples only if the result is poor.
(free account needed to save progress)

← Write clear instructions  |  Control the format and length →