- Introduced by
- Dvornik, N., Schmid, C., & Mairal, J.
- Year
- 2019
- Type
- Ensemble of few-shot learners
- Family
- Machine learning
What does it do?
Ensemble few-shot learning combines several few-shot learners, such as prototypical networks or matching networks, to classify new classes from one to about twenty labeled examples each.
The base learners are trained to differ from one another, and their predicted class probabilities are averaged at inference. Dvornik, Schmid, and Mairal (ICCV 2019) developed this approach with an emphasis on diversity-promoting cooperative training; whether the gain over a single model holds depends on the backbone and benchmark.
The intuition behind the method
Few-shot learning is hard because the model must generalize from very few labeled examples per class. A single model can be unstable under such scarcity: small changes in the support set or in its initialization can shift its predictions noticeably. An ensemble spreads this instability across several learners. Each base learner is trained to view the problem somewhat differently, through a different embedding, initialization, or augmentation policy. When their predicted probabilities are averaged, one learner's unusual error is diluted by the others. The method uses no labeled data beyond what a single model would use; its benefit comes from how the learners are built and combined.
History
Dvornik, Schmid, and Mairal (ICCV 2019) study ensembles of few-shot classifiers. The title of their paper frames the work around diversity and cooperation in ensemble methods for few-shot classification. Wang et al. (2020) survey few-shot learning and identify the unreliability of the empirical risk minimizer as the core issue the field addresses.
When to use it
Choose ensemble few-shot learning when labeled data is very scarce, roughly one to twenty examples per class, and a single few-shot model's accuracy varies noticeably from run to run. It is also a reasonable choice when downstream use needs probability estimates that are more stable than a single learner provides. Its typical application areas are image recognition of rare categories and medical imaging with few confirmed cases. Do not use it when inference compute is tightly limited, since M base learners multiply the cost. Do not rely on it when the task distribution changes substantially between meta-training and deployment, because averaging does not correct a domain gap. Domain-adaptive methods are a better fit in that case. It is also a poor choice when a per-prediction explanation from a single model is required.
Limitations and considerations
- Inference cost grows linearly with the number of base learners, which can be a barrier on resource-constrained devices.
- Adding learners brings diminishing returns, and keeping the learners genuinely different becomes harder as the ensemble grows.
- Episodic meta-training across several learners requires more infrastructure and tuning than standard supervised training.
- Ensembling reduces variance across learners but does not address domain shift between meta-training and deployment data.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Averaging over base learners reduces the influence of any one learner's unstable predictions, without requiring additional labeled examples.
- The base learners can be metric-based or gradient-based, so the ensemble can be built around different few-shot backbones.
- Averaging class probabilities, rather than taking hard votes, keeps the confidence information that downstream thresholding can use, subject to the calibration step described above.
- Because the final prediction is an average, one base learner that converged poorly moves the result less than it would move a single-model prediction.
Applications
- Rare-category image classification where collecting more annotations per class is expensive.
- Medical imaging triage for uncommon conditions with only a few confirmed cases.
- Fine-grained species recognition from field photographs with few labeled examples per species.
How it works
How it works
A set of M base few-shot learners is instantiated. Each is typically a metric-based model, such as a prototypical network or matching network, or a gradient-based meta-learner, such as a MAML variant. The learners are trained on the same task distribution but differ in architecture, embedding dimensionality, or initialization seed, so that they are not identical copies.
Diversity among the base learners is encouraged during training. Common sources of diversity are different random seeds, different initializations, distinct data augmentation policies, and architecture variants such as backbone width or embedding dimensionality. Without some source of diversity, the learners tend to make similar predictions and aggregation adds little. The title of Dvornik et al. (2019) places diversity and cooperation at the centre of their ensemble methods; the specific form of any cooperative training objective should be checked in the paper before it is implemented.
Training is episodic. In each episode, an N-way K-shot task is sampled from a large labelled meta-training set: N classes are selected, K labeled examples per class form the support set, and the model must classify query examples from those N classes. Each base learner computes its own episode loss and updates its parameters to reduce it. If the training objective includes a cooperative term that couples the learners, as the title of Dvornik et al. (2019) suggests, the learners are no longer trained fully independently; the form of that term must be taken from the paper.
At inference, each base learner outputs a probability distribution over the N novel classes given the support set. The ensemble averages these distributions, as in the formula above, and predicts the class with the highest average probability. This is soft voting. It keeps the probability information that hard majority voting discards.
Formula
\hat{y} = \arg\max_c \frac{1}{M} \sum_{m=1}^{M} p_m(c \mid x)Averaged probabilities are not guaranteed to match empirical accuracy. A post-hoc recalibration can align confidence with observed accuracy. For multiclass outputs, temperature scaling is a common choice, and vector scaling is a more flexible alternative. The calibration parameters should be fitted on held-out validation episodes, not on the test episodes. This step matters most when the confidence score is used downstream, for example in thresholding or in deciding which examples to annotate.
Common pitfalls
- Building the ensemble from identically initialized models with no diversity mechanism. The learners then produce nearly identical predictions and the ensemble behaves as a single model.
- Evaluating on the meta-training classes instead of truly unseen novel classes, which inflates reported accuracy.
- Using very few query examples per episode. Query set size affects the noise in the episode accuracy estimate, so enough query examples are needed to resolve differences between models.
- Reporting only mean accuracy from a single run. Few-shot results vary strongly between runs, so results should be averaged over several random seeds with uncertainty estimates.
- Replacing soft averaging with hard majority voting. This discards probability information that averaging retains, and may hurt confidence estimates.
Frequently asked questions
How many base learners should the ensemble have?
There is no fixed rule. Accuracy gains diminish as learners are added, and each learner adds inference cost. Five is an arbitrary starting point for tuning, not a recommended value. Increase the number only if variance across test episodes remains high, and check the effect on your own validation episodes.
Does ensemble few-shot learning require more labeled data than a single model?
No. The ensemble uses the same meta-training set as a single model. The diversity comes from different initializations, augmentation policies, or architecture variants, not from additional labels.
How is diversity measured and enforced?
A common way to measure diversity is the rate at which base learners disagree on query examples. Diversity can be introduced through different random seeds, augmentation policies, or architectures. Dvornik et al. (2019) frame their work around cooperation among ensemble members; check the paper for the exact form of any cooperative objective before relying on a description of it.
Is soft averaging always better than hard majority voting?
Soft averaging is usually preferred when the base learners output probabilities, because it keeps calibration information and handles close cases more smoothly. It is not guaranteed to win on every benchmark. Hard voting is mainly relevant when the base learners output only class labels and no probability estimates are available.
Can ensemble few-shot learning be combined with data augmentation or self-supervised pre-training?
Yes. Self-supervised pre-training on unlabeled data, for example with SimCLR or DINO, is one way to produce stronger feature representations, and an ensemble can be built on top of such features. Whether this helps more than a supervised backbone depends on the task and should be tested on held-out novel classes.
What assumptions does the method rely on?
Three assumptions are central. First, the novel classes used at test time are disjoint from the classes used in meta-training. Second, the tasks seen during meta-training resemble the tasks encountered at deployment. Third, the episodes used for training and evaluation are sampled representatively. If the second assumption fails, averaging across learners does not correct the domain gap, and domain-adaptive methods are a better fit.
How should ensemble results be read?
Report accuracy averaged over many test episodes, with confidence intervals, rather than a single run. Compare the ensemble against a single base learner trained with the same seeds and training budget. Check that the ensemble gain is larger than the seed-to-seed spread of the single learner. A gain smaller than that spread is not clear evidence of improvement.
Related methods
Sources
Dvornik, N., Schmid, C., & Mairal, J. (2019). Diversity with Cooperation: Ensemble Methods for Few-Shot Classification. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 3716–3725.
Open publication referenceWang, Y., Yao, Q., Kwok, J. T., & Ni, L. M. (2020). Generalizing from a Few Examples: A Survey on Few-Shot Learning. ACM Computing Surveys, 53(3), 1–34.
Open DOI reference