Few-shot prompting

Showing the model two or three worked examples of the task inside the prompt, instead of only describing it.

Few-shot prompting works because pattern completion is what these models do best. Describing an output format in words leaves room for interpretation; showing two examples of it does not.

It is most valuable when the format is unusual, the labels are yours rather than standard ones, or the edge cases matter. Keep examples short, make them cover a hard case rather than three easy ones, and keep them consistent - a single inconsistency in your examples will be reproduced faithfully.

The cost is context. If examples grow past a few hundred tokens and the task is stable, that is the point where fine-tuning starts to pay.

Where this comes up

Prompts, configs and tutorials in the library that touch this term.