[Paper Review] AM-LFS: AutoML for Loss Function Search
AM-LFS proposes an AutoML framework that uses REINFORCE-based reinforcement learning to search for optimal loss functions during training, leveraging a unified search space encompassing popular loss functions. It dynamically optimizes loss function parameters via bilevel optimization, achieving state-of-the-art performance on image classification, face recognition, and person re-identification benchmarks without architectural changes.
Designing an effective loss function plays an important role in visual analysis. Most existing loss function designs rely on hand-crafted heuristics that require domain experts to explore the large design space, which is usually sub-optimal and time-consuming. In this paper, we propose AutoML for Loss Function Search (AM-LFS) which leverages REINFORCE to search loss functions during the training process. The key contribution of this work is the design of search space which can guarantee the generalization and transferability on different vision tasks by including a bunch of existing prevailing loss functions in a unified formulation. We also propose an efficient optimization framework which can dynamically optimize the parameters of loss function's distribution during training. Extensive experimental results on four benchmark datasets show that, without any tricks, our method outperforms existing hand-crafted loss functions in various computer vision tasks.
Motivation & Objective
- To address the limitations of hand-crafted loss functions, which are sub-optimal, time-consuming, and task-specific.
- To develop a generalizable and transferable loss function search space applicable across diverse vision tasks.
- To design an efficient bilevel optimization framework that jointly optimizes network and loss function parameters during training.
- To enable end-to-end training with dynamic loss function adaptation, improving model discrimination without retraining.
Proposed method
- The search space unifies existing loss functions (e.g., softmax, margin-based, focal loss) into a parameterized formulation that adjusts gradients based on example difficulty.
- Loss function parameters are modeled as a differentiable probability distribution, enabling gradient-based optimization via REINFORCE.
- A bilevel optimization framework is employed: the inner loop minimizes the sampled loss w.r.t. network weights, while the outer loop maximizes validation performance (e.g., accuracy, mAP) w.r.t. the loss distribution parameters.
- The method dynamically balances intra-class and inter-class distances by assigning examples to intervals based on difficulty, with parameters optimized per interval.
- The framework is trained end-to-end and does not require architectural modifications, enabling plug-and-play integration with existing models.
- Training stability is ensured by monitoring distribution parameter convergence, avoiding noisy reward tracking.
Experimental results
Research questions
- RQ1Can a unified, parameterized search space effectively represent diverse, state-of-the-art loss functions across multiple vision tasks?
- RQ2How can loss function search be formulated as a differentiable, reinforcement learning problem that enables dynamic optimization during training?
- RQ3Does the proposed bilevel optimization framework lead to better generalization and transferability compared to hand-crafted loss functions?
- RQ4What is the optimal configuration of search space hyperparameters (e.g., number of intervals, batch size) for performance and efficiency?
Key findings
- AM-LFS outperforms hand-crafted loss functions on CIFAR-10, MegaFace, Market-1501, and DukeMTMC-reID, achieving state-of-the-art results without architectural changes.
- On Market-1501, AM-LFS achieved 84.4% mAP with B=32, outperforming the baseline SphereReID model.
- On DukeMTMC-reID, AM-LFS reached 69.8% mAP with B=32, demonstrating strong transferability across datasets.
- The optimal number of intervals (M) was found to be 6, as M=3 led to poor performance due to insufficient granularity, while M=10 caused optimization instability.
- Gradient visualization showed that AM-LFS reduces gradients for easy examples (low intra-class distance) and focuses more on hard examples, enhancing inter-class discrimination.
- Convergence analysis confirmed stable training, as distribution parameters stabilized over epochs, indicating reliable optimization of the loss function distribution.
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.