Learn AI Math

Few-shot Prompting

What is Few-shot Prompting?

In one sentence: Few-shot prompting is giving an AI a handful of examples in the prompt before asking it to do the task.

The examples act like a mini lesson inside the prompt. The model notices the pattern and continues it. It is very useful for custom formats, labels or styles, and it requires no extra training.

What does Few-shot Prompting look like?

Showing three movie reviews labeled "positive" or "negative," then asking the model to label a fourth, is few-shot prompting.

Why does Few-shot Prompting matter?

Few-shot prompting is one of the easiest ways to make a model more reliable on your specific task.

Few-shot Prompting vs. Zero-shot Prompting

Zero-shot prompting gives instructions alone with zero examples, while few-shot prompting includes 2–5 worked input-output examples inside the prompt to demonstrate exact style or edge cases.

DimensionFew-shot PromptingZero-shot Prompting
Examples in promptTypically 2–5 input → output pairs0 (instructions only)
Prompt token costHigher (examples repeat on every call)Minimal
When to useStrict formatting, nuanced tone, tricky edge casesClear everyday tasks on strong models

Last updated · Fact-checked by The AI Math

Linking to this page from a lesson or article?

Like this explanation? Get one every week.

The AI Math newsletter turns confusing AI news into plain English. No hype, no jargon walls.