In machine learning, the metrics we ultimately care about—such as F1 score, Average Precision (AP), or BLEU—are notoriously difficult to optimize directly. Because they are typically non-differentiable and non-decomposable, standard gradient descent cannot be applied.
To bridge this gap, practitioners rely on "proxy" losses like Cross-Entropy (CE) or Mean Squared Error (MSE). However, minimizing these proxy losses does not always translate to maximizing the target metric. Previous attempts at "Surrogate Loss Learning" tried to solve this by training a neural network to mimic the exact value of the target metric (a regression approach).
A new framework called ReLoss (Relational Surrogate Loss) challenges this paradigm. The authors argue that exact metric recovery is an unnecessary bottleneck. A loss function doesn't need to know that a BLEU score is exactly 32.5; it merely needs to know that Model A's prediction is better than Model B's. By focusing on the relative performance of models, ReLoss achieves state-of-the-art results across various domains with significantly less computational overhead.
The ReLoss Methodology
The core innovation of ReLoss is shifting the learning objective from exact value approximation (L2 distance) to Spearman’s rank correlation.
The ReLoss pipeline operates on a few key principles:
- Correlation-based Optimization: The surrogate loss is trained to ensure that if the evaluation metric ranks one prediction higher than another, the loss value reflects that exact same ranking.
- Differentiable Ranking: Because standard ranking is a discrete, non-differentiable operation, the authors employ a differentiable sorting and ranking algorithm. This allows gradients to flow through the ranking process during training.
- Gradient Penalty: To guarantee that the learned loss remains smooth and stable for training downstream models, a Lipschitz constraint (gradient penalty) is applied, preventing exploding or vanishing gradients.
- Two-Phase Pipeline: ReLoss is first learned using a mix of randomly generated data and outputs from intermediate model checkpoints. Once trained, this ReLoss is frozen and deployed as a standard loss function to train the actual task model.
Key Insights and Performance Gains
By relaxing the requirement from "predict the exact value" to "predict the correct rank," the optimization landscape becomes significantly easier for the neural network to navigate. This leads to several major advantages:
- High Fidelity to Metrics: Standard proxy losses often correlate poorly with true metrics. For instance, in Human Pose Estimation, standard MSE loss has only a 46.7% correlation with the actual metric (PCK). ReLoss dramatically boosts this correlation to 86.0%.
- Efficiency: Unlike previous bilevel optimization methods that required alternating training between the loss and the model, ReLoss is trained just once. It then acts like a "vanilla" loss function, costing only about 0.5 GPU hours to learn.
- Transferability: A ReLoss function learned on ImageNet can be successfully applied to CIFAR datasets without retraining. This suggests that the "relational" nature of the loss captures fundamental mathematical properties of the metric itself, rather than just overfitting to the data distribution.
Benchmark Results
The authors rigorously tested ReLoss across a massive variety of benchmarks, proving its generalizability:
- Human Pose Estimation (Computer Vision): On the COCO test-dev set, ReLoss outperformed the state-of-the-art "DARK" method by 0.2% AP.
- Machine Reading Comprehension (NLP): On the DuReader 2.0 test set, ReLoss achieved a ROUGE-L score of 64.9, which is 7.5% higher than human performance (57.4).
- Image Classification: ReLoss consistently improved Top-1 accuracy on CIFAR and ImageNet compared to standard Cross-Entropy. For example, a ResNet-56 trained on CIFAR-100 improved from 73.61% to 74.15%.
- Neural Machine Translation: ReLoss improved BLEU scores on non-autoregressive translation tasks (WMT16 RO-EN) by up to 0.83 points.
Limitations and Future Directions
While highly effective, ReLoss does have limitations. The authors note the "Prior Problem": ReLoss works best when combined with a standard proxy loss (like Cross-Entropy) during the early stages of training. Without this "decent prior," the model can struggle to converge initially because the surrogate loss might fall into local minima. Additionally, performance is somewhat sensitive to the choice of the differentiable ranking algorithm used in the architecture.
Future work will likely focus on designing even more robust surrogate losses that can guide a model from scratch without requiring any task-specific "regular" loss as a crutch.
Based on the ICLR 2022 paper "Relational Surrogate Loss Learning" by Huang et al.
Summary updated