A demonstration is an example supplied in a model’s context to show the desired relationship between an input and an output. It anchors a task in a concrete pattern, helping disambiguate instructions and guide response format and content. section 2.2.1 section 6.2.1
In few-shot prompting, demonstrations precede a new input, and the model continues the pattern during inference. This is in-context learning, not an update to model weights. Examples can appear in a system prompt or a user prompt alongside task instructions and constraints; they complement an explicit output schema rather than settling every formatting decision by themselves. section 6.3.2 section 2.2.1 section 6.2.1
Capital-city pattern
A prompt pairs Spain with Madrid, Japan with Tokyo, and Canada with Ottawa. When asked for Germany’s capital, the model can continue the demonstrated question-answer pattern with Berlin. section 6.3.2
Listing 6.3 Few-shot prompting in the ticket normalizer
"role": "user", #1
"content": "Bug report:\nThe mobile app crashes when I try to upload a
20 MB PDF. It worked yesterday."
"role": "assistant", #2
"content": json.dumps({
"title": "Crash when uploading large PDF",
"category": "file_upload",
"priority": "high",
"summary": "The mobile app crashes during PDF upload when the file
is around 20 MB.",
"next_step": "Investigate upload limits and crash logs for the
mobile client.",
}, indent=2)
"role": "user",
"content": "Bug report:\nSearch results on the dashboard take a long time
to load, especially in the morning."
"role": "assistant",
"content": json.dumps({
"title": "Slow dashboard search",
"category": "performance",
"priority": "medium",
"summary": "Dashboard search becomes slow, with the issue being most
visible during morning usage.",
"next_step": "Check query latency, indexing, and peak-time load on
the search service.",
}, indent=2)
"role": "user", #3
"content": f"Bug report:\n{report}\n\nReturn only JSON."
A ticket normalizer uses alternating bug reports and labeled JSON responses to demonstrate a support-ticket schema before a new report is supplied. section 6.6.1
Selection and operational trade-offs:
- For straightforward transformations, two to five demonstrations usually suffice. Each consumes tokens on every request, leaving less room for retrieved documents or conversation history. section 6.3.2
- For dynamic few-shot prompting, embed the incoming query and retrieve relevant examples from a demonstration store. Selection fits examples to a fixed token budget, but changing prompt prefixes can reduce caching efficiency. section 6.3.2
- Place examples within a broader prompt that also specifies the task, constraints, and output format. Stable prompt material can be placed early for caching, while the immediate request remains near the end. section 6.4.1








