Few-shot Learning
"Few-shot Learning is giving a language model two to five worked examples inside its prompt so it copies the format, tone and handling they show."
What is a Few-shot Learning?
Few-shot Learning is giving a language model two to five worked examples inside its prompt so it copies the format, tone and handling they show. Related product: Chat Agents.
Reviewed by Atul Diwedi, Co-Founder · Last reviewed
Deep Dive
Few-shot learning is the practice of showing the model what good looks like, inside the prompt, instead of describing it. Where a rule says 'be concise and confirm the booking', a few-shot example shows an actual customer message and the exact reply you want. In a voice or chat agent the examples sit in the system prompt or in the configuration for a specific flow, and the model treats them as the pattern to continue.
How it works. Each example is a short exchange: the customer's message, optionally the retrieved facts or tool result, and the ideal agent reply. Two to five examples are placed in the prompt before the live conversation. The model does no training; it reads the examples as context on every turn and generalizes from them, so a prompt with three examples of polite refund declines produces polite refund declines for cases it has never seen. Examples can also show structure, such as how to format a quote or which fields to collect before confirming. Changing behavior means editing the examples and re-running the test set, which takes minutes.
Why it matters for consistency. Rules are interpreted; examples are imitated. Teams that struggle to get an agent to stop apologizing, to stop offering discounts, or to ask for the postcode before the problem description usually fix it with two examples where rules failed. The cost is prompt length: every example is read on every turn, which adds tokens and, on voice, a little latency. The discipline is to keep examples for behaviors the model gets wrong, not for everything, and to retire them when a shorter rule works.
Example. A Shopify store's chat agent keeps offering 'a discount for the inconvenience' on late deliveries, which the store never authorized. The owner adds two examples to the prompt. In the first, a customer complains about a delay and the agent replies with the tracking status, the carrier's estimate and an offer to escalate if it is not delivered by that date. In the second, a customer asks outright for compensation and the agent explains that the support team reviews those requests and collects the order number for them. Discount offers stop in the next day's transcripts, and the two examples cost about 180 extra tokens per turn.
Few-shot vs zero-shot. Zero-shot gives the model a description and no examples; it works for common tasks the model has seen often. Few-shot adds examples; it is needed when the task has house style, an unusual format or a boundary the model keeps crossing. Fine-tuning goes further by training the examples into the weights, which is only justified at thousands of examples and for behaviors that never change.
Common pitfalls.
- Examples that contradict a rule elsewhere in the prompt; the model will follow one of them unpredictably.
- Examples with facts in them (a price, a date), which the model may repeat for the wrong customer.
- Too many examples, which crowd out the live conversation in the context window.
- Never re-testing after a model change, since a new model may need different examples.
Botcadence agents are configured with instructions and example exchanges on top of document training, without any model retraining; see chat agents and prompt engineering.
Related Technology
See Few-shot Learning in a Botcadence agent
Start on the Free plan and configure an agent that uses Few-shot Learning on your own website chat or WhatsApp number. No card needed.
Get Started FreeWebsite chat live in about 5 minutes
Common Questions
Few-shot Learning FAQs
Two to five per behavior you are correcting. One example is often mistaken for a fact to repeat; more than five adds tokens without much gain. Start with the single behavior transcripts show the agent getting wrong most often.
No. Examples teach how to respond; the knowledge base supplies what is true. Putting prices or policies inside examples is a common mistake, because the model may quote the example's number instead of retrieving the current one.
Partly. Tone and boundaries carry over, but voice replies need shorter sentences and spoken-number formats, so write a separate set of voice examples or add a voice variant of each.
Keep a test set of 20-30 real customer messages and run it after each prompt change. If the behavior the example targets still appears, check for a conflicting rule in the prompt before adding more examples.