Skip to content

Prompts

Few-shot prompting: show the model what you want

When a prompt without examples is enough, when to add one to three examples, and how to choose varied examples the model will not copy, with a customer-message classifier.

Talqeen wrote this article and no editor has reviewed it yet. Search engines do not see this page until it is reviewed.

Sometimes it is hard to explain what you want and easy to show it. Few-shot prompting puts one or more examples of input and desired output in the prompt, so the model picks up the pattern and applies it to new input.

Start without examples

Modern models follow instructions well, and many tasks work with a clear prompt alone (zero-shot). Start there; add examples when the output is inconsistent or in a style you do not want.

When to add examples

  • The output has a specific shape: fixed labels, a table with set columns.
  • You want a style that is hard to describe.
  • Edge cases matter: a message with both a complaint and praise.

Example: classifying customer messages

Classify the customer's message as one of: complaint, question, request, thanks.
Write the label only.

Message: The order arrived two days late and the box was broken.
Label: complaint

Message: Do you deliver to Tangier?
Label: question

Message: Thanks, great service, but I want to change the address for my next order.
Label: request

Message: {{message}}
Label:

The third example teaches a rule you never wrote: when thanks and a request come together, the request wins.

Choosing examples

Vary them; balance the labels; make sure each is correct; keep the same format in every example; and stay at three to five, since every token costs.

A common mistake: literal copying

The model may copy details you did not intend: length, a repeated word, a city name. Vary those details, or say the examples show the format, not the content.

Examples and real data

Never put real customer data in examples. The prompt goes to the model provider and may end up in a log or shared with a colleague. Test the prompt with and without examples on ten anonymised real messages and let the numbers decide.