AI & automation

What is few-shot prompting?

Few-shot prompting is the technique of including a small number of worked examples, typically two to ten input and output pairs, in a prompt so the language model learns the pattern you want and applies it to a new input.

An example

Say a property manager wants maintenance requests tagged by urgency. Instead of describing urgency in the abstract, the prompt shows: - "Water coming through the ceiling" -> urgent, plumbing - "Kitchen tap drips slowly" -> routine, plumbing - "Front door lock broken, cannot secure flat" -> urgent, security

Then it adds the new request. The model picks up the categories, the format and the judgement behind them far more reliably than from a paragraph of rules.

Choosing good examples

Cover the tricky cases, not only the obvious ones; the line between routine and urgent is where the model needs help. Keep the format identical across examples, because the model copies formatting quirks too. Mix the order, so it does not learn that the last example is always the answer. And watch for bias: if every example is labeled "routine," the model will lean that way.

Limits

Examples take up context space and cost tokens on every request. When you need hundreds of examples to get it right, or the same task runs millions of times, fine-tuning or a dedicated classifier can be cheaper. Few-shot is the quick, flexible first step and often all a small business needs.

Questions, answered

Often three to five well-chosen ones. Add more only if testing shows mistakes on particular kinds of input.

No. The model's weights do not change; it only uses the examples for that one request.

By the Stegnor team · Updated