Few-shot Learning

AI concepts
About 1 min read

A technique that includes 2 to 10 input-output examples in the prompt without retraining the model, enabling the AI to immediately follow the patterns and formats of the task.

Also known as
Few-shot LearningFew-shotFew-shot Prompting

Detailed explanation

A core technique of In-Context Learning that allows the model to grasp the rules, tone, and output structure of the task to be performed through a few examples included in the prompt, without modifying the model's weights (fine-tuning). It offers higher accuracy than Zero-shot and is highly effective when complex data extraction in specific domains or compliance with defined formats (such as JSON) is required. It is used as a practical alternative to fine-tuning in environments lacking training data or requiring rapid prototyping.

Why it matters in tool selection

Few-shot learning enables performance similar to a 'specialized model' without large-scale data labeling and expensive fine-tuning. It is especially efficient when implementing chatbots that need to maintain a specific persona or process unique internal corporate document formats, as it refines execution instructions while utilizing the model's base intelligence.

What to check

  • Is the format of the examples (labeling, line breaks, etc.) maintained consistently across all shots?
  • Are the situations covered by the examples non-overlapping and inclusive of diverse cases?
  • Does the number of shots not excessively occupy the model's context window (token limit)?
  • Does the order of examples not create bias? (Check tendency to recognize recent examples as more important)

Example: Sentiment Analysis

Input: 'I'm annoyed because the delivery is so late.' // Output: Negative Input: 'The counselor is kind, so I feel good.' // Output: Positive Input: 'The product is average, but the packaging is poor.' // Output: ?

Confusing terms

Zero-shot

A method of generating responses using only instructions (System Prompt) without any examples.

Fine-tuning

A method of permanently training the model by directly modifying its weights (parameters) using thousands or more data entries.

Related terms

Zero-shotFine-tuning