Zero-Shot and Few-Shot Prompting
Pedal Point's ticket sorter keeps putting "My parcel is a week late and I'm furious" under returns. The instructions clearly say late parcels are order_status, yet the model reads anger and assumes the customer wants their money back. Rewriting the rule a fourth time is not working. Showing it will.
The rule
Zero-shot tells the model; few-shot shows it.
A zero-shot prompt describes the task and gives no examples:
Classify the email as order_status, returns, product_question or other.It works well for clear, common tasks. A few-shot prompt adds a handful of worked examples, each an input and the exact output you want:
Email: Where is my order 4417? It's been ten days.
Label: order_status
Email: The saddle is too narrow, how do I send it back?
Label: returns
Email: Does the Trail 2 frame fit 29-inch wheels?
Label: product_question
Email: {new email}
Label:Examples teach what descriptions struggle to: the precise format, the tone, and where the line falls between similar categories. A rule says "late parcels are order_status"; an example shows what a late parcel sounds like.
Choose examples with care, because the model imitates them closely:
- Aim at the boundary. Include the cases the model gets wrong, like an angry late-delivery email labelled
order_status. - Balance the labels. If most examples say
returns, answers drift towardreturns. - Vary the surface. Different lengths, products and wording, so the model learns the rule, not a phrase.
- Match the format exactly. Whatever your examples look like, the output will copy it.
A handful of examples is usually enough. More cost tokens on every request and give diminishing returns.
Examples also quietly fix format. If you need replies shaped exactly like Label: returns with nothing else, two examples in that shape often beat a paragraph explaining it. And when examples and instructions disagree, models often lean toward the examples, so update both together whenever the rules change.