Semi-supervised Few-shot Learning

Machine Learning
Introduced by
Ren, M. et al. (ICLR 2018); builds on Finn et al. (MAML, 2017)
Year
2018
Type
Meta-learning with unlabeled auxiliary data
Family
Machine learning

What does it do?

Semi-supervised few-shot learning (SS-FSL) classifies novel classes from a small labeled support set while also using unlabeled examples within each episode.

Ren et al. (2018) combine episodic meta-learning with soft pseudo-label assignment, so that unlabeled points refine the class prototypes. The approach targets settings where few labeled examples per class are available together with unlabeled data from a related distribution.

The intuition behind the method

Imagine being asked to identify a rare bird species after seeing only five labeled photos, but you also have access to hundreds of unlabeled images of birds you cannot identify. Semi-supervised few-shot learning exploits that unlabeled pool: it assigns soft probabilities to each unlabeled image, uses those probabilistic assignments to pull the unlabeled examples toward the most similar labeled class cluster, and then re-estimates the cluster centers with this richer evidence. The result is a sharper, better-positioned representation of each class — allowing the model to classify new query images more accurately than if it had relied solely on the five labeled examples.

History

Ren et al. (2018, ICLR) introduced the integration of unlabeled examples into few-shot episodes, refining class prototypes with a soft k-means-style weighting over unlabeled points that may include distractors. The method extends prototype-based episodic few-shot learning, as reflected in its prototype computation and refinement steps. The model-agnostic meta-learning approach of Finn et al. (2017) is a related meta-learning method rather than the source of the prototype refinement. miniImageNet and tieredImageNet are the benchmarks most often used to evaluate this setting.

When to use it

Choose SS-FSL when only a few labeled examples are available for each novel class and a larger pool of unlabeled data from the same or a closely related distribution can be collected. Candidate settings include medical imaging, rare-species recognition, and low-resource text classification, where labeling is expensive but unlabeled data is accessible. It is a poor choice when the unlabeled data comes from a clearly different domain, because the soft pseudo-labels then pull prototypes toward the wrong regions. It is also unnecessary when a moderate amount of labeled data per class exists, since standard supervised training is then the simpler option. Finally, the episode design used in training should resemble the expected test scenario, including the number of novel classes.

Limitations and considerations

  • Sensitive to distribution mismatch: if unlabeled examples come from a different domain, soft pseudo-labels pull prototypes toward the wrong regions instead of refining them.
  • Episode design (N-way, K-shot, and the size of the unlabeled pool) should match the intended test scenario; a mismatch reduces transfer.
  • Meta-training needs a base set with many labeled classes to learn a generalizable embedding, which may not exist in domains where labeled data is scarce overall.
  • The soft-label softmax and the weighting of unlabeled terms in the prototype update are tuning choices, and they need validation on held-out episodes.
  • Accuracy varies with the random sampling of episodes, so results should be averaged over many test episodes and reported with uncertainty.
  • Reported gains come from benchmark evaluations on miniImageNet and tieredImageNet in 5-way 1-shot and 5-way 5-shot settings; the size of the benefit on other data is not established here and depends on the unlabeled pool matching the labeled distribution.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Uses unlabeled data to refine class prototypes, which can reduce the labeling effort needed for a given level of accuracy.
  • Reported to improve over purely supervised few-shot methods on miniImageNet and tieredImageNet (5-way 1-shot and 5-way 5-shot settings) when the unlabeled pool matches the labeled data distribution.
  • Episodic training targets the few-shot generalization problem directly rather than assuming full class coverage during training.
  • The prototype-based decision rule is simple to inspect and cheap to compute at inference time.
  • Extends prototype-based few-shot frameworks by adding a refinement step, without changing the embedding architecture.

Applications

  • Medical image classification when annotated patient cases are rare, for example rare disease diagnosis.
  • Fine-grained recognition of rare species in ecological studies with limited expert-labeled images.
  • Low-resource intent detection and text classification where only a few labeled utterances per class exist.
  • Industrial defect detection where defective examples are rare but normal, unlabeled samples are plentiful.

How it works

How it works

1

Training is organized into episodes that simulate the target few-shot scenario. Each episode samples N classes, K labeled examples per class (the support set), a pool of unlabeled examples that may include distractors from classes outside the N episode classes, and a query set on which predictions are evaluated. This structure trains the model to generalize across class configurations rather than to memorize one fixed label set.

2

For each of the N classes, a prototype is the mean of the embedding vectors of its K labeled support examples in the learned feature space. The prototype is the reference point for that class in the steps that follow.

Formula
\mathbf{c}_k = \frac{1}{|S_k|} \sum_{(x,y)\in S_k} f_\theta(x)
3

Each unlabeled example is embedded and its distance to every class prototype is computed. A softmax over the negative distances gives a soft pseudo-label, a probability for each class. Unlabeled points that lie close to one prototype receive a high probability for that class and therefore contribute more to its refinement. Because the softmax always distributes probability across the N episode classes, an unlabeled point that belongs to none of them still receives a pseudo-label; this step does not remove it.

Formula
\tilde{y}_{uk} = \frac{\exp(-d(f_\theta(x_u), \mathbf{c}_k))}{\sum_{k'} \exp(-d(f_\theta(x_u), \mathbf{c}_{k'}))}
4

Each prototype is recomputed as a weighted mean in which the labeled support embeddings and the unlabeled embeddings are summed, the unlabeled ones weighted by their soft pseudo-label for that class. The labeled support examples remain in both the numerator and the denominator, so they keep their influence on the prototype. Unlabeled points with low probability for a class add little to its update.

Formula
\mathbf{c}_k \leftarrow \frac{\sum_{S_k} f_\theta(x) + \sum_{u} \tilde{y}_{uk} f_\theta(x_u)}{|S_k| + \sum_u \tilde{y}_{uk}}
5

Each query example is classified by computing its distance to every refined prototype and applying a softmax over the negative distances. The class with the highest probability, equivalently the nearest refined prototype, is the predicted label.

Formula
p(y=k|x_q) = \frac{\exp(-d(f_\theta(x_q), \mathbf{c}_k))}{\sum_{k'} \exp(-d(f_\theta(x_q), \mathbf{c}_{k'}))}
6

The embedding network parameters are updated over many training episodes by minimizing the cross-entropy loss on query predictions. Training across episodes, rather than on a single fixed label set, is what aims to give the feature space that generalizes to unseen classes at test time. This page does not specify the optimizer or schedule; these should be taken from the original paper.

Common pitfalls

  • Using unlabeled data from a different domain or period without checking that its distribution resembles the labeled data.
  • Reporting accuracy from a small number of test episodes without an estimate of variability.
  • Allowing base training classes to overlap with novel test classes, which inflates the reported accuracy.
  • Using soft pseudo-labels as if they were hard labels early in training, so that early errors in prototype assignments are reinforced.
  • Fine-tuning a pre-trained backbone with a high learning rate on the few labeled support examples, which can overwrite the features the prototypes depend on.

Frequently asked questions

How is this different from standard few-shot learning?

Standard few-shot learning uses only the small labeled support set to classify queries. SS-FSL additionally incorporates unlabeled examples during each episode, using soft pseudo-labels to refine class prototypes, which can improve accuracy when a relevant unlabeled pool is available.

What if my unlabeled data contains classes not seen at training time?

SS-FSL does not remove distractors automatically. Unlabeled examples that belong to none of the N episode classes still receive a soft pseudo-label, because the softmax distributes probability across the episode classes, and they can therefore shift the refined prototypes. Handling distractors effectively requires an explicit mechanism, and the treatment in the original paper should be followed. When validating, check how strongly distractors move the prototypes and monitor the ratio of distractors to true class examples in the unlabeled pool.

How many unlabeled examples per episode are needed?

No fixed number is established here; the appropriate pool size depends on the data and should be tuned on validation episodes. A very small unlabeled pool adds little over pure few-shot learning, while a large pool with many out-of-class examples can degrade the refined prototypes.

Can I use a pre-trained backbone like ResNet or ViT?

A pre-trained backbone can be used if its features are relevant to the target domain. The choice of backbone and the fine-tuning learning rate are general practice rather than settings established for this method on this page; a low learning rate is commonly used so that general features are retained while the model adapts to the target domain. When reproducing published results, follow the backbone and training setup of the original paper.

What datasets are standard benchmarks for SS-FSL?

miniImageNet and tieredImageNet are the most common benchmarks, with results typically reported for 5-way 1-shot and 5-way 5-shot settings. tieredImageNet's class hierarchy is used to make train and test classes more clearly separated, which gives a cleaner test of generalization.

Related methods

Sources

  1. 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. In International Conference on Learning Representations (ICLR 2018).

    Open publication reference
  2. Finn, C., Abbeel, P., & Levine, S. (2017). Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning (ICML 2017), PMLR 70, 1126–1135.

    Open publication reference