Few-Shot vs Zero-Shot: When Examples Help, and When They Hurt

2026-06-09


Few-Shot vs Zero-Shot: When Examples Help, and When They Hurt

You're writing a prompt and wondering whether to include sample inputs and outputs, or just describe what you want. The choice affects quality more than most prompt tweaks.

The jargon

Zero-shot — you give Claude a task description with no examples. "Summarise this email in one sentence."

Few-shot — you include one or more example input/output pairs before the real request. Claude reads the pattern, then continues it.

In-context learning — the model adapting its behaviour based on examples in the same prompt, without any training happening. It's pattern-matching, not memory.

The lesson

Examples teach Claude format and style better than prose instructions do. But they also anchor Claude tightly to the pattern you showed — including any quirks or errors in your examples. A bad example is worse than no example.

How it works

Zero-shot:

Classify this support ticket as Bug, Feature Request, or Question.

Ticket: "The export button doesn't do anything when I click it."

Few-shot:

Classify this support ticket as Bug, Feature Request, or Question.

Ticket: "The dashboard takes 30 seconds to load."
Classification: Bug

Ticket: "Can you add dark mode?"
Classification: Feature Request

Ticket: "How do I export to CSV?"
Classification: Question

Ticket: "The export button doesn't do anything when I click it."
Classification:

The few-shot version gives Claude three things at once: the output format (one word), the reasoning style (literal, no hedging), and the label vocabulary (exactly those three strings). Zero-shot might return "This appears to be a Bug" — structurally wrong if you're parsing the output downstream.

When to reach for it

Use few-shot when: - The output format matters exactly — JSON, a specific sentence structure, a particular tone - The task is ambiguous and words alone won't nail it - You want Claude to mirror a house style or a specific voice - You're seeing inconsistent outputs from zero-shot and need to tighten them

Don't use few-shot when: - Your examples are inconsistent with each other (Claude will average them, producing worse output than zero-shot) - The task genuinely varies and examples will over-constrain the response - You only have one example and it's an unusual edge case — it'll bias every subsequent output toward that case - The task is straightforward and Claude already does it well zero-shot; examples add tokens with no gain

A specific trap: if you're asking Claude to reason through something complex (debugging, analysis, planning), bad few-shot examples can lead it down the wrong path confidently. Zero-shot with a clear instruction often outperforms few-shot with mediocre examples.

Try it

Pick a prompt you use regularly where the output format matters — a classification, a summary template, a structured extract. Run it zero-shot and note any formatting inconsistencies. Then add two or three clean examples that represent the normal case (not the edge case). Compare the outputs. You'll likely see Claude snap to the format immediately — and you'll also see whether your examples were cleaner than you thought.


Don't miss what's next. Subscribe to My Claude Daily Learning: