Smart "Predict, then Optimize"

Adam N. Elmachtoub, Paul Grigas · DOI

Abstract

Traditional machine learning models focus on minimizing prediction error, such as Mean Squared Error or cross-entropy. However, in many practical applications, these predictions serve as inputs to downstream optimization problems. This paper introduces the Smart “Predict, then Optimize” (SPO) framework, which shifts the training objective from minimizing prediction error to minimizing the cost of the resulting decisions. By leveraging the structure of the optimization problem, the authors develop a convex surrogate loss function, SPO+, which is computationally tractable and theoretically grounded. Experimental results demonstrate that SPO-based models significantly outperform standard approaches, particularly when the underlying model is misspecified.

Introduction

In the standard analytics pipeline, machine learning (ML) and optimization are treated as decoupled stages: first, a model predicts unknown parameters (e.g., travel times, asset returns), and second, an optimization solver uses these predictions to make a decision (e.g., finding the shortest path, selecting a portfolio). This "predict-then-optimize" approach often fails because standard ML loss functions are "decision-blind." They treat all prediction errors of the same magnitude equally, regardless of their impact on the final decision.

For instance, in a routing problem, a 10% error in predicting the travel time of a major highway may drastically alter the optimal route, whereas a 10% error on a minor side street might have no impact at all. The SPO framework addresses this by integrating the optimization task directly into the training process, ensuring that the model learns to prioritize errors that matter most for decision-making.

The SPO Framework and SPO+ Loss

The SPO Loss Function

The core contribution of this work is the SPO loss, which measures the "suboptimality gap." Formally, it is the difference between the cost of the decision made using predicted parameters and the cost of the decision that would have been made with perfect information (the ground truth). While this is the ideal metric for decision-making, it is mathematically challenging to optimize directly because it is typically non-convex and discontinuous.

The SPO+ Surrogate

To overcome the computational hurdles of the raw SPO loss, the authors utilize duality theory to derive a convex surrogate called SPO+. This surrogate loss function provides several key advantages:

  1. Tractability: It can be optimized using standard first-order methods like Stochastic Gradient Descent (SGD).
  2. Fisher Consistency: The authors prove that, under mild conditions, minimizing the SPO+ loss is statistically equivalent to minimizing the true SPO loss as the sample size grows.
  3. Optimization Oracle: During training, the SPO+ loss requires an "optimization oracle"—a solver that can provide the optimal solution for the current predicted parameters. This allows the model to "feel" the constraints and geometry of the decision space during the learning process.

Experimental Evaluation

The framework was evaluated using synthetic datasets designed to simulate complex decision environments under model misspecification:

  • Shortest Path Problem: Navigating a $5 \times 5$ grid network where edge costs are influenced by external features.
  • Portfolio Optimization: A Markowitz-style model with 50 assets, aiming to maximize returns while adhering to risk constraints.

To test the robustness of the framework, the authors used a polynomial generative process to create non-linear relationships between features and costs. They then trained simple linear models using SPO+ to see if they could outperform standard regression techniques (Least Squares and $L_1$ loss) that were also restricted to linear forms.

Key Insights and Results

Resilience to Misspecification

The experiments revealed that as the degree of non-linearity (misspecification) in the data increased, SPO+ significantly outperformed Least Squares (LS). While LS models attempted to fit the global average of the data—often resulting in poor decisions—the SPO+ models focused on the decision boundaries. By making "smart" errors that didn't change the optimal decision, SPO+ maintained high performance even when the model architecture was too simple for the underlying data.

Comparison with Complex Models

Remarkably, a simple linear model trained with the SPO+ loss often outperformed more complex, state-of-the-art algorithms like Random Forests, particularly in regimes with limited training data. This suggests that incorporating the structure of the downstream problem can be more effective than increasing model complexity.

Computational Feasibility

For problems with polyhedral constraints (such as linear programming), the authors demonstrated that the SPO+ training problem can be reformulated as a large-scale linear or quadratic program. This allows the framework to scale effectively using commercial solvers like Gurobi.

Conclusion and Future Directions

The Smart "Predict, then Optimize" framework represents a significant step toward truly decision-aware machine learning. By aligning the training objective with the ultimate goal of the analytics pipeline, SPO+ produces models that are more robust and effective in real-world applications.

Currently, the framework is best suited for optimization problems where predicted parameters appear linearly in the objective function and constraints are known. Future research directions include extending SPO to handle non-linear objectives, uncertain constraints, and more complex model architectures such as deep neural networks.

Reference: Elmachtoub, A. N., & Grigas, P. (2020). Smart “Predict, then Optimize”. Management Science, 68(1), 9-26.

Summary updated

BibTeX
@article{elmachtoub2017smart,
  author = {Adam N. Elmachtoub and Paul Grigas},
  title = {{Smart "Predict, then Optimize"}},
  journal = {Manag. Sci.},
  year = {2017},
  doi = {10.1287/mnsc.2020.3922},
}
Figure