CV Courseversity

Few-Shot, Zero-Shot, Meta, and Continual Learning

Surveys techniques for learning from very few or zero labeled examples, gradient-based meta-learning algorithms like MAML, and strategies for retaining prior knowledge while learning new tasks without catastrophic forgetting.

“A robotics team trains a grasping policy on forty object categories, and a warehouse client then asks it to reliably pick up a brand-new tool shape after seeing it only three times, in the next five minutes, without forgetting how to grasp the original forty objects it already knows. Ordinary supervised learning, which expects thousands of labeled examples per class and one fixed task forever, offers no way to do this. What has to change about how the model learns for rapid, data-scarce adaptation without forgetting to even be possible?”

Few-Shot and Zero-Shot Learning: Generalizing from Scarce Supervision · 15 min

Standard supervised learning assumes a fixed set of classes and thousands of labeled examples per class, but many real deployments confront the opposite situation: a handful of labeled examples, or none at all, for the categories that matter. Few-shot learning is typically framed as an "N-way K-shot" classification problem: at test time the model receives a small support set containing K labeled examples for each of N novel classes, and must correctly classify new query examples drawn from those same N classes. Rather than training a single classifier on this tiny support set from scratch, few-shot systems are meta-trained beforehand on a large collection of related tasks, each constructed as its own small N-way K-shot episode sampled from a data-rich base set of classes, so that the model repeatedly practices the exact skill of learning quickly from few examples before it ever faces genuinely novel classes.

One influential family of solutions is metric-based: the model learns an embedding space in which distance corresponds to semantic similarity, and classification of a query reduces to a nearest-neighbor comparison in that space. Matching networks learn an attention mechanism over the support set embeddings, effectively producing a weighted nearest-neighbor classifier that requires no fine-tuning at test time and demonstrated strong gains on benchmarks including Omniglot and ImageNet-derived few-shot splits. Prototypical networks simplify this further: each class's support examples are embedded and averaged into a single prototype vector, and a query is classified by which class prototype it lies closest to under a chosen distance, most commonly squared Euclidean distance. This simpler inductive bias, favoring compact class prototypes over more elaborate matching or attention machinery, was shown to match or exceed more complex alternatives on standard few-shot benchmarks.

Zero-shot learning removes labeled examples of the target classes entirely, even at adaptation time, so the model must instead rely on auxiliary semantic information, such as human-authored attribute vectors or embeddings derived from class-name text, that places both previously seen and entirely unseen classes in a shared semantic space. Classification of an unseen class then becomes a matter of relating an example's learned embedding to the semantic description of each candidate class rather than to labeled instances of it. Few-shot and zero-shot methods share a common thread: both depend on transferring structure learned during a data-rich phase into a data-poor target setting, and both remain sensitive to distribution shift between the base classes used for training and the novel classes encountered later, an open challenge that current benchmarks do not fully resolve.

Meta-Learning: Learning to Learn · 15 min

Meta-learning reframes the learning problem itself as the object of optimization: instead of training a model to perform well on one fixed task, meta-learning trains across a distribution of tasks so that the resulting model, initialization, or update procedure adapts quickly to a new task drawn from a related distribution. The setup typically separates a meta-training phase, during which the learner is exposed to many distinct but related tasks, from a meta-test phase, during which it must rapidly adapt to genuinely new tasks using only what the meta-training phase equipped it with. Approaches are often grouped into three families: metric-based methods that learn a good comparison space, as covered in the previous lesson; model-based methods that use architectures with explicit memory or recurrent state to encode task information as it is observed and condition predictions on it directly; and optimization-based methods that directly learn an initialization or update rule for gradient-based adaptation, of which MAML is the most influential example.

Model-Agnostic Meta-Learning, introduced by Finn, Abbeel and Levine, is the best-known optimization-based approach. MAML trains a single set of initial parameters such that a small number of ordinary gradient descent steps, computed on a new task's small support set, produce a model that generalizes well to that task. This makes MAML model-agnostic in a strong sense: it places no constraint on the model's architecture beyond being trainable by gradient descent, so the same algorithm applies to few-shot image classification, few-shot regression, and even policy-gradient reinforcement learning tasks. MAML's structure involves two nested loops: an inner loop that takes a few gradient steps on a single sampled task starting from the shared initialization, and an outer loop that updates the shared initialization itself based on how well the inner-loop-adapted parameters perform on that task's held-out query examples. Because the outer-loop update requires differentiating through the inner-loop gradient steps, exact MAML involves second-order derivatives, which is computationally demanding; first-order approximations such as FOMAML and simplified variants like Reptile trade some theoretical fidelity for substantially cheaper computation.

Meta-learning delivers real gains on the narrow benchmark settings where it has been most thoroughly studied, but the framing of "learning to learn" in a fully general sense remains an active and only partially realized research goal. Performance can be sensitive to how closely the distribution of meta-training tasks matches the tasks seen at meta-test time, and meta-learned initializations do not automatically transfer across very different domains; a model meta-trained on many variants of image classification, for instance, offers no particular guarantee of fast adaptation to an unrelated regression or control problem. In recent years, large-scale pretraining followed by fine-tuning or in-context adaptation, particularly in large language models, has become a competing and in some settings dominant paradigm for fast adaptation, since a sufficiently large pretrained model can often adapt to a new task from a handful of examples given directly in its input without any explicit gradient-based meta-training procedure at all. An ongoing area of research is understanding how these two paradigms relate to one another, and whether the explicit two-loop optimization at the heart of algorithms like MAML could be combined productively with large-scale pretraining rather than treated as a separate, competing approach.

Continual Learning and the Stability-Plasticity Dilemma · 15 min

When a neural network is trained sequentially, first on one task and then on another, its performance on the first task can collapse almost immediately after training on the second begins, a phenomenon McCloskey and Cohen documented and named the sequential learning problem, now commonly called catastrophic forgetting. French's later analysis traced the underlying cause to how connectionist networks represent knowledge: because information is encoded in distributed, overlapping patterns of activation across shared weights, gradient updates driven by a new task can freely overwrite the very weights that encoded an earlier task, with no built-in mechanism protecting old knowledge. This sets up what is often called the stability-plasticity dilemma: a system needs enough plasticity to absorb new tasks, but enough stability to preserve what it has already learned, and naive gradient-based training pushes almost entirely toward plasticity at stability's expense.

Elastic weight consolidation, introduced by Kirkpatrick and colleagues, is a widely cited response to this dilemma. After training on a task, EWC estimates how important each parameter was to that task's performance using the Fisher information matrix, which approximates how sharply the loss would increase if a given weight were perturbed. When training on a subsequent task, EWC adds a quadratic penalty term to the loss that grows with the product of a weight's estimated importance and how far it has moved from its previous value, so learning is selectively slowed on weights critical to earlier tasks while weights unimportant to those tasks remain free to adapt. The method was evaluated on sequences of permuted MNIST classification tasks and on Atari 2600 games learned one after another, showing it could retain substantially more prior performance than training without any forgetting-specific safeguard.

EWC exemplifies one of three broad families of continual learning strategies. Regularization-based methods like EWC constrain how much important parameters can change. Rehearsal or replay-based methods instead store a subset of past examples, or train a generative model to reproduce them, and interleave that data with new-task training so gradient updates cannot single-mindedly favor the new task. Architectural methods sidestep the conflict altogether by allocating new capacity, such as new modules or subnetworks, for each new task while protecting earlier ones. It is honest to state plainly that no single one of these families has solved catastrophic forgetting: current methods trade off differently across long task sequences and diverse domains, evaluation protocols for continual learning are themselves still debated in the research community, and preventing forgetting while retaining full plasticity for indefinitely long task sequences remains an open problem.

Practice

Few-Shot Classification by Prototype Distance

A (1,1)A (3,1)Proto A (2,1)B (5,5)B (7,5)Proto B (6,5)Query (2,2)d = 1d = 5

Averaging each class's support points gives prototype A = (2,1) and prototype B = (6,5); the query point (2,2) is distance 1 from prototype A but distance 5 from prototype B, so a prototypical network assigns it to class A.

  • Few-shot and zero-shot methods succeed by learning a transferable embedding space or initialization during a data-rich meta-training phase, then exploiting that structure with minimal or no labeled data on the target task.
  • MAML explicitly optimizes for fast adaptability rather than final task performance: it searches for initial parameters from which a few gradient steps generalize well to a new task, making it agnostic to model architecture and applicable even to reinforcement learning.
  • Catastrophic forgetting is not fully solved: regularization methods like elastic weight consolidation, rehearsal methods, and architectural methods each trade off differently between retaining old skills and staying plastic enough to learn new ones, and no single approach dominates across all task sequences.

Recall Practice

Episodic trainingClick to reveal
Why do few-shot learning systems train on many small simulated tasks (episodes) instead of one large classification problem?
Because the goal is to learn a representation or adaptation procedure that generalizes to new classes seen only a few times at test time; repeatedly practicing on many K-shot episodes during meta-training teaches the model the skill of fast adaptation itself, mirroring the few-shot conditions it will face later.
MAML mechanicsClick to reveal
What are the two nested optimization loops in MAML, and what does each one do?
The inner loop takes a few gradient steps on a single task's small support set starting from the shared initialization; the outer loop then updates that shared initialization itself, using how well the adapted parameters perform on each task's query set, so that future inner-loop adaptation from that same starting point works well across many tasks.
Zero-shot bridgeClick to reveal
Since zero-shot learning has no labeled examples of the target classes at all, what does the model rely on to classify them?
Auxiliary semantic information, such as human-defined attribute vectors or text-derived class embeddings, that describes the unseen classes in a space shared with the seen classes, letting the model relate a new class to combinations of familiar concepts.
Stability-plasticityClick to reveal
What is the stability-plasticity dilemma in continual learning, and how does elastic weight consolidation address it?
It is the tension between staying stable enough to retain previously learned tasks and staying plastic enough to learn new ones; EWC addresses it by using the Fisher information matrix to estimate which weights matter most for old tasks and then penalizing large changes to exactly those weights, leaving less important weights free to adapt.

Glossary

N-way K-shot task
A few-shot learning problem with N classes and K labeled examples per class in the support set available at adaptation time.
Support set
The small set of labeled examples given for a new task, used to adapt or condition the model before it is evaluated on query examples from the same task.
Meta-learning
Training a model across a distribution of tasks so that it acquires an inductive bias, initialization, or learning procedure that lets it adapt quickly to a new, related task with little data.
Prototype
In prototypical networks, the mean of a class's support example embeddings in a learned feature space, used as the reference point for classifying nearby queries.
Catastrophic forgetting
The sharp loss of performance on previously learned tasks that occurs when a network is trained sequentially on new tasks without safeguards, because gradient updates for the new task overwrite representations shared with old ones.
Elastic weight consolidation (EWC)
A regularization-based continual learning method that adds a quadratic penalty, scaled by each parameter's estimated importance (via Fisher information) to earlier tasks, discouraging large changes to those parameters while learning a new task.
Practical Activity

Classify a Query Point with a Prototypical Network, by Hand

A fully paper-and-pencil, simulated exercise: given a support set of two 2-D embedding points for class A, (1,1) and (3,1), and two for class B, (5,5) and (7,5), compute each class prototype by averaging its support points (class A prototype = (2,1); class B prototype = (6,5)). Then, given a query embedding at (2,2), compute its Euclidean distance to each prototype by hand (distance to A = 1, distance to B = 5) and assign the query to the nearer class, exactly as a prototypical network would. No real model is trained, no embeddings are actually computed by a neural network, and no data is collected — every number is worked out directly from the coordinates given.

Ready to test yourself?

5 questions on this module.

Start Quiz