Home/Glossary/Few-shot

Few-shot

Few-shot is a technique where an AI model is given a small number of examples within its prompt to learn a new task or pattern before generating a response.

How it works

It works by providing the model with a few input-output pairs as a demonstration, allowing it to infer the desired format and logic without being retrained. This is a core capability of large language models (LLMs) that makes them highly adaptable and efficient for new applications.

Examples

  • 1.Giving an AI three examples of converting product names into marketing slogans before asking it to create a new one.
  • 2.Showing a chatbot two samples of polite email replies to customer complaints so it can craft a similar response.
  • 3.Providing a code generator with a couple of examples of a specific function in Python before asking it to write a new one.