Back to glossary

Term

Few-Shot Prompting

Few-shot prompting is a technique that includes a handful of input/output examples in the prompt so the model picks up the desired format and style.

Few-Shot Prompting — explained in more detail

Instead of giving the model a bare instruction (“classify this email”), you append three to five examples, each pairing an input with the expected output. The model infers the answer schema from the examples — concrete labels, a specific JSON format, or a particular tone of voice. This kind of learning happens entirely inside the context window, without touching the model weights (“in-context learning”).

Example / Practical context

A classic case is sentiment classification. The prompt lists three examples (“Great product!” → positive, “It was okay” → neutral, “Never again” → negative) followed by the new sentence. The model answers in the same schema. For structured output you show two or three JSON examples, and the model then holds the schema for new inputs — often more reliably than from a textual schema description alone.

Zero-shot prompting uses no examples at all and relies on the instruction alone. One-shot uses exactly one example. Chain-of-thought adds the reasoning path on top of the examples, not just the result. Fine-tuning, by contrast, changes the model itself — few-shot does not, so every new run has to repeat the examples in the prompt.

Entdecke mehr

Themenuebersicht