Technology · Machine learning
Few-shot learning
Machine learning training technique
Few-shot learning is the practice of training a model so that it can recognise new classes of thing from only a handful of labelled examples of each class.
The word "shot" counts the examples per class, and a task is usually described as an N-way k-shot problem: N is the number of new categories to be told apart, and k is the number of labelled samples available for each. A five-way five-shot task asks a model to sort items into five categories after seeing five examples of each, and in practice k is kept small, generally no more than twenty.[1] The setting matters because it is the one a person faces in the field: a new disease appears, a few photographs are taken, and something useful has to be done with them.
Key facts
| 92.34% | Intrusion detection accuracy using under 1% of training data, Yu and Bian 2020[2] |
|---|---|
| 42% | Atlas accuracy on Natural Questions with only 64 examples, Izacard et al. 2022[3] |
| 4.6% | Average accuracy gain from iterative semi-supervised few-shot, Li and Chao 2021[4] |
| 175 billion | GPT-3 parameter count tested without fine-tuning, Brown et al. 2020[5] |
Overview
Few-shot learning
The cotton leaf-spot study shows the shape of the problem concretely. Its authors selected forty images of each of three types of cotton leaf disease, segmented them to obtain disease spot images, and then randomly selected twenty spot images per class for training and used the remaining twenty per class for testing. That is a few-shot-style task: sixty training spot images in total, split evenly across three categories. The aim was practical, since identifying which disease a cotton plant carries allows the right treatment to be applied in time, and the study frames automated image recognition as a way to reach that judgement faster and more consistently than an experienced eye alone.[6]

Ordinary deep learning struggles here for a reason that is easy to state. A deep network has a very large number of adjustable parameters, and fitting them well requires a correspondingly large body of labelled data; when the training set is tiny, the network memorises it, fitting the training examples closely while failing on anything new. This is overfitting, and it shows up as high accuracy during training and poor accuracy at test time.[1] The shortage is not only a matter of convenience. In plant science and agriculture, labelled samples are expensive to obtain: some diseases are rare enough that large collections are impractical, and every label needs an expert or an experienced grower to assign it, which makes mass annotation slow and costly.[4] The same constraint appears wherever the thing being classified is uncommon or hard to record, so a method that works from a few examples is worth having on its own terms rather than as a shortcut.
The formal statement of the problem makes the role of outside knowledge explicit. Given a target task with a small supervised dataset and an auxiliary dataset unrelated to that task, the goal is to build a function for the target task that uses the little supervision available together with what the auxiliary data provides.[1] Few-shot learning is therefore not learning from nothing; it is learning from few examples plus prior experience, and the various method families differ mainly in where that prior experience is made to enter. A survey of the field groups the approaches into four kinds, based on data augmentation, on metric learning, on external memory, and on parameter optimisation, each attacking the overfitting problem from a different direction.[1] A separate survey reaches a compatible conclusion from a different angle, treating the unreliability of the error measured on so few samples as the core difficulty and sorting methods by whether they use prior knowledge to enlarge the data, to shrink the space of models considered, or to change how the best model is searched for.[7]
Few-shot learning does not remove the need for data; it moves most of the need onto prior experience and asks the new examples only to point at the right category.
Why the idea travels beyond any one field is that the scarcity it addresses is general. Agriculture supplies the clearest cases, since a grower with a phone camera and a handful of confirmed diagnoses is exactly the situation few-shot methods are built for, and the same shape recurs there because some diseases are rare enough that large collections are impractical and labelling requires expert effort.[4][1] In language, a model that has read a great deal of text can be shown a few worked examples of a new task inside its input and asked to continue the pattern, which is few-shot learning without any change to the model's parameters.[5] In each case the underlying bargain is the same, a small amount of new supervision combined with a large amount of knowledge acquired elsewhere, and the sections that follow take up how that bargain is actually struck.
History
Why data hunger made room for it
The appetite of deep learning for labelled data is not a side effect but a structural feature. A convolutional network, the standard architecture for image work, holds a large number of adjustable parameters, and a complete training run adjusts them over hundreds of rounds against a labelled training set before the model is tested on held-back data.[1] When that training set is large, the arrangement works well. When it is small, the parameters are fitted to the particular examples rather than to the pattern behind them, and the model that scores highly on its training data fails on new cases. The survey describes this as a serious overfitting problem and notes that the traditional algorithm then loses the near-magical performance it shows on large collections.[1]

The obvious remedy, collecting more labelled data, runs into the conditions under which much of the interesting work is done. In agriculture the number of samples available is often very limited, because acquisition involves security, ethics, resources and cost.[1] The plant-disease literature makes the same point in more concrete terms: some diseases are rare enough that collecting large numbers of samples is impractical, and annotating what is collected requires experts or experienced farmers, so mass labelling is time-consuming and laborious.[4] A model that needs thousands of examples per class is therefore not merely expensive in these settings; it is unusable, because the examples do not exist and cannot be made to exist at reasonable cost.
There is a second cost that is easy to overlook, and it is about deployment rather than data. Deep models carry deep network structures and masses of parameters, which demand substantial hardware to train and to test, and that makes them hard to run on portable terminals of the kind a grower or a field worker would actually carry. A method that learns from few samples with a small model addresses both problems at once, and the argument for it is framed in exactly those terms: low cost of data, and a model small enough to be practical.[4]
The response the field settled on was to imitate the way people seem to manage the same trick. A person recognises a new kind of object after seeing it once, and researchers took that rapid learning as the model to copy, proposing few-shot learning as a way to train a classifier that performs well from one or a few labelled images per class.[1] The framing is worth pausing on, because it locates the solution in prior knowledge rather than in the new samples. The small labelled set is not asked to teach the model everything; it is asked to select among things the model has already in some sense learned. A survey of the area states the core difficulty in matching terms, observing that the error estimated on so few samples is unreliable, and that the various methods differ in how they bring prior knowledge to bear on that unreliability.[7]
The idea has drawn sustained attention in a short time. A quantitative review of documents indexed in Scopus, searching titles, abstracts and keywords for 'few shot' combined with artificial intelligence, learning, neural networks or classification (limited to English-language articles and reviews), found 595 documents, with two published in 2017, 44 in 2019 and 389 in 2021. Those counts are small in absolute terms next to the wider machine-learning literature, and the same review notes that the large majority of the documents, 58 percent, discuss purely theoretical approaches rather than applications.[1] The growth is nonetheless steep, and it tracks the widening recognition that data hunger is a general obstacle rather than a quirk of one domain.
What the field produced in response falls into four broad families. Methods based on data augmentation attack overfitting by enlarging the sample count through reuse of the originals; methods based on metric learning classify by judging similarity between samples; methods based on external memory add storage and memory modules to help the model learn; and methods based on parameter optimisation learn how to optimise the parameters themselves.[1] A separate survey offers a three-way division based on how prior knowledge is used: to augment the supervised experience (data), to reduce the size of the hypothesis space (model), or to alter the search for the best hypothesis (algorithm).[7] Each family is a different answer to the same question, which is where the missing data is to come from, and the sections that follow take them up in turn.
How it works
Episodes, support sets and query sets
A few-shot task is described by two numbers, and the pair fixes exactly what the learner is asked to do. In an N-way k-shot problem, N is the number of categories to be told apart in a given task and k is the number of labelled examples supplied for each of them.[1] A five-way one-shot task presents five categories with a single example apiece; a five-way five-shot task presents the same five categories with five examples each. The labelled examples handed to the learner form the support set, and the unlabelled items it must assign to those categories form the query set. The support set plays the role a training set plays in ordinary learning, and the query set plays the role of the test set, but both belong to the same small task and are used together.[1]

The reason for splitting a task this way is that the categories themselves keep changing. Ordinary training fixes a set of classes in advance and adjusts a network until it separates them; the resulting model is then tested on new items drawn from those same classes. Few-shot learning instead aims at a model that can be handed categories it has never seen and still sort them, given only the support set as a guide. Training therefore proceeds over many separate tasks, called episodes, each with its own small support set and query set and its own selection of classes, so that what the model practises is the act of learning a new task rather than the identity of any particular category.[8] The procedure has two stages, meta-training on a stream of such episodes and meta-testing on fresh episodes whose classes were not used in training, and each stage carries its own support and query sets, with the meta-testing support set used to fine-tune and the meta-testing query set used to measure the model.[1]
The distinction between this and ordinary training is easy to miss and worth stating plainly. A conventional network is judged on whether it has stored the boundary between a fixed set of classes. An episodic learner is judged on how well it adapts, episode after episode, and the classes in the training episodes are a means to that end rather than the end itself. This is why the number of classes available for meta-training can be large while the number of examples per class in any one episode stays small: the model sees many different small problems, and the variety is what teaches it to handle a new one.
Whether the episodic arrangement is actually necessary has been tested directly. Matching Networks and Prototypical Networks are two popular methods that use nonparametric approaches at the level of the episode, comparing a query item to the support examples rather than fitting a new classifier., and a set of ablative experiments compared them against versions trained in the ordinary non-episodic way, on shuffled batches rather than constructed tasks. In ablative experiments with Matching Networks and Prototypical Networks, the non-episodic counterparts were considerably simpler, had fewer hyperparameters, and improved their performance on multiple few-shot classification datasets.[9] The result is a caution rather than a refutation: constructing episodes imposes constraints on how the training data is used, and for methods that classify by comparison those constraints can waste information that a plainer arrangement would exploit.
Two practical details follow from the episode design. The first is that k is generally no more than twenty examples per class.[1] The second is that the same model can be evaluated at several values of N and k, and its accuracy will differ across them, so a claim about few-shot performance is only meaningful when the task shape is stated alongside it.
The vocabulary of support and query sets also clarifies what the later method families are doing. A method that learns a space in which similar things sit close is, in these terms, learning a comparison rule that can be applied to any support set; a method that adapts parameters is learning a starting point from which a support set can quickly shape a classifier. Both are ways of making the support set do more work than its size would suggest, and both are trained by presenting episodes until the adaptation becomes reliable. The episode is the unit in which all of this is measured, which is why the terms recur wherever few-shot methods are described.
An episode is a rehearsal of the real problem: a handful of labelled examples, a set of unlabelled items, and a model that must connect them without having seen the categories before.
Learning a space where similar things sit close
One way to classify from a handful of examples is to stop treating classification as the fitting of a boundary and treat it instead as a question of distance. The idea rests on an embedding: a function that maps each input, an image or a spectrum or a sentence, to a point in a space of many dimensions, arranged so that inputs of the same kind land near one another and inputs of different kinds land far apart. If such a space can be learned, then a new item can be classified without any further training, simply by asking which of the known examples it lies closest to. This is metric learning, and its appeal in the few-shot setting is that the expensive work happens once, during training, while the act of classifying a new class costs only a comparison.
The comparison is usually made not against every stored example but against a summary of each class. A prototype is the average position, in the learned space, of the examples belonging to one class; a class with five labelled examples has a prototype at the centre of those five points. Prototypical networks formalise this: they learn a metric space in which classification is performed by computing distances from a query item to the prototype of each class, and the authors argue that this simpler inductive bias is an advantage precisely in the limited-data regime, where elaborate architectures have too much room to fit noise. The same work extends the scheme to zero-shot learning, achieving state-of-the-art results on the CU-Birds dataset.[10] The prototype is a small idea with a large consequence: it turns a set of examples into a single point, and a single point can be compared cheaply and reliably.
Matching Networks approach the same comparison from a slightly different angle. Rather than averaging a class into one prototype, the network learns a mapping from a small labelled support set and an unlabelled item to that item's label, so that the whole support set is available when the judgement is made and no fine-tuning is needed to adapt to new class types. The reported gains were substantial: one-shot accuracy on ImageNet rose from 87.6 to 93.2 percent, and on the Omniglot benchmark from 88.0 to 93.8 percent, compared with competing approaches.[11] What matters for the idea is where the learning sits. The network is not learning what a cat looks like; it is learning how to weigh the evidence of a few labelled items against a new one, and that skill transfers to categories it has never encountered.
The cotton leaf-spot study is a clear worked example of the pattern, and it shows each part of the machinery in place. Its authors built a two-way parallel convolutional network with shared weights, which extracts features from two images at once, and trained it with a loss function that shapes a metric space in which similar leaf samples are pulled close together and dissimilar ones pushed apart. Classification was then done by a k-nearest-neighbour classifier operating in that learned space, so that a new spot image was assigned to whichever class its nearest neighbours in the space belonged to.[6] Nothing about the classifier is specific to cotton; it is a general rule for reading distances, and the network's job was to make those distances meaningful.
The same pattern recurs wherever the input is high-dimensional and the labels are scarce. A deep few-shot method for hyperspectral image classification, where each pixel carries hundreds of narrow spectral bands, extracts spectral and spatial features with a residual three-dimensional convolutional network, trains it on episodes to learn a metric space in which same-class samples are close and different-class samples far, and then classifies test samples by a nearest-neighbour rule in that space. The authors state the key idea directly: the network learns a metric space from the training data, and that space generalises to classes of the test data that were never seen during training.[12] The claim is worth taking seriously because it is the whole bet of metric learning compressed into a sentence. If the space is good, the classes in it hardly matter.
Why should a space learned on one set of categories be useful for another? The answer is that the space encodes similarity of appearance or structure rather than the identity of any particular class. Two kinds of leaf spot that look alike will sit near each other whether or not the network was trained on either; two kinds that differ in colour and texture will sit apart. A classifier that reads distances is therefore reading a general property of the inputs, and the few labelled examples of a new class serve only to mark where that class sits. This is why the approach is often described as learning to compare rather than learning to recognise, and why the training signal is a matter of relative placement: the loss pulls same-class points together and pushes different-class points apart, and the absolute coordinates carry no meaning.
The design has practical virtues that follow from the same logic. Because the classifier is a comparison rather than a fitted boundary, adding a new class means adding its prototype, not retraining the network. The number of parameters that must be estimated from the small support set is essentially zero, which is exactly what a data-starved setting needs. And the comparison rule is transparent enough to inspect: a query item's assignment can be explained by naming its nearest neighbours, which is a form of justification that a fitted classifier rarely offers.
The approach is not without its assumptions. A prototype assumes that a class is well summarised by a single centre, which holds when the class is compact in the learned space and fails when it is spread out or multimodal; a class with two distinct appearances will have a prototype between them, in a region where nothing actually lies. The quality of the space is also inherited entirely from training, so a space shaped by categories unlike the target ones will place the new examples badly. These are the failure modes that later refinements address, and they mark the boundary of what a plain nearest-prototype rule can do. Within that boundary, though, the method is one of the cleanest expressions of the few-shot idea: most of the knowledge lives in the space, and the new examples do no more than point.
Other routes: augmentation, memory and parameter optimisation
Metric learning keeps the model fixed and makes the comparison do the work. The other three families change something else instead, and it is worth seeing them as answers to the same question: where does the missing information come from?
The most direct answer is to manufacture more data. Methods based on data augmentation attack the overfitting problem by enlarging the number of samples through reuse of the originals, so that a class with five examples becomes a class with many.[1] The reuse can be literal, as when an image is cropped, rotated or otherwise altered while keeping its label, or statistical, as when new feature vectors are drawn from a distribution estimated from the few real ones. Distribution calibration takes the second route: it assumes each dimension of the feature representation follows a Gaussian distribution, borrows the mean and variance from similar classes that do have plenty of examples, and then samples as many new points as the classifier needs from the calibrated distribution.[13] The bet is that a class with few examples is not really unknown, only badly measured, and that its statistics can be filled in from classes that were measured well.
A different answer is to give the model somewhere to keep what it has seen. Methods based on external memory add storage and memory modules to the network, so that information from the support set can be written down and read back when a query arrives, rather than being compressed into a fixed set of weights.[1] The appeal in a few-shot setting is that nothing has to be learned permanently from the new examples; they are held as they are, and the model learns how to consult them. This is the same instinct that later appears in language models that are handed their examples inside the input, though there the memory is the prompt itself rather than a module in the architecture.
The third family changes the learning procedure rather than the data or the store. Methods based on parameter optimisation learn how to optimise the parameters themselves, so that the model arrives at a new task already knowing how to adjust.[1] The framing is easiest to grasp through meta-learning, in which a model is trained across many related tasks to produce a learner that can pick up a further task quickly and from few examples.[14] What is being learned is not the answer to any one task but a starting point and an update rule that make the next task cheap.
Meta-SGD makes the idea concrete by asking what exactly should be learned. Its authors describe an SGD-like meta-learner that can initialise and adapt any differentiable learner in a single step, and they note that it learns not only the learner's initialisation but also the update direction and the learning rate, all within one meta-learning process.[14] The contrast with a plain starting point is the point: a good initialisation tells the model where to begin, while a learned direction and step size tell it how to move once the few new examples arrive. The authors report that Meta-SGD is conceptually simpler and easier to implement than the popular meta-learner LSTM, and that it has a higher capacity than MAML, which learns only the learner initialisation.[14]
These routes are not rivals so much as different places to put the prior knowledge, and a survey of the area sorts recent meta-learning work into metric-based, memory-based and learning-based strands along much the same lines.[15] The practical consequence is that a system can combine them: a learned space, a memory of the support set, and an initialisation tuned for fast adaptation are not in conflict, and the boundaries between the families are drawn for clarity rather than because the methods exclude one another.
One caution belongs here rather than later. Each of these routes adds machinery, and machinery adds settings that must be chosen. A method that calibrates distributions has to decide which classes count as similar enough to borrow from; a meta-learner has an inner loop and an outer loop, each with its own step sizes. Those choices are themselves made from data, and when the only data available is the handful of examples the method was supposed to economise on, the choosing becomes part of the difficulty. The question of how to select among such settings without held-out examples is taken up later, as are the semi-supervised and transfer routes that bring in unlabelled data and other people's classes.
Augmentation, memory and parameter optimisation all supply what the support set lacks, but each supplies it in a different currency: more points, a place to keep the few, or a head start.
Borrowing unlabelled data and other people's classes
The methods so far assume that the few labelled examples are all the information available. That assumption is often false in a useful way. In many settings a small set of confirmed examples sits alongside a much larger pile of unlabelled material, and the unlabelled pile is cheap to collect even when labels are not.[4] A photograph of a leaf can be taken by anyone; deciding which disease it shows takes an expert. Semi-supervised learning exploits this asymmetry by using the unlabelled items together with the labelled ones, and in the few-shot setting it means letting the unlabelled data help place the class boundaries that the support set alone could only sketch.
The usual mechanism is pseudo-labelling. The model is trained on the few labelled examples, then asked to predict labels for the unlabelled items; the predictions it makes with high confidence are treated as if they were real labels and folded back into training. The obvious danger is that a wrong pseudo-label teaches the model something false, and the danger grows as the confidence threshold is lowered. The remedy is to set that threshold carefully, and one way to do it is to let the data decide how many unlabelled items to admit rather than fixing the number in advance.
A semi-supervised few-shot method for plant leaf disease recognition used a confidence interval to determine adaptively how many unlabelled samples to pseudo-label, then fine-tuned the model on the result. The procedure can be run once or repeated, with each round of pseudo-labelling feeding the next, and the iterative version gave the larger gain: across different splits of the data and different shot counts, the single semi-supervised pass improved average accuracy by 2.8 percent and the iterative version by 4.6 percent. The comparison that makes the number meaningful is against a transfer-based method that had reached an average of 90 percent accuracy at 80 shots; the semi-supervised approach reached 90 percent at 5 shots and 92.6 percent at 10 shots.[4] Fewer labels, not merely better use of the same number, is the claim.
A second kind of borrowing crosses domains rather than label boundaries. Transfer learning trains a model on a source domain where labelled data is plentiful and adapts it to a target domain where it is scarce, on the bet that features useful for recognising one set of classes remain useful for another. The bet fails when the two domains differ in their statistics, a mismatch called domain shift, and the failure is quiet: a model can perform well on the source and poorly on the target without any obvious sign of why. A cross-domain few-shot method for hyperspectral image classification addresses this directly, pairing few-shot training with a conditional adversarial strategy that aligns the distributions of the source and target domains, and running the few-shot procedure on source and target classes at the same time so that transferable knowledge is discovered while a discriminative model is learned for the target. Experiments on four public hyperspectral datasets showed the combined method outperforming existing few-shot and deep learning approaches for that task.[16] The design point is that adaptation and classification are handled together rather than in sequence, since a representation adapted without regard to the target classes may align the domains while discarding exactly what distinguishes those classes.
At the far end of the borrowing spectrum sits the case where the target class has no labelled examples at all. Zero-shot learning classifies items from categories for which no training examples were supplied, relying instead on a description of the category, such as a set of attributes or a textual definition, to locate it relative to classes that were seen.[17] The boundary with few-shot learning is a matter of degree rather than kind, and the two are often studied together: a method built for one setting can frequently be extended to the other by adding or removing the handful of examples. The same prototypical approach that classifies by distance to a class centre can be pushed to the zero-shot case by building the prototype from a description rather than from images.[10] What changes across the boundary is the currency of the prior knowledge, which shifts from a few labelled instances to a statement about what the class is like.
The semi-supervised route has a cost that belongs with its promise. Pseudo-labels are predictions, and a model that is wrong with confidence will reinforce its own error with each iteration, which is why the threshold and the number of rounds are not incidental settings but the substance of the method. The transfer route carries a parallel risk, since a source domain that is unlike the target can supply features that mislead rather than help. Both are ways of enlarging the evidence beyond the support set, and both enlarge the opportunity for the evidence to be wrong. How these methods fare when actually measured, and where the benchmarks themselves can flatter them, is taken up later.
Unlabelled data and other domains are both ways of buying information the support set cannot supply, and both are worth exactly as much as their resemblance to the task at hand.
Uses
Where it is put to work
The clearest way to see what few-shot learning is for is to look at the places where the shortage of labels is not a laboratory inconvenience but the ordinary condition of the work. In each of them the same shape recurs: a category that matters is rare, expensive to confirm, or entirely new, and the people who need it classified cannot wait for a large annotated collection to be assembled. What differs is the kind of evidence available and the cost of being wrong.
Plant disease recognition is the most fully worked example in the agricultural literature, and the reason is straightforward. A grower who suspects a disease can photograph a leaf, but confirming which disease it is requires expertise, and some diseases are rare enough that a large collection of confirmed images cannot be assembled at all.[4] The few-shot framing fits this situation because the labelled examples are the scarce item while the images themselves are not. The semi-supervised route described earlier was developed with exactly this setting in mind, using a small set of labelled leaf images together with a larger body of unlabelled ones, and its authors present the approach as a way to make automatic recognition practical when annotation is the bottleneck rather than photography.[4] The same logic extends past diseases to the general problem of monitoring crop health, where few-shot learning can assist farmers in monitoring crop growth and reduce the difficulty and cost of obtaining training data.[1]
Hyperspectral imaging shows the same scarcity in a harder form. Hyperspectral image classification involves limited labeled samples to train a classifier for very high-dimensional data. Few-shot methods have been applied to this problem precisely because the dimensionality is high and the labels are few, with the learned-metric approach described earlier trained on episodes and classifying test pixels by nearest neighbour in the resulting space.[12] Remote sensing more broadly faces the same constraint, since there is a limitation to obtaining sufficient labeled samples in the field.[18] The appeal of the few-shot framing in this domain is that a model can be adapted to a new region or a new set of land-cover categories from a small sample of confirmed sites rather than a fresh campaign of labelling.
Medicine presents the constraint in its sharpest form, because the labels are not merely expensive but often unobtainable. A systematic review of few-shot learning in medical imaging examined 80 relevant articles published between 2018 and 2023, and its stated motivation is the one that governs the field: the lack of annotated medical images limits the performance of deep learning models, which usually need large labelled datasets, and few-shot techniques can reduce that scarcity while improving the speed and robustness of analysis. The review places particular emphasis on the role of meta-learning and delineates a comprehensive methodological pipeline shared among all the studies it examined. The review also presents robustness evaluation techniques alongside its analysis of the studies' results.[19]
Medical text carries a parallel shortage. Many medical topics have limited annotated text-based data in practical settings. A review of few-shot learning for medical natural language processing searched the literature from 2016 to 2022 and found 51 articles meeting its criteria, all published after 2018 and most of them from 2020 onward. Concept extraction and named entity recognition was the most frequently addressed task, at 21 of the 51 articles, followed by text classification at 16. The review also records a pattern worth noting for what it says about the state of the field rather than about any one method: 32 of the 51 articles reconstructed existing datasets to fit few-shot scenarios, and the most frequently used dataset was MIMIC-III, appearing in 10 of them.[20] In other words, much of the evidence comes from re-cutting large collections into small ones, which is a reasonable way to test a method but is not the same as working with data that was scarce to begin with.
Intrusion detection illustrates a different kind of rarity, where the scarce category is scarce by nature. In a real network, abnormal behaviours occur much less frequently than normal behaviours, resulting in scarcity of abnormal samples. An intrusion detection method built on few-shot learning used less than one percent of the NSL-KDD training set and reported 92.34 percent accuracy on one test set and 85.75 percent on another, while comparison methods that used 20 percent of the training data reported lower figures on both. The gains were notable on the attack categories that take up only a small proportion of the dataset, with detection rates for U2R and R2L rising from 13 to 81.50 percent and from 44.41 to 75.93 percent, respectively.[2] The pattern is instructive: the benefit of learning from few examples concentrates exactly where the examples were fewest, which is the case the method was built for.
Drug repurposing takes the logic to its limit, where the category of interest may have no examples at all. Most diseases lack any approved drug, so a model that predicts treatments by learning from diseases that already have them is being asked to generalise to a region of the problem it has never seen. A graph foundation model called TxGNN was built for this setting, trained on a medical knowledge graph and using a graph neural network with a metric learning module to rank drugs as potential indications and contraindications across 17,080 diseases. The authors report that 92 percent of those diseases lack pre-existing indications and known molecular target interactions, which is what makes the task a zero-shot one rather than a few-shot one. The metric learning component is the same idea encountered earlier in a different guise: diseases with shared pathways and pathologies are placed near one another, and what is learned about the diseases that do have treatments is transferred to those that do not.[21]
Across these five settings the common thread is not the algorithm but the arithmetic of scarcity. Where labels are expensive, rare or absent, a method that extracts most of its knowledge from elsewhere and asks the new examples only to point has a structural advantage, and the advantage grows as the labels become scarcer. That is why the applications cluster where they do, and why the same handful of techniques keeps reappearing in fields as distant as cotton agronomy and drug discovery.
Research
Evidence from crops, images and language
What the numbers from the field show
The cotton leaf-spot study reports its results in a form that makes the trade-off visible. Taking DenseNet alone, accuracy rose steadily with the number of labelled examples per class: 56.79 percent at five shots, 71.67 percent at ten, 83.76 percent at fifteen and 87.68 percent at twenty.[6] The curve is the important part.
The study's own contribution was a training adjustment it called a spatial structure optimiser, applied during training to each of the three networks. The authors attribute DenseNet's advantage to its structure, whose width lets it extract more features as samples are added. Their inspection of the learned space supports the reading: without the optimiser, similar spots were distributed close together with staggering, lowering the fault tolerance of the nearest-neighbour rule, while with it the same-class spots clustered more tightly and the nearest-neighbour rule made fewer mistakes.[6] The lesson is not that one optimiser is generally best but that in metric learning the arrangement of the space is the result, and a change that tightens the clusters shows up directly as accuracy.
Unlabelled images and the size of the gain
The PlantVillage experiments put a number on what unlabelled data is worth. Using the public dataset split into a source and a target domain, the semi-supervised few-shot method was compared against a transfer-based few-shot method that had reached an average of 90 percent accuracy at 80 shots.[4] A method that borrows from unlabelled images is borrowing from the same distribution, and the size of the loan shrinks as the distributions diverge.
Language models given examples in the prompt
Language offers the starkest demonstration that a few examples can go a long way, provided the model has read enough beforehand. GPT-3, an autoregressive language model with 175 billion parameters, was evaluated on a wide range of tasks with no gradient updates and no fine-tuning at all: the task and its few-shot demonstrations were supplied purely as text in the model's input, and the model continued the pattern. In this in-context setting it achieved strong performance on translation, question answering and cloze tasks, and on tasks requiring on-the-fly reasoning such as unscrambling words, using a novel word in a sentence, or three-digit arithmetic. The authors also record where it struggled, naming datasets on which few-shot learning still failed and others where training on large web corpora raised methodological problems for the evaluation.[5] The result reframes what a "shot" is. Nothing in the model changed when the examples were presented; the examples acted as a specification of the task rather than as training data, and the capability being measured was latent in the pretrained weights and merely elicited by the prompt.
Retrieval changes the arithmetic of that trade. Retrieval-augmented models excel at knowledge-intensive tasks without needing as many parameters, and Atlas's document index can easily be updated.[3]
Why a benchmark number can flatter
The caution that runs through all of these results is that a few-shot score is only as trustworthy as the protocol that produced it. The difficulty is selection: choosing a prompt, a set of hyperparameters or a training objective normally requires held-out examples to compare candidates against, and in a true few-shot setting those examples are exactly what is missing. A study of this problem evaluated language models under what it called true few-shot learning, where no held-out examples are available for tuning, and tested cross-validation and minimum description length as criteria for choosing prompts and hyperparameters. The finding does not overturn the individual results above, but it sets their scope: prior work may have overestimated the true few-shot ability of language models given the difficulty of few-shot model selection, and the gap between a tuned figure and what the same method achieves without held-out examples can be substantial.[22]
A few-shot score measures two things at once, the method and the care taken in setting it up, and only the first of them travels to a new problem.
Risks and limits
Overfitting, weak benchmarks and the cost of selection
The methods described so far all promise to learn from a handful of examples, and the promise is real, but it is conditional. Three things can go wrong, and they are worth separating because they call for different remedies. The first is that the model fits the few examples it has rather than the pattern behind them. The second is that the handful of examples is a poor sample of the class, so even a model that does not overfit is misled. The third is that the number reported for a method was chosen with more information than a real deployment would have, which makes the method look better than it is.

A deep network has a large number of adjustable parameters, and when the training set is small it fits the particular examples rather than the pattern, scoring well on training data and poorly on anything new. The standard picture of the failure is a network whose parameters are over-fitted, with accuracy very high during training and low at test time.[1] Few-shot methods do not abolish this; they relocate it.
The second failure is subtler and is a property of the sample rather than the learner. With only a handful of examples per class, any classifier built from them is sensitive to badly chosen shots, meaning examples that are outliers for their class or that sit so close to another class that the two distributions overlap.[23] This is why the quality of the individual examples matters more in the few-shot regime than in ordinary learning, where a stray example is one among thousands and the fit smooths it away.
The third failure is about measurement, and it is the one most easily missed because it leaves no trace in the reported figure. Choosing a prompt, a set of hyperparameters or a training objective normally requires held-out examples to compare candidates against, and in a true few-shot setting those examples are precisely what is unavailable. A study that named this problem evaluated language models under what it called true few-shot learning, with no held-out examples for tuning, and tested cross-validation and minimum description length as criteria for selecting prompts and hyperparameters. On average both criteria only marginally beat random selection and fell far short of selection based on held-out examples, and they often preferred models that performed significantly worse than randomly chosen ones. The consequence for reading any few-shot result is direct: a reported accuracy usually reflects a configuration chosen with the help of data the deployed system would not have, and the gap between that figure and what the same method achieves without such help can be wide.[22]
Benchmarks carry a related weakness that is structural rather than a matter of tuning. A review of few-shot learning for medical text found that 32 of the 51 articles it examined had reconstructed existing datasets to fit few-shot scenarios, with MIMIC-III the most frequently used dataset, appearing in 10 of the 51 articles.[20]
That review also supplies the most direct evidence that the methods do not always deliver. Its authors report that benchmarking experiments demonstrated relative underperformance of few-shot methods on biomedical natural language processing tasks, and they attribute the limited progress to the rarity of specialised data, the lack of standardised evaluation criteria, and the underperformance itself on biomedical topics.[20] The three causes are entangled: without standard evaluation, results are hard to compare, and without comparable results it is hard to tell whether a method is weak or merely badly measured. The review's own remedy is institutional rather than algorithmic, proposing that publicly available specialised datasets for biomedical few-shot work would aid method development by making comparative analysis possible.[20]
Overfitting, sensitivity to a bad draw, and the cost of selecting a configuration all become more severe as the number of examples per class falls, which means the settings where few-shot learning is most needed are the settings where it is least reliable. The honest reading of a few-shot result therefore requires the shot count, the protocol by which settings were chosen, and the source of the data to be stated alongside the accuracy, since the number alone measures the method and the care taken in setting it up at once. How far scale and pretraining can substitute for that care is covered later.
Later developments
Scaling, pretraining and what comes next
The methods described so far mostly change the learner: they learn a space, a memory, an initialisation, or a way of borrowing unlabelled data. A different answer to the same shortage has come to dominate recent work, and it changes the learner far less while changing the model far more. The idea is to train one very large model on a very large and varied body of data, and then to present a new task to it as a few worked examples in its input, with no adjustment to its parameters at all. The examples act as a specification rather than as training data, and the ability to follow the specification is a by-product of the pretraining.

GPT-3 made this concrete at a scale that had not been tried. It is an autoregressive language model with 175 billion parameters, ten times more than any previous non-sparse language model, and it was tested on many tasks without any gradient updates or fine-tuning, with the task and its few-shot demonstrations supplied purely through text interaction. It performed strongly on translation, question answering and cloze tasks, and on tasks needing on-the-fly reasoning such as unscrambling words, using a novel word in a sentence, or three-digit arithmetic. The same work records where the approach struggled, naming datasets on which few-shot learning still failed and others where training on large web corpora raised methodological problems for the evaluation. The authors' framing is that scaling up language models greatly improves task-agnostic few-shot performance, sometimes reaching competitiveness with prior fine-tuning approaches that needed thousands of task-specific examples.[5]
The pattern is not confined to text. Flamingo is a family of visual language models built to adapt rapidly to new tasks from a handful of annotated examples, and its architecture bridges pretrained vision-only and language-only models so that sequences of interleaved images and text can be handled. Trained on large multimodal web corpora, a single Flamingo model could reach a new state of the art on several benchmarks with few-shot learning simply by being prompted with task-specific examples, and on numerous benchmarks it outperformed models fine-tuned on thousands of times more task-specific data.[24] The claim worth pausing on is the last one, because it inverts the usual arithmetic: the model that saw fewer examples of the task did better, because it had seen far more of everything else.
If examples in the prompt can specify a task, a natural next question is whether the specification can be made more efficient. Instruction tuning is the practice of fine-tuning a model on a large collection of tasks that are each described in natural language, so that the model learns to follow a described task rather than only to continue a pattern of examples. FLAN took a 137-billion-parameter pretrained language model and instruction-tuned it on over 60 natural language processing tasks verbalised through instruction templates, then evaluated it on task types it had not seen. The tuned model substantially improved on its unmodified counterpart and surpassed zero-shot 175B GPT-3 on 20 of the 25 tasks evaluated, and it outperformed few-shot GPT-3 by a large margin on several named benchmarks. Ablation studies identified the number of fine-tuning datasets, the model scale, and the natural language instructions themselves as key to the improvement.[25] The lesson is that the format of the prior knowledge matters as much as its quantity: the same underlying capability is more accessible when the task is stated in words the model has learned to act on.
A third line of work attacks a limitation that scale alone does not fix. A model that stores facts in its parameters must grow enormously to hold many of them, and updating what it knows means training it again. Retrieval augmentation pairs a model with an external document index that it can search at the moment of answering, so that knowledge lives in a store that can be edited rather than in weights that must be relearned. Atlas is a retrieval-augmented language model designed and pretrained to learn knowledge-intensive tasks from very few examples, and on Natural Questions it reached over 42 percent accuracy using only 64 examples, outperforming a 540-billion-parameter model by 3 percent despite having fifty times fewer parameters. Its authors also studied how the content of the document index affects performance and showed that the index can be updated easily.[3] The result does not show that retrieval beats scale in general; it shows that for tasks where knowledge is the bottleneck, a small model with a good index can substitute for a very large one.
These developments sit alongside the older method families rather than replacing them, and the boundary between them is a live question. That is a useful corrective to the impression that scale has made the machinery of episodes and metric spaces obsolete: pretraining supplies a great deal of prior knowledge, but how that knowledge is elicited from a handful of examples is still a design choice with measurable consequences.
What remains open follows from the same tension. Scale substitutes for examples up to a point, and the point is not yet well mapped: the results above show large models doing well from few examples on some tasks and failing on others, without a general account of which is which. The cost of pretraining is itself a barrier, so a method that reaches a given accuracy with a smaller model and a retrieval index is attractive for reasons that have nothing to do with elegance. And the caution raised earlier about selection does not disappear when the model is large; if anything, a bigger model offers more settings to choose and more ways for a reported figure to reflect help the deployed system would not have. The direction of travel is clear enough, toward fewer task-specific labels and more general prior knowledge, but how far that trade can be pushed, and where its limits lie, is the question the next round of work has to answer.
Key studies
| Year | Study | Sample | Design | Finding |
|---|---|---|---|---|
| 2016 | Vinyals et al.[11] | Omniglot and ImageNet one-shot tasks | matching networks with an external memory | One-shot accuracy rose from 87.6% to 93.2% on ImageNet and from 88.0% to 93.8% on Omniglot. |
| 2019 | Liu et al.[12] | four widely used hyperspectral image datasets | deep few-shot learning with episodic training and nearest neighbour classification | The method beat conventional semi-supervised methods with only a few labelled samples. |
| 2020 | Yu & Bian[2] | NSL-KDD and UNSW-NB15 network intrusion datasets | few-shot intrusion detection experiment | Training on less than 1% of the data reached 92.34% accuracy on KDD-Test+, and U2R detection rose from 13% to 81.50%. |
| 2021 | Li & Chao[4] | PlantVillage dataset split into source and target domains | semi-supervised few-shot classification experiment | The single semi-supervised method improved average accuracy by 2.8% and the iterative method by 4.6%, reaching 90% at 5-shot. |
| 2021 | Liang[6] | 150 cotton leaf images, 50 for each of three disease types | metric learning with a two-way parallel convolutional network | S-DenseNet classified spots 7.7% more accurately on average than DenseNet across different numbers of steps. |
| 2021 | Wei et al.[25] | 25 unseen task types | instruction tuning of a 137B parameter model on over 60 tasks | FLAN surpassed zero-shot 175B GPT-3 on 20 of 25 tasks. |
| 2021 | Yang et al.[13] | miniImageNet and one other dataset | distribution calibration with a logistic regression classifier | The calibrated classifier improved accuracy by about 5% on miniImageNet compared with the next best method. |
| 2021 | Perez et al.[22] | language model few-shot tasks with held-out examples removed | true few-shot model selection experiment | Cross-validation and minimum description length only marginally beat random selection and greatly underperformed selection with held-out examples. |
| 2022 | Izacard et al.[3] | Natural Questions and other knowledge-intensive tasks | retrieval augmented language model evaluation | Atlas reached over 42% accuracy on Natural Questions with only 64 examples, beating a 540B parameter model by 3% with 50 times fewer parameters. |
| 2023 | Ge et al.[20] | 51 articles on few-shot learning for medical text | systematic review of articles published from January 2016 to October 2022 | Concept extraction, or named entity recognition, was the most frequently addressed task, appearing in 21 of 51 articles, and benchmarking experiments showed that few-shot methods underperformed on biomedical natural language processing tasks. |
| 2024 | Pachetti & Colantonio[19] | 80 relevant articles published from 2018 to 2023 | systematic review with risk of bias assessment | The review set out a methodological pipeline shared among the studies it examined, and it notes that some studies used a pre-training step and data augmentation techniques. |
| 2024 | Huang et al.[21] | 17,080 diseases in a medical knowledge graph | zero-shot drug repurposing benchmark against 8 methods | TxGNN improved prediction accuracy for indications by 49.2% and contraindications by 35.1%. |
See also
References
- Yang, J., Guo, X., Li, Y., Marinello, F., Ercisli, S., & Zhang, Z. (2022). A survey of few-shot learning in smart agriculture: developments, applications, and challenges. Plant Methods, 18(1). doi:10.1186/s13007-022-00866-2
- Yu, Y., & Bian, N. (2020). An Intrusion Detection Method Using Few-Shot Learning. IEEE Access, 8, 49730-49740. doi:10.1109/access.2020.2980136
- Izacard, G., Lewis, P., Lomelí, M., Hosseini, L., Petroni, F., Schick, T., Dwivedi-Yu, J., Joulin, A., Riedel, S., & Grave, É. (2022). Atlas: Few-shot Learning with Retrieval Augmented Language Models. arXiv. doi:10.48550/arxiv.2208.03299 Free full text
- Li, Y., & Chao, X. (2021). Semi-supervised few-shot learning approach for plant diseases recognition. Plant Methods, 17(1). doi:10.1186/s13007-021-00770-1
- B., B. T., Mann, B., Ryder, N., Subbiah, M., A, J. K., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G. M., Henighan, T., Child, R., Aditya, R., M., Z. D., Wu, J., Winter, C., & ... Amodei, D. (2020). Language Models are Few-Shot Learners. arXiv. doi:10.48550/arxiv.2005.14165 Free full text
- Liang, X. (2021). Few-shot cotton leaf spots disease classification based on metric learning. Plant Methods, 17(1). doi:10.1186/s13007-021-00813-7
- Wang, Y., Yao, Q., Kwok, J. T. Y., & Ni, L. M. s. (2019). Generalizing from a Few Examples: A Survey on Few-Shot Learning. arXiv. doi:10.48550/arxiv.1904.05046 Free full text
- Ren, M., Triantafillou, E., Ravi, S., Snell, J., Swersky, K., Tenenbaum, J. B., Larochelle, H., & Zemel, R. S. (2018). Meta-Learning for Semi-Supervised Few-Shot Classification. arXiv. doi:10.48550/arxiv.1803.00676 Free full text
- Laenen, S., & Bertinetto, L. (2020). On Episodes, Prototypical Networks, and Few-shot Learning. arXiv. doi:10.48550/arxiv.2012.09831 Free full text
- Snell, J., Swersky, K., & Zemel, R. S. (2017). Prototypical Networks for Few-shot Learning. arXiv. doi:10.48550/arxiv.1703.05175 Free full text
- Vinyals, O., Blundell, C., Lillicrap, T., Kavukcuoglu, K., & Wierstra, D. (2016). Matching Networks for One Shot Learning. arXiv. doi:10.48550/arxiv.1606.04080 Free full text
- Liu, B., Yu, X., Yu, A., Zhang, P., Wan, G., & Wang, R. (2019). Deep Few-Shot Learning for Hyperspectral Image Classification. IEEE Transactions on Geoscience and Remote Sensing, 57(4), 2290-2304. doi:10.1109/tgrs.2018.2872830
- Yang, S., Liu, L., & Xu, M. G. (2021). Free Lunch for Few-shot Learning: Distribution Calibration. arXiv. doi:10.48550/arxiv.2101.06395 Free full text
- Li, Z., Zhou, F., Chen, F., & Li, H. (2017). Meta-SGD: Learning to Learn Quickly for Few-Shot Learning. arXiv. doi:10.48550/arxiv.1707.09835 Free full text
- Gharoun, H., Momenifar, F., Chen, F., & Gandomi, A. H. (2024). Meta-learning Approaches for Few-Shot Learning: A Survey of Recent Advances. ACM Computing Surveys, 56(12), 1-41. doi:10.1145/3659943
- Li, Z., Liu, M., Chen, Y., Xu, Y., Li, W., & Du, Q. (2022). Deep Cross-Domain Few-Shot Learning for Hyperspectral Image Classification. IEEE Transactions on Geoscience and Remote Sensing, 60, 1-18. doi:10.1109/tgrs.2021.3057066
- Xian, Y., Lampert, C. H., Schiele, B., & Akata, Z. (2019). Zero-Shot Learning—A Comprehensive Evaluation of the Good, the Bad and the Ugly. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(9), 2251-2265. doi:10.1109/tpami.2018.2857768
- Sun, X., Wang, B., Wang, Z., Li, H., Li, H., & Fu, K. (2021). Research Progress on Few-Shot Learning for Remote Sensing Image Interpretation. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 14, 2387-2402. doi:10.1109/jstars.2021.3052869
- Pachetti, E., & Colantonio, S. (2024). A systematic review of few-shot learning in medical imaging. Artificial Intelligence in Medicine, 156, 102949. doi:10.1016/j.artmed.2024.102949
- Ge, Y., Guo, Y., Das, S., Al-Garadi, M. A., & Sarker, A. (2023). Few-shot learning for medical text: A review of advances, trends, and opportunities. Journal of Biomedical Informatics, 144, 104458. doi:10.1016/j.jbi.2023.104458
- Huang, K., Chandak, P., Wang, Q., Havaldar, S., Vaid, A., Leskovec, J., Nadkarni, G. N., Glicksberg, B. S., Gehlenborg, N., & Zitnik, M. (2024). A foundation model for clinician-centered drug repurposing. Nature Medicine, 30(12), 3601-3613. doi:10.1038/s41591-024-03233-x
- Perez, E., Kiela, D., & Cho, K. (2021). True Few-Shot Learning with Language Models. arXiv. doi:10.48550/arxiv.2105.11447 Free full text
- Yu, T., He, S., Song, Y. Z., & Xiang, T. (2022). Hybrid Graph Neural Networks for Few-Shot Learning. Proceedings of the AAAI Conference on Artificial Intelligence, 36(3), 3179-3187. doi:10.1609/aaai.v36i3.20226
- Alayrac, J. B., Donahue, J., Luc, P., Miech, A., Iain, B., Hasson, Y., Lenc, K., Mensch, A., Millican, K., Reynolds, M., Ring, R., Rutherford, E., Cabi, S., Han, T., Zhitao, G., Samangooei, S., Monteiro, M., Menick, J., Borgeaud, S., & ... Simonyan, K. (2022). Flamingo: a Visual Language Model for Few-Shot Learning. arXiv. doi:10.48550/arxiv.2204.14198 Free full text
- Wei, J., Bosma, M., Zhao, V. Y., Guu, K., Yu, A. W., Brian, L., Du, N., Dai, A. M., & Le, Q. V. (2021). Finetuned Language Models Are Zero-Shot Learners. arXiv. doi:10.48550/arxiv.2109.01652 Free full text
Cite this page: Atlas Nova editors. (2026). Few-shot learning. Atlas Nova. https://velocer.io/atlas/few-shot-learning/