Intermediate

How to Use Few-Shot Prompting (2026)

Show the AI two or three examples of exactly what you want before asking your real question. It picks up your format, tone, and style from the examples without any explanation needed.

TLDR

Before your question, provide two or three input-output examples showing exactly what you want. The model learns your format and style from the examples rather than from a description of them.

How to do it

1

Choose examples that represent your ideal output

Your examples are your instruction. Pick ones that demonstrate the exact format, length, tone, and style you want. If your examples are inconsistent, the output will be too.

2

Use a consistent input-output format

Structure each example the same way: Input: [X] / Output: [Y]. This pattern is universally understood by AI models. Consistency across examples matters more than how you label them.

3

Use two to three examples, not more

Two or three examples are enough for most tasks. More examples consume context window space and can introduce noise if any example is slightly off. If one example is not working, replace it rather than adding more.

4

Make your real request clearly separate from the examples

Add a clear separator like "Now:" or "Your turn:" between your examples and your actual input. Without it, the model may not know where examples end and your real request begins.

5

Test and refine the examples, not the output

If the output does not match your examples, the mismatch is usually in the examples themselves. Examine what the model produced versus what your examples showed, then adjust the examples.

Example prompt

Product marketing: turning technical specs into customer-focused copy using three examples

Convert these product features into customer-focused benefits. Input: 256GB storage Output: Store over 50,000 photos without ever running out of space Input: 18-hour battery life Output: Get through two full days of work without reaching for a charger Input: 5G connectivity Output: Stream, download, and share without buffering, even in busy locations Now convert this: Input: 48MP triple-lens camera system Output:

When to use it

Matching a specific format or template

When you need output in a precise structure, such as a particular JSON shape, a branded headline formula, or a specific email template, examples convey structure far better than describing it.

Capturing a voice or tone

When writing in a brand voice or matching an existing style, showing two or three examples of existing copy is faster and more accurate than trying to describe the tone in words.

Classifying or labeling content

For categorization, sentiment analysis, or content tagging, show examples of correct labels before asking the model to label new items. It dramatically improves consistency.

Common mistakes

01

Using inconsistent examples

If your examples have different formats, lengths, or tones, the model averages them out unpredictably. Your examples must be consistent with each other.

02

Adding too many examples

More than four or five examples rarely improves results and wastes context. Focus on quality and consistency, not quantity.

03

No separator between examples and your request

Without a clear break, the model may continue generating examples instead of answering your actual question.

Frequently asked questions

What is the difference between few-shot and zero-shot prompting?+

Zero-shot prompting gives no examples: you just ask directly. Few-shot gives two or three examples before asking. Use zero-shot for tasks the model handles well on its own. Use few-shot when you need a specific format, style, or pattern that examples convey better than a description.

How many examples do I need?+

Two or three is the sweet spot for most tasks. One example works for simple pattern matching. For anything with nuance, use two to three. Beyond five, you are typically not gaining much and may be consuming context unnecessarily.

Does few-shot work better than just describing what I want?+

Often yes, especially for format and style. It is easier to show what good output looks like than to describe it. Use few-shot when your description alone is not producing the right output.

Bottom line

What you show matters more than what you say. Give two or three consistent examples of exactly what you want, add a clear separator before your real request, and the model will follow the pattern.

Related concepts

Put it into practice

Prompt packages that apply this technique directly.

More from Learn

Back to Learn