Few-Shot Learning

Giving a model a handful of worked examples in the prompt so it infers the pattern you want.

Natural Language Beginner 1 min read

Also known as: In-Context Learning

Definition

Few-shot prompting includes a small number of input/output examples before the real input. The model infers the pattern and continues it — no weights change, which is why it is also called in-context learning.

It is usually the highest-leverage change available when a zero-shot prompt is nearly right: examples communicate format and edge-case handling far more reliably than prose instructions do. Three to five well-chosen examples typically capture most of the benefit.

How it relates to other terms

Contrast with Zero-Shot Learning Asking a model to do a task it was never explicitly trained on, using only an instruction and no examples. Part of Prompt Engineering Writing the input to a model deliberately — with context, examples and constraints — to get a more reliable ou... Contrast with Fine-Tuning Continuing to train an existing model on a smaller, specific dataset so it adapts to a particular task, domain...
Referenced by

Related terms

A neural network trained on very large amounts of text to predict what comes next, which turns out to be enough to answer questions, write code and ho...

Beginner Natural Language

The unit a language model actually reads and writes — usually a word fragment rather than a word or a character.

Beginner Natural Language

The maximum number of tokens a model can consider at once — everything it is allowed to "see" for a single response.

Beginner Natural Language

Prompting a model to work through its reasoning step by step before answering, which measurably improves multi-step problems.

Intermediate Natural Language

Was this definition helpful?

Definitions are reviewed by our editorial team. Spotted a problem? Tell us.