Self-supervised Few-shot Learning

Machine Learning
Introduced by
Gidaris, S. et al.; Su, J.-C. et al. (concurrent seminal works)
Year
2019
Type
Hybrid learning paradigm (self-supervised pretraining + few-shot adaptation)
Family
Machine learning

What does it do?

Self-supervised Few-shot Learning (SSL-FSL) combines self-supervised pretraining on unlabeled data with few-shot learning, so that a model can recognize new categories from a handful of labeled examples.

The approach is aimed at the case where labeled support data is scarce and unlabeled data is available. Gidaris et al. (2019) propose using self-supervision as an auxiliary task in a few-shot learning pipeline, and Su et al. (2020) take up the question of when self-supervision improves few-shot learning.

The intuition behind the method

Imagine a learner who first studies many unlabeled pictures and builds an internal sense of shapes, textures, and context. When shown only a few labeled examples of a new animal, they can recognize it because the earlier study gave them a usable description of images. SSL-FSL follows this pattern: a neural network first learns representations from unlabeled data using pretext tasks, such as predicting image rotations or matching augmented views of the same image, and then adapts to a new task using a small labeled support set.

History

Two works from 2019 and 2020 study the combination of self-supervision and few-shot learning. Gidaris et al. (ICCV 2019) proposed self-supervision as an auxiliary task to improve few-shot visual learning. Su et al. (ECCV 2020) address the question of when self-supervision improves few-shot learning.

When to use it

Use SSL-FSL when labeled examples are scarce for the target classes but a sizeable unlabeled pool from the same or a closely related domain is available, as in medical imaging, rare-event detection, or recognition of novel categories. It is most relevant when annotation is expensive. Avoid it when abundant labeled data exists, since standard supervised training is the simpler choice in that case. Also avoid it when the compute for large-scale pretraining is not available, or when the unlabeled pool is small, out of domain, or of poor quality for the target task.

Limitations and considerations

  • Pretraining on large unlabeled sets is computationally and memory intensive, and this cost is incurred before any few-shot task is defined.
  • The benefit depends on how well the unlabeled pool matches the target domain, and a domain mismatch can reduce or remove the gain. The size of this penalty varies with the pair of domains and is not given as a general figure.
  • Most pretext tasks named here were developed with images in mind (for example rotation prediction). Applying SSL-FSL to text, audio, or graphs requires choosing and validating new pretext tasks, which is not straightforward.
  • Results are sensitive to the episode protocol (N, K, and the number of test episodes), which makes cross-paper comparison difficult.
  • With a prototype classifier, each support example contributes equally to its class mean, so a few atypical or mislabeled support examples can shift the prototype noticeably.
  • The method assumes that the unlabeled pool shares the relevant visual structure with the target classes. Where it does not, the pretrained features may transfer poorly to the new categories.
  • The method assumes that the K labeled support examples per class are representative of their class and that test classes are disjoint from the pretraining data. Violating either assumption makes the reported few-shot accuracy unreliable.

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

Strengths

  • Uses unlabeled images to learn features before the few-shot stage, so the scarce labeled budget is spent on the support set rather than on representation learning.
  • Gidaris et al. report consistent improvements across an array of architectures, datasets, and self-supervision techniques when self-supervision is used as an auxiliary task in a few-shot pipeline.
  • The unlabeled data does not have to come from the target classes; Gidaris et al. note that the approach can be extended to diverse unlabeled data from other datasets.
  • The self-supervised loss can be kept as an auxiliary term during meta-training, so it can be added to existing episodic learners such as Prototypical Networks or MAML rather than replacing them.

Applications

  • Medical image classification with limited annotated patient data (e.g., rare disease recognition).
  • Novel object recognition in robotics where only a few reference images are available.
  • Rare-event detection in surveillance imagery.

How it works

How it works

1

A backbone network is pretrained on a large pool of unlabeled data. No class labels are required; the model learns representations by solving proxy objectives that force it to capture semantically meaningful structure in the input space.

2

Self-supervised pretext tasks, such as instance discrimination, rotation prediction, or masked reconstruction, create surrogate supervision signals from the unlabeled inputs. Gidaris et al. use self-supervision as an auxiliary task alongside few-shot training, and these tasks are intended to push the features toward representations that transfer to new categories.

3

Training is organized into episodes that simulate the few-shot transfer scenario. Each episode samples a small support set (N classes, K labeled examples each) and a disjoint query set from the available labeled data, mirroring the conditions expected at test time.

4

Given the episode support set, the pretrained backbone is either fine-tuned or used directly to embed support and query examples. Class prototypes (mean embeddings per class) or optimization-based adaptation rules are then applied to align the representation to the new classes.

5

A metric-based classifier (e.g., nearest-centroid or cosine similarity) or an optimization-based head (e.g., a MAML-style gradient update) produces predictions for query examples. The SSL pretraining loss can serve as an auxiliary objective during meta-training to stabilize and improve generalization.

Common pitfalls

  • Using an unlabeled pretraining set that overlaps with test classes, which inflates reported accuracy.
  • Ignoring domain shift between the pretraining corpus and the target few-shot benchmark.
  • Selecting SSL pretext tasks designed for images without adapting them to the target data modality.
  • Comparing results across papers without controlling for backbone architecture, image resolution, and episode sampling protocol.
  • Skipping an ablation of the SSL component against a supervised pretrained baseline, so the gain attributable to self-supervision is not verified.

Frequently asked questions

How does SSL-FSL differ from standard transfer learning?

Standard transfer learning fine-tunes a pretrained model on a (typically larger) labeled target dataset. SSL-FSL specifically targets scenarios where only a handful of labeled examples per class exist at test time, and it explicitly trains or evaluates using episodic protocols that simulate this constraint.

Which self-supervised objectives work best for few-shot learning?

Self-supervised objectives include rotation prediction, instance discrimination, and masked reconstruction (see the description above). Gidaris et al. report gains across several self-supervision techniques rather than ranking them. The best objective depends on the modality and should be checked on your own episodes.

Do I need a meta-learning algorithm on top of self-supervised pretraining?

Not necessarily. Whether a meta-learner adds value over a simple classifier depends on the task. Su et al. (2020) address when self-supervision helps few-shot learning, so compare the options directly on your task, using a simple nearest-centroid classifier as one of the baselines.

How should I report results for SSL-FSL experiments?

Report the backbone architecture, SSL objective, pretraining dataset, episode configuration (N-way K-shot), number of test episodes, and 95% confidence intervals. Comparing against a supervised pretrained baseline is essential to isolate the contribution of self-supervision.

Is SSL-FSL suitable when I have no unlabeled data at all?

No. If no unlabeled data is available from the target domain or a related domain, the SSL pretraining step provides no benefit. In that case, standard few-shot methods with a supervised pretrained backbone on a large external dataset (e.g., ImageNet) are a more practical starting point.

Related methods

Sources

  1. Gidaris, S., Bursuc, A., Komodakis, N., Perez, P., & Cord, M. (2019). Boosting Few-Shot Visual Learning with Self-Supervision. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 8059–8068.

    Open DOI reference
  2. Su, J.-C., Maji, S., & Hariharan, B. (2020). When Does Self-Supervision Improve Few-Shot Learning? European Conference on Computer Vision (ECCV), Lecture Notes in Computer Science, vol 12371, 645–660.

    Open DOI reference