Lesson 2

Few-Shot Learning

Learning from examples

Few-Shot Learning — Learning from Examples

📚 Few-shot — a technique where we show the model several examples BEFORE the task. More examples = better format understanding!

Choose a task:
Number of examples:
0
Prompt the model will receive:
Determine the sentiment of text
Input: Not bad, but could be better
Model output:
Zero-shot(no examples)
This expresses mixed feelings with slight disappointment...
ModeExamplesQualityWhen to use
Zero-shot0⭐⭐Simple tasks
One-shot1⭐⭐⭐Show format
Few-shot2-5⭐⭐⭐⭐⭐Complex/unusual tasks
Practical Prompt Examples

Ready-to-use templates for copying. Replace {review} with your text.

Zero-shotNo examples

Classify the review as positive or negative:
"{review}"

Suitable for simple tasks where the response format is clear from the instruction.

One-shotSingle example

Classify the review as positive or negative.

Example:
Review: "Great product, highly recommend!"
Answer: positive

Now classify:
Review: "{review}"
Answer:

Shows the exact response format. Sufficient for tasks with a clear pattern.

Few-shot (5)Multiple examples

Classify the review as positive or negative.

Examples:
Review: "Great product!"
Answer: positive

Review: "Terrible quality, waste of money"
Answer: negative

Review: "Fast delivery, everything works"
Answer: positive

Review: "Don't recommend, disappointed with purchase"
Answer: negative

Review: "Price/quality ratio is excellent"
Answer: positive

Now classify:
Review: "{review}"
Answer:

Ideal for complex tasks. Diverse examples cover more edge cases.

Usage tips:
  • Start with zero-shot, add examples only if results are imprecise
  • 3-5 examples are usually enough, more = more tokens without guaranteed better quality
  • Examples should be diverse and cover edge cases
  • Use consistent format for all examples (Input/Output, Question/Answer, etc.)
Key Insight

Few-shot examples work like "calibration" — they show the model the EXACT format you expect. 3-5 diverse examples are usually enough. More examples = more tokens, but not always better quality.

Try it yourself5 examples