# One-shot learning

> Canonical: https://skillalmanac.com/glossary/one-shot-learning | Last verified: 2026-11-25 | Index status: index-eligible

One-shot learning is a machine learning setup for recognising a new category from one labelled example per class. It is the K=1 case of few-shot learning, which covers adaptation from small support sets.

Also called: one shot learning, one-shot classification, one shot classification, learning from one example.

## In plain language

Image classifiers usually need many labelled pictures before they recognise a new category. One-shot learning asks for much less: show the system one labelled example, such as a single photo of a new kind of tool, and it has to pick out that kind of tool in later photos. People do this naturally with objects they have never met before. For machines it is hard, because one example cannot show how much a category varies.

## Technical definition

The setup is usually posed as classification from a support set holding one labelled example per class. Matching Networks (Vinyals et al., arXiv 2016) map a small labelled support set and an unlabelled example to a label without fine-tuning for the new classes, and test the idea on Omniglot and ImageNet and on language tasks. IBM describes the case K=1 in few-shot learning as one-shot learning. The Matching Networks abstract describes this as a framework designed so that new classes need no fine-tuning.

## How it shows up when you use agents

You are unlikely to train a one-shot classifier while using Claude Code, Codex or Cursor. The phrase turns up in two other places. One is machine learning papers on recognising categories from one example. The other is prompting, where "one-shot" often means a single worked example placed in the prompt. Specify the setup: an example embedded in a language-model prompt differs from the labelled support-set/query classifier in Matching Networks. Neither setup necessarily fine-tunes weights for each new class.

Mixing them up causes two mistakes. You may expect a prompt example to teach the model something lasting, when it only affects that request. Or you may read a one-shot result in a paper as proof that a model needs no data, when the method may rely on a model built beforehand; read the paper's setup to see what was trained and on what.

A sensible habit is to ask how the example is used: as a support item for a classifier, as a prompt demonstration, or in a parameter update. Weight updates alone do not define the distinction. If you are checking an agent that classifies things from one example, test it on several different inputs, not just the example it was shown. The [llm-eval-test-sets](/skills/skill-almanac/llm-eval-test-sets) skill helps build such a set. See also [few-shot learning](/glossary/few-shot-learning), [zero-shot learning](/glossary/zero-shot-learning) and [few-shot prompting](/glossary/few-shot-prompting).

## Common confusions

- **One-shot versus few-shot.** IBM describes one-shot learning as a challenging variant of few-shot learning, where K=1. Few-shot includes this one-example case as well as other small support sets.
- **One-shot versus zero-shot.** Zero-shot gives no examples of the new class. One-shot gives exactly one.
- **One-shot learning versus one-shot prompting.** The first names a few-example task setting, often with a support set and queries. The second places one demonstration in a prompt. Some support-set methods also require no new-class weight update, so inspect the adaptation mechanism.
- **Myth.** "One-shot learning means the model learned from one example." The Matching Networks abstract describes a framework that maps a small labelled support set and an unlabelled example to a label without fine-tuning for new classes. The model is built before the single example arrives.

## Worked examples in this catalogue

### [Prompt Engineering for Agents vs Chat Models](https://skillalmanac.com/learn/prompt-engineering-guide-for-agents)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A guide on how prompting an agent differs from prompting a chat model, including what the prompt must define.

Why it exercises the concept: Giving a language model one worked example inside a prompt is called one-shot prompting. This is an input-demonstration setup. Absence of new weight updates does not distinguish it from every one-shot method: Matching Networks also adapt to new classes without fine-tuning, using a labelled support set and a query. The guide is adjacent, not a one-shot learning tutorial.

### [prompt-writing](https://skillalmanac.com/skills/skill-almanac/prompt-writing)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill is described as writing and linting LLM prompts with a fixed structure, injection rules and a numeric test plan.

Why it exercises the concept: It is an illustrative place to prepare a single-example prompt. That prompt-level workflow is not the support-set/query classifier studied by Matching Networks; it does not train or run one.

### [llm-eval-test-sets](https://skillalmanac.com/skills/skill-almanac/llm-eval-test-sets)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill is described as building and validating an eval dataset for any LLM feature, with a checker for duplicates, missing graders, imbalance and leakage.

Why it exercises the concept: A one-shot result rests on very few examples, so a careful test set matters. The skill's checks for duplicates and leakage illustrate how an evaluation can be inflated.

## Related terms

- [Few-shot learning (FSL)](https://skillalmanac.com/glossary/few-shot-learning.md)
- [Zero-shot learning](https://skillalmanac.com/glossary/zero-shot-learning.md)
- [Meta-learning](https://skillalmanac.com/glossary/meta-learning.md)
- [Transfer learning](https://skillalmanac.com/glossary/transfer-learning.md)
- [Supervised learning](https://skillalmanac.com/glossary/supervised-learning.md)
- [Few-shot prompting](https://skillalmanac.com/glossary/few-shot-prompting.md)

## Sources

- [Matching Networks for One Shot Learning (Vinyals et al.)](https://arxiv.org/abs/1606.04080), arXiv (accessed 2026-11-24)
- [What is few-shot learning?](https://www.ibm.com/think/topics/few-shot-learning), IBM (accessed 2026-11-24)
- [One-shot learning (computer vision)](https://en.wikipedia.org/wiki/One-shot_learning_(computer_vision)), Wikipedia (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
