ai.vostman.fi
← AI Glossary

Encyclopedia of AI

Few-shot prompting: examples specify the pattern

Few-shot prompting supplies a small set of demonstrations in the input before asking for another answer. The examples can establish the task, output format or a label convention without updating model weights.

For example, paired inputs and compact JSON outputs can show both which information to extract and how to represent missing fields. A written instruction and demonstrations can complement each other.

The examples are part of the computation

A model's response can depend on which demonstrations appear, their order and the distribution of labels. “Calibrate Before Use” documented strong sensitivity to these choices in few-shot language-model classification.

This means a successful prompt is more than a count of examples. Choose demonstrations that clarify meaningful distinctions, and try more than one ordering on held-out inputs.

Few-shot prompting trades context space and prefill work for task information. Fine-tuning instead changes parameters and can make a repeated behaviour less dependent on carrying the same demonstrations in every request.

Sources