A demonstration is a task example that pairs an input with its desired output. Adding one or more demonstrations to an instruction helps a language model generalize the same task to new inputs, often improving performance over zero-shot prompting. section 6.2.1
Use demonstrations deliberately because they shape both task interpretation and delivery trade-offs:
- Show the task’s expected input-output pattern rather than merely describing it. section 6.2.1
- Reuse strong examples to communicate style, structure, and other qualities that users want replicated. section 6.2.1
- Balance quality against scalability: manual example construction takes effort, consumes tokens, and can approach the model’s context-length limit. section 6.2.1
A content-generation demonstration
An instruction asks for a LinkedIn announcement about an upcoming EU AI Act webinar. Two previously successful webinar announcements are supplied as demonstrations, allowing the model to imitate their style and structure while generating a new announcement. section 6.2.1
Figure 6.3 Example of a few-shot prompt for sentiment analysis
A sentiment-analysis prompt diagram shows how demonstrations precede the current input and requested output. section 6.2.1


