Automatic Loss Function Search for Predict-Then-Optimize Problems with Strong Ranking Property

Boshi Wang, Jialin Yi, Hang Dong, Bo Qiao, Chuan Luo, Qingwei LinICLR 2022

Introduction: The Misalignment Challenge

In many real-world applications, decision-making is shifting from reactive to proactive. This often involves a Predict-Then-Optimize (PTO) paradigm: machine learning models first predict unknown parameters (e.g., travel times on a map, future stock prices), and these predictions are subsequently fed into a combinatorial optimization algorithm (e.g., finding the shortest path, maximizing portfolio returns).

The core challenge in PTO systems is misalignment. A predictive model might achieve a very low standard regression error (like mean squared error or $l_2$ loss) but still lead to terrible downstream decisions because it failed to capture the relative importance or ranking of the variables. While specialized metrics like the "Smart Predict-then-Optimize" (SPO) loss directly measure decision quality, they are typically piecewise constant. This means their gradients are zero almost everywhere, making them impossible to optimize directly using standard gradient descent. Existing workarounds often require domain experts to manually design problem-specific surrogate losses.

To address this, researchers have introduced APOC (Automatic Prediction and Optimization Connector), an automated framework that searches for the ideal differentiable loss function by focusing on the "Strong Ranking Property."

The APOC Framework

The APOC framework automates the discovery of effective surrogate losses, removing the need for manual, expert-driven loss design for every new optimization problem.

The APOC framework architecture

Addressing Misalignment with ATGP Loss

The authors identified that for many combinatorial problems, the optimal solution depends heavily on the "total group preorder" of the parameters. Essentially, if a model preserves the correct ranking of sums of specific groups of parameters, the final optimal decision remains unchanged, regardless of the exact predicted numerical values.

Based on this, they introduce the Approximate Total Group Preorder (ATGP) loss. The discrete Total Group Preorder (TGP) loss is relaxed into the continuous ATGP loss using a differentiable tanh approximation of a sign function. This creates a smooth bridge that allows gradient-based neural networks to "see" and optimize for the downstream decision goal, penalizing instances where the predicted ranking of parameter groups differs from the true ranking.

Comparison of loss landscapes: SPO vs. l2, TGP, and ATGP

Automated Search via Reinforcement Learning

To avoid an exponentially large search space when comparing all possible parameter groups, APOC parameterizes the loss using Derivative-of-Gaussian (DoG) filters. These act as sliding windows capturing weighted group-wise comparisons.

APOC then employs a Reinforcement Learning (RL) search loop—utilizing algorithms like REINFORCE or PPO2—to automatically tune the parameters of these DoG filters. By treating the negative SPO loss on a validation set as a reward, the RL agent effectively "learns how to learn" the specific optimization problem.

Experimental Setup and Key Results

The authors evaluated APOC on three distinct combinatorial structures using real-world datasets:

  1. Energy Cost-Aware Scheduling: Formulated as a top-$k$ ranking problem using two years of Irish electricity market data to schedule machine tasks.
  2. Knapsack (Portfolio Optimization): Using historical S&P 500 stock data to select a portfolio maximizing returns under a budget constraint.
  3. Shortest Path: Using a Twitter ego network to find the shortest path between nodes based on predicted edge weights.

Across all tasks, APOC significantly outperformed traditional baselines (like $l_2$ distance) and established PTO methods (such as SPO+, QPTL, and IntOpt):

  • Shortest Path: This task showcased the most dramatic improvement. APOC achieved an SPO loss of 63.87, vastly outperforming the standard $l_2$ baseline (223) and even the specialized SPO+ method (138).
  • Energy Scheduling: APOC-REINFORCE achieved the lowest SPO loss across top-5, top-15, and top-25 settings, beating the next best method (SPO+) by roughly 10-15%.
  • Knapsack: APOC-PPO2 achieved the best performance with a loss of 24.93, compared to the $l_2$ baseline of 26.57.

Key Insights and Limitations

The fundamental insight of APOC is that Ranking > Regression in discrete optimization. A model predicting values of 10 and 20 when the ground truth is 1 and 2 has a massive regression error, but is "perfect" for a ranking-based solver. Furthermore, the paper theoretically proves that the ATGP loss is more robust to noise in training data than the standard $l_2$ loss in linear regression settings.

Limitations: While highly effective, the framework is specifically tailored for problems exhibiting the "Strong Ranking Property." It may not generalize to all continuous or non-ranking optimization types. Additionally, using Reinforcement Learning for the outer search loop is computationally expensive, as it requires retraining the prediction model multiple times per iteration. Future work will likely focus on extending APOC to non-linear settings and improving the efficiency of the search phase.

Summary updated

BibTeX
@inproceedings{wang2022automatic,
  author = {Boshi Wang and Jialin Yi and Hang Dong and Bo Qiao and Chuan Luo and Qingwei Lin},
  title = {{Automatic Loss Function Search for Predict-Then-Optimize Problems with Strong Ranking Property}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=hSktDu-h94},
}
Figure