Lesson 3 +15 XP

Zero-Shot vs Few-Shot Prompting

Teaching by Example

LLMs are pattern completion machines. Providing example input-output pairs inside your prompt is one of the most powerful ways to guide the model.

Zero-Shot Prompting

Zero-Shot means giving the AI a prompt without any prior examples.

Classify the sentiment of this review:
"The battery life on this phone is terrible."
Sentiment:

Few-Shot Prompting

Few-Shot means providing 2-3 input/output examples before asking the AI to process your target input.

Classify the sentiment of the following customer reviews:

Input: "Loved the fast delivery and great packaging!"
Sentiment: Positive

Input: "Screen arrived cracked and support ignored me."
Sentiment: Negative

Input: "The phone is okay, nothing special."
Sentiment: Neutral

Input: "The battery life on this phone is terrible."
Sentiment:

Why Few-Shot Works So Well

  • Enforces consistent output formatting.
  • Demonstrates edge-case handling without writing complex instructions.
  • Drastically reduces formatting hallucinations.