PromptForge
AI Glossary

Prompting techniques

Few-shot prompting

Also known as: few shot, in-context learning

Definition

Few-shot prompting means including two to five worked examples of the input-output pattern you want before making your real request. It is the fastest way to lock in a consistent format, tone or edge-case behaviour.

Few-shot works because models are exceptional pattern matchers. Showing three examples of the transformation you want communicates your conventions far more precisely than describing them, especially for anything involving formatting or style.

Example selection matters more than example count. Include a case that demonstrates each edge case you care about — the ambiguous input, the empty input, the one that should be rejected. Three well-chosen examples beat ten repetitive ones.

The trade-off is token cost. Examples occupy context on every request, so a heavily few-shot prompt costs meaningfully more at scale. For high-volume production tasks, this is a common reason to move to fine-tuning.

Example

Show: "Delivery was fast but the box arrived damaged." → Neutral. "Absolutely love this!" → Positive. "Never showed up, no refund." → Negative. Then ask for the real classification.

Related terms

Put this into practice

Understanding the term is step one. Our free courses and tools let you actually use it.