Artificial Intelligence

What is Few-Shot Prompting?

Quick answer

Giving a language model a handful of worked examples inside the prompt so it can follow the same pattern for a new input.

Few-Shot Prompting, explained

Few-shot prompting shows a model what good output looks like instead of only describing it. The prompt includes a small number of input and output pairs, often two to five, followed by the new input the model should handle. It sits between zero-shot prompting, which gives no examples, and fine-tuning, which retrains the model on many examples.

A small online store might classify customer emails this way. The prompt lists three sample emails labelled refund, delivery question, and product question, then adds a new email and asks for its label. The model picks up the format and categories from the examples. Few-shot prompting is quick and cheap to try, but the examples use up part of the context window, and poorly chosen examples can bias results.

Related terms

Guides that mention Few-Shot Prompting