Abstract
Standard few-shot learning (FSL) methods often impose rigid constraints, requiring tasks to have a fixed number of classes. This paper introduces the Meta-Metric-Learner, a hybrid approach that integrates the class-agnostic flexibility of metric-based models with the rapid adaptation of optimization-based meta-learning. By utilizing Meta-SGD to dynamically update a metric-based base learner, the proposed model effectively handles tasks with varying class counts while generating task-specific distance metrics. Experimental results across multiple datasets demonstrate superior performance in flexible class settings compared to traditional baselines.
Introduction
In few-shot learning, models must recognize new classes from very few examples. Existing methods generally fall into two categories: optimization-based and metric-based. Optimization-based methods, like MAML or Meta-SGD, learn to predict classifier weights but require a fixed network architecture, making them incompatible with tasks of varying class counts. Metric-based methods, such as Prototypical or Matching Networks, use a shared embedding space and are non-parametric at the classification layer, allowing for flexible class numbers. However, they typically rely on a single, task-invariant metric that may not generalize well to diverse tasks.
The Meta-Metric-Learner addresses these limitations by combining both paradigms. It leverages the flexibility of metric learners while using an optimization meta-learner to adapt the underlying metric space to specific tasks.
The Meta-Metric-Learner Architecture
The core of the proposed method is a hybrid architecture where a metric-based model (Matching or Prototypical Network) serves as the base learner, and Meta-SGD acts as the meta-learner.
To enable the optimization meta-learner to update the metric learner, the authors employ a Support-Split Trick. Since metric learners require both support and query sets to calculate a loss, the task's support set is split into two halves during the inner training loop. One half serves as the temporary support set, and the other as the query set. This allows the calculation of a classification loss, which Meta-SGD uses to update the feature extractor's weights. The updated model is then evaluated on the actual task query set.
For 1-shot learning scenarios where splitting is not possible, the authors introduce a Multi-Source Training strategy. This involves using auxiliary data from related domains, selected via a "relatedness" score, to compute the necessary inner-loop gradients.
Experimental Results
The model was evaluated on several benchmarks, including MiniImagenet, Caltech-256, CIFAR-100, and CUB-200. A key focus was testing on flexible class numbers, where the model is trained on one number of classes (e.g., 5) and tested on another (e.g., 3).
As shown in the results, the Meta-Metric-Learner consistently outperformed standard Matching and Prototypical Networks, especially in mismatched train/test scenarios. For instance, in "5 vs. 3" and "3 vs. 5" tasks, the hybrid approach maintained a significant lead over non-adaptive baselines. Interestingly, the results revealed an asymmetry in task difficulty: training on 3 classes and testing on 5 is considerably harder than the reverse, with accuracy dropping by approximately 15% across all methods.
Conclusion
The Meta-Metric-Learner successfully bridges the gap between optimization and metric-based meta-learning. By replacing parametric classification heads with metric-based comparisons and wrapping the system in an optimization framework, the model achieves both architectural flexibility and task-specific adaptability. Future work will focus on end-to-end integration of auxiliary data for 1-shot learning and extending the framework to non-vision domains.
Summary updated