Few-shot prompting

Putting two or three worked examples in the prompt so the model copies the pattern instead of guessing what you meant.

show it examples firstteach by demonstration in the promptgive it a few examplesexample-based promptingn-shothow many examples should I put in the promptfewshotpaste in samples of what I want

See it

Live demo coming soon

What it is

Few-shot prompting means putting worked input/output pairs in the prompt so the model infers the pattern from demonstration instead of from your description. Nothing is trained and no weights change: this is in-context learning, and it lasts exactly as long as the examples stay in the context window. Zero-shot is the same prompt with no examples at all.

Reach for it when the output shape matters more than the output content: classification labels, extraction schemas, tone matching, rewriting rules, anything you struggled to describe in words but can show in five seconds. Three to five examples usually captures most of the gain, and one example that covers a nasty edge case beats three that all look alike.

Gotcha: the model copies everything in your examples, including the accidents. Skewed labels teach it to over-predict the common one, sloppy formatting in example two shows up in production, and a stray verbose answer sets the length for every reply. Examples also cost tokens on every single call, so once the block is stable, put it in the cached prompt prefix, and if you are up to fifty examples you probably want fine-tuning instead.

Ask AI for it

Rewrite this instruction as a few-shot prompt. Keep the task description to two sentences, then add 4 examples wrapped in <example><input>...</input><output>...</output></example> tags: two typical cases, one edge case, and one case where the correct answer is to refuse or return empty. Use identical formatting and similar length in every output, balance the labels so no class dominates, and end the prompt with the real input followed by nothing else so the model has only the completion left to write.

You might have meant

zero shot promptingchain of thought promptingprompt templatesystem promptfine tuning