GLOSSARY

Few-Shot Prompting

DEFINITION

A prompting technique that includes a small number of input-output examples in the prompt to guide a model's behavior on a new task without updating model weights.

Few-shot prompting provides the model with a handful of examples (typically 2–10) that demonstrate the desired input-output pattern before presenting the actual task. The model learns in-context — without any gradient updates or retraining — to mimic the pattern shown in the examples.

This technique is especially valuable for tasks with unusual output formats, domain-specific terminology, or style requirements. For example, showing three examples of correctly formatted JSON extraction before asking the model to extract from a new document dramatically improves output consistency.

Few-shot prompting sits between zero-shot (no examples, fast to set up) and fine-tuning (permanent weight updates, requires data and training compute). It is the preferred approach when you need better performance than zero-shot but cannot justify the cost and complexity of fine-tuning. Example quality matters significantly: poor or inconsistent examples can degrade model performance.

Related Terms

Stay in the loop

Weekly AI tool reviews, news digests, and how-to guides.

Join 12,000+ builders