Few-shot prompting means providing demonstrations of how to perform a task. Instead of relying only on the AI model’s general training, you give specific examples that guide the model to perform your exact task with higher quality. Think of it like showing a guitarist a few piano pieces before asking them to play piano for the first time. An example of few-shot prompting is: \ Prompt:
I was happy with the customer support today - satisfied
The product is horrible! - very unsatisfied
This is one of the best products I have ever used - very satisfied
This is such a great product! -
Output:
Very Satisfied
The examples define both the format and context the model needs. This leads to more consistent, accurate responses. When to use few-shot prompting:
  • Complex or nuanced tasks where format matters
  • When you need consistent output structure
  • 3-4 examples typically work best
Important limitation: For complex reasoning tasks, few-shot prompting hits its limits. In those cases, combine it with chain-of-thought principles for better results.