← All skills
beginnerprompting

Few-Shot Prompting

Give the AI 2–5 worked examples to establish the pattern you want it to follow.

What Is Few-Shot Prompting?

Few-shot prompting gives the model 2–5 worked examples before asking it to complete your actual task. Rather than explaining in abstract terms what you want, you demonstrate it. The model reads the examples, infers the pattern — including format, tone, label schema, and level of detail — and applies that pattern to the new input. It's one of the most reliable ways to steer output towards exactly what you need.

How Examples Teach Format and Tone

Each example is simultaneously teaching the model several things at once: the structure of the input, the structure of the output, the vocabulary it should use, the level of detail expected, and the relationship between input type and output type. A sentiment classification example tells the model both that labels should be single lowercase words and that the text determines the label. A headline-writing example communicates length, capitalization style, and word choice preferences all at once.

How Many Examples to Use

Two to five examples hit the sweet spot for most tasks. One example is often not enough to establish a clear pattern — the model may treat it as a coincidence rather than a rule. More than five examples start to eat into your context budget without proportional gains. For highly structured or unusual tasks, err toward five; for simple formatting tasks, two or three usually suffice. The examples should be diverse enough to cover different cases but consistent enough to reveal a clear pattern.

Label Consistency

If your examples use labels or categories, keep them perfectly consistent. Using "Positive" in one example and "positive" in the next will confuse the model's output casing. If your task involves numerical scores, use the same scale throughout. Inconsistency in examples teaches inconsistency in outputs — the model is learning from exactly what you show it.

Example

Sentiment: positive Text: 'I love this product!' Sentiment: negative Text: 'This broke after one day.' Sentiment: [complete] Text: 'It arrived late but works fine.'

Try this skill with our AI assistant

Try it →