Few-Shot Prompting
Category: Generative AI / LLM
A technique where several task examples are included in the prompt to demonstrate the desired input-output pattern to the language model.
Full Explanation
Few-shot prompting provides a small number of input-output examples in the prompt to help the model understand the task format, style, and expected behavior. For instance, including three examples of sentiment classification (text → positive/negative) before the actual query helps the model produce consistent, accurate classifications. The number of examples typically ranges from 2 to 10, limited by the context window. Few-shot prompting leverages in-context learning and is especially valuable when the task is ambiguous or requires a specific output format. The quality and diversity of examples significantly impact performance, and examples should be representative of the task distribution. Few-shot prompting often outperforms zero-shot approaches, particularly for specialized or non-obvious tasks. It provides a middle ground between zero-shot inference and full fine-tuning.
Related Terms
More in Generative AI / LLM
Explore More
- AI Tools Library — Discover AI tools related to Few-Shot Prompting
- AI Education — Courses to learn about Generative AI / LLM
- AI News — Latest news and updates