NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A hybrid approach with optimization-based and metric-based meta-learner for few-shot learning

Duo Wang, Yu Cheng, Mo Yu, Xiaoxiao Guo, Tao Zhang

TL;DR

Standard few-shot learning (FSL) methods typically force tasks into a rigid structure where every task must have the exact same number of classes. This paper introduces the "Meta-Metric-Learner," a hybrid approach that combines the flexible, class-agnostic nature of metric-based models with the rapid adaptation capabilities of optimization-based meta-learning. By using an optimization meta-learner to dynamically update a metric-based base learner, the model easily handles tasks with varying numbers of classes while generating highly adaptable, task-specific distance metrics.

What Problem Does This Paper Address?

In few-shot learning, models are trained to recognize new classes using only a handful of examples. Historically, the field has been split into two camps, both of which have significant limitations in real-world scenarios:

  1. Optimization-based methods (e.g., MAML, Meta-SGD): These train a meta-learner to predict the weights of a task-specific classifier. However, they require the network architecture to be homogeneous across tasks. If Task A has 3 classes and Task B has 5 classes, the classifier's output layer changes size, breaking the meta-learner's ability to predict weights.
  2. Metric-based methods (e.g., Prototypical Networks, Matching Networks): These learn a shared embedding space and classify new examples based on distance (e.g., Euclidean or Cosine) to the support examples. Because they are non-parametric at the classification layer, they can handle varying class counts. However, they learn a single, task-invariant metric for all tasks, which fails to generalize if the tasks are highly diverse.

Real-world FSL is messy: class counts vary wildly, and data often comes from multiple, unrelated domains. The authors tackle the challenge of building a model that can handle flexible class numbers while still adapting its underlying metric space to fit the specific quirks of each new task.

Methods

The authors propose a hybrid architecture called the Meta-Metric-Learner. It uses a metric-based model (either a Matching Network or a Prototypical Network) as the "base learner," and an optimization-based model (Meta-SGD) as the "meta-learner."

Here is how they make the two paradigms play nicely together:

  • Single-Source Training (The Support-Split Trick): Standard optimization meta-learners update weights by calculating a gradient on a support set. But metric learners compare queries to supports—they need both to calculate a loss. To solve this, the authors split the task's support set into two halves during the inner training loop. One half acts as the support and the other as the query. This generates the classification loss needed for Meta-SGD to update the feature extractor's weights. The updated model is then evaluated on the actual query set.
  • Multi-Source Training (For 1-Shot Learning): The support-split trick requires at least 2 examples per class ($k \ge 2$). To handle 1-shot learning, the authors borrow auxiliary data from other domains (e.g., different alphabets in a character recognition task). They calculate a "relatedness" score to select the most relevant auxiliary tasks, and use those to compute the inner-loop gradients, effectively transferring cross-source knowledge to the target task.

Datasets

  • Single-Source Setting: MiniImagenet, Caltech-256, CIFAR-100, and CUB-200.
  • Multi-Source Setting: Omniglot (where each of the 50 alphabets is treated as a distinct data source).
  • Evaluation Shift: Unlike standard benchmarks that strictly evaluate on "$k$-shot, $N$-way" tasks, the authors explicitly test on flexible class numbers (e.g., meta-training on 5-class tasks and meta-testing on 3-class tasks, and vice versa).

Key Insights and Ideas

  • The Best of Both Worlds: By stripping the parametric classification head off a standard neural network and replacing it with a metric-based comparison, the architecture becomes immune to changing class counts. Wrapping this in Meta-SGD allows the network to still benefit from rapid, gradient-based weight initialization and adaptation.
  • Task-Specific Metrics Matter: A universal distance metric is a bottleneck. By dynamically updating the feature extractor's weights for each specific task via Meta-SGD, the model warps the embedding space so that the specific classes in the current task are maximally separable.
  • Guarding Against Negative Transfer: In the multi-source 1-shot setting, blindly pulling in auxiliary data can hurt performance if the domains are unrelated. Filtering auxiliary sources by a task-level transferability score ensures the meta-learner only learns from helpful, adjacent domains.

Key Results

  • Superiority in Flexible Settings: In mismatched train/test scenarios (e.g., train on 5 classes, test on 3 classes), the Meta-Metric-Learner consistently outperformed standard Matching Networks, Prototypical Networks, and basic fine-tuning baselines across all four single-source datasets.
  • The Asymmetry of Task Difficulty: The authors found that training on 3 classes and testing on 5 classes is significantly harder than the reverse. Accuracy dropped by roughly 15% across the board in the 3-vs-5 setting compared to the 5-vs-3 setting, though the proposed hybrid method still maintained the lead.
  • Multi-Source 1-Shot Success: On Omniglot 1-shot tasks, using auxiliary alphabets to compute the gradient updates allowed the Meta Matching Network to achieve 85.43% accuracy, beating the baseline Matching Network (84.92%).
  • Faster Convergence: Training curves show that the hybrid models generally converge faster and reach higher test accuracies with fewer training iterations compared to the baselines.

Limitations and Future Work

  • The 1-Shot Limitation in Single-Source: Because the method requires splitting the support set to compute inner-loop gradients, it cannot natively handle 1-shot learning without relying on the multi-source auxiliary data workaround.
  • Two-Stage Multi-Source Pipeline: Currently, finding related auxiliary tasks in the multi-source setting is a separate, pre-processing step.
  • Future Directions: The authors suggest developing an end-to-end framework that natively integrates the auxiliary data retrieval. They also plan to explore more advanced optimization meta-learners (like probabilistic MAML or LEO) and apply the framework to non-vision domains like language modeling and attribute classification.

Summary updated

BibTeX
@inproceedings{wang2019hybrid,
  author = {Duo Wang and Yu Cheng and Mo Yu and Xiaoxiao Guo and Tao Zhang},
  title = {{A hybrid approach with optimization-based and metric-based meta-learner for few-shot learning}},
  booktitle = {Neurocomputing},
  year = {2019},
  url = {https://openreview.net/forum?id=eyW96xdqMrJ},
}

Loading related content...

Figure