foundationPrompt Craftbeginner

few shot

/FYOO-shot/

Providing 2-5 examples in your prompt so the AI can learn the pattern and apply it to new inputs. The most reliable way to control output format.

Impact
Universality
Depth

Few-shot prompting is giving an AI a handful of input-output examples before your actual request. It's the most reliable way to control format, tone, and reasoning style without fine-tuning a model. Show the AI three examples of how you want customer emails categorized, then give it the fourth — it'll follow the pattern.

Few-shot is more powerful than most people realize. It doesn't just teach format — it teaches judgment. If your examples all classify borderline cases as 'needs review' rather than forcing a binary, the model learns that nuance. The examples ARE the specification.

The sweet spot is 3-5 examples. Fewer than 3 and the model might not lock onto the pattern. More than 5 and you're wasting context window tokens with diminishing returns.

When to Use It

When you need consistent output format, domain-specific classification, or when zero-shot keeps getting the structure wrong.

Try This Prompt

$ Here are 3 examples of how I want this formatted. Follow the same pattern for the rest.

Why It Matters

Few-shot prompting is the bridge between 'AI that kinda works' and 'AI that works reliably.' It's the professional's secret weapon.

Memory Trick

A few shots to calibrate — like a basketball player taking warm-up shots before the game.

Example Prompts

Here are 3 examples of good commit messages. Write one for this diff following the same style.
I'll show you 3 product descriptions I like. Write 10 more in the same voice.
These 4 examples show how I want errors categorized. Classify the remaining 50.
Here's how I want the data transformed — input/output pairs below. Apply to the full dataset.

Common Misuses

  • ×Providing examples that are too similar — diversity in examples teaches better
  • ×Giving examples with inconsistent formatting — the AI learns your inconsistency too
  • ×Using few-shot when zero-shot works fine — unnecessary examples waste tokens

Related Power Words

A Mac app that coaches your AI vocabulary daily

Become a Better AI Communicator