Back to Glossary
Technique

Few-Shot Prompting

Providing a few examples in your prompt so the AI understands the pattern you want.

Share

Definition

Few-shot prompting is a technique where you include a small number of examples (typically 2-5) in your prompt to show the AI exactly what kind of output you expect. Instead of just describing what you want, you demonstrate it. This is one of the most effective prompt engineering techniques because AI models are extremely good at pattern recognition — when you show them examples, they can replicate the pattern with remarkable accuracy.

The term comes from machine learning, where "few-shot learning" means learning from just a few examples. Zero-shot means no examples (just instructions), one-shot means one example, and few-shot means several examples.

Examples

1

Showing 3 example product descriptions before asking the AI to write a new one — the AI matches your style, length, and format

2

Providing 2 example customer emails with ideal responses, then giving a new email for the AI to respond to — the AI copies your response pattern

Related Terms

Frequently Asked Questions

How many examples should I include?
Usually 2-5 examples work best. Too few and the AI might not pick up the pattern. Too many and you waste context window space. Start with 3 and adjust based on results.
What if the AI doesn't follow my examples?
Make sure your examples are consistent with each other. If they contradict or vary too much in style, the AI will get confused. Also try making the pattern more obvious by keeping examples very similar in structure.

Build prompts using this concept

Explore our prompt library and put few-shot prompting into practice with ready-to-use templates.

Build prompts using this concept