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

Meta-Learning with Task-Adaptive Loss Function for Few-Shot Learning

Sungyong Baik, Janghoon Choi, Heewon Kim, Dohee Cho, Jaesik Min, Kyoung Mu LeeICCV 2021

Abstract

In few-shot learning scenarios, the challenge is to generalize and perform well on new unseen examples when only very few labeled examples are available for each task. Model-agnostic meta-learning (MAML) has gained the popularity as one of the representative few-shot learning methods for its flexibility and applicability to diverse problems. However, MAML and its variants often resort to a simple loss function without any auxiliary loss function or regularization terms that can help achieve better generalization. The problem lies in that each application and task may require different auxiliary loss function, especially when tasks are diverse and distinct. Instead of attempting to hand-design an auxiliary loss function for each application and task, we introduce a new meta-learning framework with a loss function that adapts to each task. Our proposed framework, named Meta-Learning with Task-Adaptive Loss Function (MeTAL), demonstrates the effectiveness and the flexibility across various domains, such as few-shot classification and few-shot regression.

Introduction

Few-shot learning (FSL) requires models to acquire new concepts from a minimal number of labeled examples. A prominent approach is Model-Agnostic Meta-Learning (MAML), which optimizes for a weight initialization that can be quickly adapted to new tasks via a few gradient descent steps. Despite its success, MAML typically relies on a fixed, hand-designed loss function (e.g., cross-entropy) for task adaptation. This "one-size-fits-all" approach is often suboptimal, as different tasks may benefit from specific regularization or auxiliary signals to mitigate overfitting on small support sets.

The MeTAL Framework

To address the limitations of fixed loss functions, we propose MeTAL, a framework that meta-learns a task-specific loss function. Unlike standard MAML, which uses a static objective, MeTAL dynamically adjusts the loss landscape based on the current state of the optimization process.

Comparison between MAML and MeTAL architectures.

MeTAL introduces two primary components:

  1. Task State ($\tau$): A representation of the model's current status during inner-loop optimization, including the current loss value, weight statistics, and prediction means.
  2. Meta-Networks ($g_\psi$ and $L_\phi$): A learned loss function $L_\phi$ (parameterized by an MLP) is modulated by an adapter network $g_\psi$. The adapter takes the Task State $\tau$ and generates parameters ($\gamma, \beta$) to perform an affine transformation on the loss function's weights: $\phi' = \gamma\phi + \beta$.

This architecture allows the loss function to evolve its behavior as the model adapts to a specific task, effectively "learning how to evaluate" progress. Furthermore, MeTAL's flexible design enables semi-supervised learning; by including model predictions on unlabeled query examples in the Task State, the learned loss function can perform transductive learning to guide adaptation.

Experimental Results

We evaluated MeTAL across several benchmarks to demonstrate its versatility:

  • Few-Shot Classification: On miniImageNet (5-way 5-shot), MeTAL combined with the ALFA variant achieved an accuracy of 81.43%, significantly outperforming standard MAML (~70%).
  • Cross-Domain Generalization: When trained on miniImageNet and tested on the CUB dataset, MeTAL improved MAML's performance by approximately 8%, highlighting its robustness to domain shifts.
  • Visual Tracking: Integration into the MetaCREST tracker improved precision and success rates on the OTB2015 dataset, showing scalability to complex vision tasks.

Analysis of Task-Adaptive Loss

The learned loss function acts as a dynamic regularizer. By examining the generated $\gamma$ and $\beta$ parameters across inner-loop steps, we observe that MeTAL learns to prioritize different information at different stages of adaptation.

Generated $\gamma$ and $\beta$ values for the first layer across five inner-loop steps.

As shown in the figure above, the parameters of the loss function are not static; they fluctuate significantly across update steps. This confirms that the meta-learner is actively reshaping the loss landscape to guide the base learner toward better generalization.

Conclusion

MeTAL demonstrates that the objective function is a critical pillar of meta-learning, alongside initialization and update rules. By replacing fixed loss functions with task-adaptive ones, MeTAL provides a flexible and powerful framework for few-shot learning that generalizes across diverse domains and tasks.

Summary updated

BibTeX
@inproceedings{baik2021meta,
  author = {Sungyong Baik and Janghoon Choi and Heewon Kim and Dohee Cho and Jaesik Min and Kyoung Mu Lee},
  title = {{Meta-Learning with Task-Adaptive Loss Function for Few-Shot Learning}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  url = {https://openreview.net/forum?id=2xz3ijFrIB},
}
Figure