[Paper Review] Learning Effective Loss Functions Efficiently
This paper proposes LearnLoss, an anytime algorithm that efficiently learns optimal linear loss functions by leveraging gradient information from validation error, enabling fast hyperparameter tuning and online regularizer adaptation. It achieves state-of-the-art speed—orders of magnitude faster than prior methods—while maintaining asymptotic optimality and improving generalization in practice.
We consider the problem of learning a loss function which, when minimized over a training dataset, yields a model that approximately minimizes a validation error metric. Though learning an optimal loss function is NP-hard, we present an anytime algorithm that is asymptotically optimal in the worst case, and is provably efficient in an idealized "easy" case. Experimentally, we show that this algorithm can be used to tune loss function hyperparameters orders of magnitude faster than state-of-the-art alternatives. We also show that our algorithm can be used to learn novel and effective loss functions on-the-fly during training.
Motivation & Objective
- To address the challenge of selecting a loss function that minimizes a non-differentiable or loosely related validation metric, rather than just the training loss.
- To develop an efficient, anytime algorithm that can learn effective loss functions with provable guarantees, even when the underlying problem is NP-hard.
- To enable online learning of regularizers during training to prevent overfitting, especially in scenarios with high-dimensional hyperparameter spaces.
- To outperform existing hyperparameter tuning methods in speed and effectiveness, particularly in settings with many loss function hyperparameters.
Proposed method
- Formulates the loss function learning problem as a bilevel optimization: minimize the validation error of the model obtained by minimizing a linear combination of features derived from model parameters.
- Represents the loss function as a linear function of a feature vector φ(θ), where ℓλ(θ) = λ · φ(θ), with λ ∈ ℛᵏ being learnable hyperparameters.
- Uses convex programming to solve the learning problem, incorporating gradient information of the validation error ∇ẽ(θ) to accelerate convergence.
- Employs an anytime algorithm that progressively improves the loss function estimate, with theoretical guarantees of asymptotic optimality in the worst case.
- Applies the method in two settings: (1) offline hyperparameter tuning via model training on small data subsets, and (2) online adaptation during training using warm-started optimization.
- Leverages differentiable proxies for non-differentiable metrics (e.g., top-1 accuracy) to enable gradient-based optimization of the loss function.
Experimental results
Research questions
- RQ1Can an efficient, anytime algorithm be designed to learn a linear loss function that minimizes a validation error metric, even when the metric is non-differentiable?
- RQ2How can gradient information from the validation error be effectively used to accelerate the search for optimal loss function hyperparameters?
- RQ3Can the proposed method learn effective regularizers on-the-fly during training, improving generalization without prior hyperparameter tuning?
- RQ4How does the performance of the algorithm compare to state-of-the-art hyperparameter tuning methods in terms of speed and final model accuracy?
- RQ5To what extent can the method scale to loss functions with hundreds of hyperparameters, especially in online training scenarios?
Key findings
- The LearnLoss algorithm achieves orders-of-magnitude faster hyperparameter tuning compared to state-of-the-art alternatives, significantly outpacing traditional methods in search efficiency.
- On the colorectal_histology dataset, LearnLoss enabled AdaGrad to continue improving validation and test log loss for up to 1000 epochs, while standard AdaGrad overfit after ~35 epochs.
- The learned regularizer evolved over time, with stronger regularization applied later in training, demonstrating adaptive, data-driven regularization.
- The method achieved better test log loss and probability calibration than the best combination of standard regularizers (L1, L2, label smoothing, dropout), even without improving top-1 accuracy.
- The algorithm successfully learned novel, effective regularizers in real time during training, preventing overfitting and improving generalization in all evaluated datasets.
- Theoretical analysis confirms that LearnLoss is asymptotically optimal in the worst case and provably efficient in an idealized 'easy' case, with strong practical performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.