Um momento
0x10Lesson 2 of 6

Use examples to show the pattern

Use zero-shot and few-shot examples to clarify what a good response looks like.

12 min 5-question quiz
By the end of this lesson you can
  • Decide when examples help and choose examples that match the task.

A prompt without demonstrations is often called zero-shot. Adding a small number of input-output examples is few-shot prompting. Examples can show a classification convention, writing style, or output structure more clearly than abstract instructions alone. Keep examples representative, consistent, and close to the real task; a misleading example can teach the wrong pattern.

A small example

Illustrative Python
1examples = [
2    ("late delivery", "shipping"),
3    ("charged twice", "billing"),
4]
5for message, label in examples:
6    print(f"Message: {message} -> Category: {label}")
Output
Message: late delivery -> Category: shipping
Message: charged twice -> Category: billing

Examples consume context space and can bias the result toward their specific wording or label balance. Include edge cases when they matter, but keep a separate evaluation set to check whether the prompt works beyond the examples it shows the model.

Key takeaways

  • Decide when examples help and choose examples that match the task.

  • Test prompts on realistic inputs and validate important outputs in software.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: