Meta-Learning Adaptive Loss Functions

Christian Raymond, Qi Chen, Bing Xue, Mengjie Zhang

Abstract

Loss function learning is a new meta-learning paradigm that aims to automate the essential task of designing a loss function for a machine learning model. Existing techniques for loss function learning have shown promising results, often improving a model's training dynamics and final inference performance. However, a significant limitation of these techniques is that the loss functions are meta-learned in an offline fashion, where the meta-objective only considers the very first few steps of training, which is a significantly shorter time horizon than the one typically used for training deep neural networks. This causes significant bias towards loss functions that perform well at the very start of training but perform poorly at the end of training. To address this issue we propose a new loss function learning technique for adaptively updating the loss function online after each update to the base model parameters. The experimental results show that our proposed method consistently outperforms the cross-entropy loss and offline loss function learning techniques on a diverse range of neural network architectures and datasets.

Introduction

In deep learning, the standard approach relies on handcrafted loss functions such as Cross-Entropy or Mean Squared Error. While effective, these fixed functions are not necessarily optimal for every stage of a model's training trajectory. The emerging field of Loss Function Learning (LFL) seeks to automate this design process. However, current LFL methods are primarily offline, optimizing for a short initial horizon. This leads to a "short-horizon bias," where the learned loss is effective at the start of training but fails to support the model as it nears convergence. This paper introduces Adaptive Loss Function Learning (AdaLFL), which treats the loss function as a dynamic target that evolves alongside the model.

Methodology: Adaptive Loss Function Learning (AdaLFL)

AdaLFL frames loss function learning as a non-stationary bi-level optimization problem. The process consists of two interleaved loops:

  1. Inner Loop: The base model (e.g., a ResNet) updates its parameters by minimizing the current learned loss function.
  2. Outer Loop: The meta-parameters (weights of the neural network-based loss function) are updated via one-step unrolled differentiation. This update adjusts the loss function based on the base model's subsequent performance on a validation set.

To ensure stability and expressiveness, the authors introduced Smooth Leaky ReLU activations to prevent vanishing gradients in the learned loss. Additionally, a Hybrid Initialization strategy uses a brief offline pre-training phase to provide a stable starting point for the online adaptation.

Experimental Setup

The researchers evaluated AdaLFL across a diverse suite of benchmarks and architectures:

  • Regression: Communities and Crime, Diabetes, and California Housing datasets.
  • Classification: MNIST, CIFAR-10, CIFAR-100, and SVHN.
  • Architectures: Models ranged from simple MLPs and Logistic Regression to complex deep networks like VGG-16, ResNet-18, SqueezeNet, and WideResNet.

Results and Emergent Behavior

AdaLFL consistently outperformed both handcrafted losses and state-of-the-art offline LFL methods like ML³ across nearly all datasets. Beyond raw performance, the method demonstrated faster convergence and robustness to meta-learning rates.

A key finding is the emergent behavior of the adaptive loss functions. As training progresses, the loss functions implicitly discover established deep learning heuristics:

  • Implicit Learning Rate Scheduling: The scale of the learned loss changes over time, effectively modulating the gradient magnitude.
  • Implicit Early Stopping: Loss functions often flatten or become parabolic near convergence, penalizing aggressive updates and acting as a regularizer.
  • Implicit Label Smoothing: In classification, the loss may increase as confidence approaches 1.0, preventing overconfidence and improving generalization.
Evolution of learned loss functions for classification tasks over 10,000 training steps. The curves adapt online, exhibiting behaviors like implicit label smoothing and learning rate scheduling.

Discussion and Limitations

While AdaLFL offers significant performance gains, it introduces higher computational costs, being approximately 3-5x slower than standard training due to unrolled differentiation. Memory usage is also increased by the need to track optimization trajectories. Future work may address these overheads through periodic meta-updates or explore joint optimization of loss functions and network architectures. Despite these challenges, AdaLFL represents a significant step toward fully automated and adaptive machine learning pipelines.

Summary updated

BibTeX
@article{raymond2025meta,
  author = {Christian Raymond and Qi Chen and Bing XUE and Mengjie Zhang},
  title = {{Meta-Learning Adaptive Loss Functions}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=o0ODnN0xz8},
}
Figure