Examples and Few-shot
60%
Lesson 6 of 10

Examples and Few-shot

Examples show the model what “good” looks like when instructions alone are too abstract.

Active reading
Why this matters

Examples show the model what “good” looks like when instructions alone are too abstract.

Input

A representative case.

Output

The desired response pattern.

Variation

More than one example prevents overfitting to wording.

Understand the working model

Few-shot prompting is useful for classification, extraction, tone and formatting. Pick examples that cover important edge cases instead of many nearly identical examples.

Examples are instructions too. If an example contains a mistake or inconsistent format, the model may copy that pattern. Review examples as carefully as the prompt itself.

Example
Example 1 — Input: “Login broken” → Category: product_bug. Example 2 — Input: “Need invoice” → Category: billing. Now classify the new message using only these labels.
Practice

Apply the pattern above to one real task you already do. Keep the first version small enough that you can inspect every input and output.

Common mistake

Do not use examples that contradict your written constraints.

Key takeaway

Use a small set of clean, representative examples when you need the model to imitate a pattern.

Next lesson

Prompt Chaining

Continue to the next lesson.

Continue →