Skip to content

Few-shot Prompting

Few-shot

Showing the model two or three examples of the task instead of describing it.

Few-shot prompting puts a few worked examples in the context so the model can infer the pattern: the input format, the expected output, the level of detail, the edge cases you care about. It is a form of in-context learning, since nothing is trained; the examples only live in that one request.

It is often more reliable than a paragraph of description, and it is usually more token-hungry. A careful choice of three examples can outperform a long rule list. A poor choice of three examples can pin down a wrong pattern, including a formatting quirk you did not want.

The main failure is picking unrepresentative examples. If every example you show is clean, the model will not know what to do with a messy one, and it will imitate your tidiness rather than your actual standard.

Related terms

Want this working inside your team?

It starts with one conversation about your workflow.

Ask on WhatsApp