Five Examples Are Not a Dataset
A child who sees two or three pictures of an okapi can usually pick out the next one. A standard image classifier cannot do anything close to that. It needs hundreds or thousands of labeled images per class, and if a new class appears after training, the usual answer is to collect more data and train again.
Plenty of real problems never supply that much data. A rare disease may have a few dozen confirmed cases in a hospital archive. A factory inspecting a new product line has no photos of its defects yet. A language with few speakers has little annotated text. Few-shot learning is the study of classifiers that have to work with a handful of labeled examples per class, often one or five.
The usual vocabulary comes from the benchmarks. An «N-way K-shot» task gives the model N new classes with K labeled examples each (the support set) and then asks it to classify fresh examples of those classes (the query set). A 5-way 1-shot task means five classes and a single example of each.
Omniglot and the Human Baseline
The dataset that shaped the field is Omniglot, released by Brenden Lake, Ruslan Salakhutdinov and Joshua Tenenbaum. It has 1,623 handwritten characters from 50 alphabets, some historic, some invented for fiction, and each character was drawn by 20 different people recruited through Mechanical Turk. The design is the reverse of ImageNet: many classes, very few examples of each.
Their 2015 paper in Science used it to compare people with machines on one-shot classification. The model they proposed, Bayesian Program Learning, represented each character as a small probabilistic program of pen strokes and reached an error rate comparable to the human participants. That result was a challenge to deep learning, since the networks of the time did much worse in the same setting. Much of the work that followed was an attempt to close the gap with neural networks instead of hand-built generative models.
Episodes Instead of Batches
The idea that made neural few-shot learning work is simple to state. If the model will be tested on small tasks with new classes, it should be trained on small tasks with new classes too. Oriol Vinyals and colleagues at DeepMind put it plainly in their 2016 NeurIPS paper on Matching Networks: test and train conditions must match.
So training is organized in episodes. Each episode samples a few classes from the training set, a few support examples per class, and some queries. The model makes its predictions for that episode and gets a loss on the queries. The next episode uses different classes. Over thousands of episodes the model is not learning to recognize any specific class, since the classes keep changing. It is learning how to use a small support set.
The same paper introduced miniImageNet, a subset of ImageNet with 100 classes and 600 images each, small enough to run on a modest budget. It became the standard benchmark, and most of the numbers in this area come from it.
Comparing Instead of Classifying
The first family of methods avoids learning a classifier at test time at all. It learns an embedding, a function that maps each image to a vector, and then classifies a query by comparing it with the support examples. Gregory Koch and colleagues used siamese networks for this in 2015, training a network to say whether two Omniglot characters were the same. Matching Networks went further and classified a query with an attention-weighted vote over the whole support set.
Jake Snell, Kevin Swersky and Richard Zemel simplified the idea at NeurIPS 2017 with Prototypical Networks. Each class is reduced to one point, the mean of the embeddings of its support examples. A query goes to the class with the nearest prototype under squared Euclidean distance. That is the entire test-time procedure. On 5-way miniImageNet they reported 49.42% accuracy with one shot and 68.20% with five, which was the best published result at the time.
The appeal is that nothing needs to be trained when a new class shows up. If the embedding has learned to put images of the same thing close together, a new class only needs a few examples to define its center.
Learning an Initialization
The second family treats the problem as optimization. Chelsea Finn, Pieter Abbeel and Sergey Levine proposed Model-Agnostic Meta-Learning (MAML) at ICML 2017. The goal is a set of starting weights from which a few gradient steps on a small support set give a good model for that task.
Training has two loops. In the inner loop, the model takes one or a few gradient steps on the support set of a task, producing adapted weights. In the outer loop, those adapted weights are evaluated on the task’s query set, and the error is backpropagated through the inner steps to update the original starting weights. The outer loop does not ask for weights that are good on any one task. It asks for weights that become good quickly.
The name «model-agnostic» means it works for any model trained by gradient descent, and the paper showed it on regression, image classification and reinforcement learning. On miniImageNet it reported 48.70% for 5-way 1-shot and 63.11% for 5-shot. The cost is the second-order term. Backpropagating through gradient steps requires second derivatives, which uses a lot of memory and time.
First-Order Shortcuts
The paper itself tested a first-order approximation that ignores those second derivatives and found that it performed almost as well. Alex Nichol, Joshua Achiam and John Schulman at OpenAI pushed this further in 2018 with Reptile. Reptile trains normally on a task for several steps, then moves the starting weights a little toward wherever that training ended. Repeat over many tasks and the starting point drifts toward a region from which all of them are easy to reach.
Reptile has no inner and outer loss and no differentiation through the optimizer. It looks almost too plain to work, yet the authors reported results close to MAML on Omniglot and miniImageNet. They also gave an analysis showing that the update still contains a term that favors generalization across tasks, which is the effect MAML targets more directly.
Case: A Good Embedding Was Most of It
Around 2019 several groups looked closely at why these methods worked, and the answers were uncomfortable. Wei-Yu Chen and colleagues, in «A Closer Look at Few-shot Classification» (ICLR 2019), found that a plain baseline, trained as an ordinary classifier on the training classes and then fine-tuned on the support set, was competitive with meta-learning methods. With deeper backbones the differences between methods shrank. When the test classes came from a different domain (training on miniImageNet and testing on bird species), the baseline beat all the meta-learning algorithms they evaluated.
Aniruddh Raghu, Maithra Raghu, Samy Bengio and Oriol Vinyals asked a related question about MAML at ICLR 2020: does it work because the inner loop adapts features quickly, or because the starting features are already good? They found feature reuse was the dominant factor. Their simplified version, ANIL (Almost No Inner Loop), adapts only the final layer and matches MAML. In a further variant they removed even that, and accuracy held.
Yonglong Tian and colleagues at MIT and Google made the same point at ECCV 2020. They trained a standard network on all the training classes, froze it, and fit a linear classifier on each new task. That beat the specialized few-shot methods on the standard benchmarks, and self-distillation improved it further. Their title was a question, «A Good Embedding Is All You Need?», and the experiments mostly answered yes.
Examples Inside a Prompt
While vision researchers argued about episodes and inner loops, the phrase «few-shot» took on a second meaning. In 2020 Tom Brown and colleagues at OpenAI published «Language Models are Few-Shot Learners», the GPT-3 paper. Their model, with 175 billion parameters, was given a task description and a few worked examples directly in its input text, and then asked to complete a new one. No weights changed. The model inferred the task from the examples in the prompt, which the authors called in-context learning.
This fits the meta-learning framing more closely than it first seems. Pre-training on a huge and varied corpus exposes the model to countless small implicit tasks, and the network learns to pick up patterns from its context. Some later research has studied in-context learning as a learned algorithm running inside the forward pass. The difference from MAML is where adaptation happens: in activations rather than in weights.
Closing Thought
The strange history of this field is that the methods built to learn how to learn were largely outperformed by models that had simply learned good representations from a lot of data. That is not a failure of the meta-learning idea. It says that «learning to learn» and «learning a lot» end up close together: a representation trained on enough varied classes already places new ones near the right neighbors, and a few examples are enough to mark where they sit. The hard part of learning from five examples was mostly done before the five examples arrived.
By: Max Johnson B.
Deja una respuesta