Skip to content
AI Skills

Few-Shot Prompting

Providing 2-5 examples of desired input-output pairs in your prompt before asking the AI to perform the task. Significantly improves output quality for specialized tasks.

Why it matters

Few-shot prompting is the easy fix when zero-shot gives inconsistent or oddly formatted answers. By showing the AI two or three examples of exactly what you want, you teach it the pattern without any coding or training. It matters because it's the most reliable way to lock in a consistent style or output format, which is exactly what trips people up in real work.

A concrete example

Want product names turned into short taglines? Show the pattern: "Product: bamboo toothbrush -> Tagline: Brush greener. Product: steel water bottle -> Tagline: Ditch the plastic." Then add "Product: cotton tote ->" and let it finish. Those two examples teach length, tone, and format in one shot, so you get consistent taglines instead of the AI guessing what style you had in mind.

How to use it

Choose examples that cover the range of what you expect, including one awkward case, and make sure they are consistent with each other. The model copies the pattern it sees, so two examples that punctuate differently teach it that punctuation does not matter. Three to five good examples is usually the sweet spot; beyond that you are spending context for diminishing returns. The behaviour was first characterised at scale in Language Models are Few-Shot Learners.

The common mistake

Using examples that are all easy or all the same shape. The model then handles the easy cases beautifully and falls apart on the real ones, and because your examples looked fine you conclude the model is unreliable rather than the demonstration being unrepresentative.

Related terms

Put Few-Shot Prompting into practice

Access 750+ AI models and 60+ tools through Vincony — start free with 100 credits.