End-to-End Learning for Stochastic Optimization: A Bayesian Perspective

Yves Rychener, Daniel Kuhn, Tobias Sutter

Introduction

In stochastic optimization, decision-makers often face the challenge of minimizing a loss that depends on uncertain future variables—such as determining electricity generation levels based on unpredictable wind speeds. The traditional approach to this problem is a two-step predict-then-optimize pipeline: a machine learning model predicts the uncertain variable, and an optimization solver uses that prediction to make a decision.

However, this method suffers from a critical flaw: the prediction model is typically agnostic to the downstream optimization task. For instance, minimizing Mean Squared Error (MSE) treats a 5% overestimation identically to a 5% underestimation. In reality, underestimating wind power might lead to a severe blackout penalty, while overestimating merely incurs a minor surplus cost.

End-to-End (E2E) learning addresses this by training neural networks to map observations directly to decisions, using the actual task loss as the training signal. While empirically successful, the statistical foundations of E2E learning—and its relationship to classical frameworks like Bayesian estimation or Robust Optimization—have remained largely unexplored. This paper bridges that gap, proving that standard E2E learning algorithms effectively train a "posterior Bayes action map," and introduces novel E2E algorithms for Empirical Risk Minimization (ERM) and Distributionally Robust Optimization (DRO).

The authors provide a principled framework for E2E learning, grounded in three primary contributions:

  1. E2E as Bayesian Estimation: The most significant theoretical insight is that standard E2E training (using Stochastic Gradient Descent on the task loss) converges to a decision map that minimizes the Bayesian posterior loss. In this paradigm, the training dataset acts as a prior that regularizes the model, naturally combating the "Optimizer's Curse"—a phenomenon where standard ERM overfits to training artifacts.
  2. New Training Schemes: Building on this foundation, the authors propose two new algorithms:
  3. E2E-ERM: Trains the network to output decisions that solve Empirical Risk Minimization for each observation.
  4. E2E-DRO: Trains the network to be distributionally robust, accounting for uncertainty in the data distribution itself by optimizing against an "ambiguity set."
  5. Architectural Analysis: The study compares three neural network architectures for these tasks: standard Multi-Layer Perceptrons (MLPs), Constraint-Aware Layers (CAL) that use specific activations (like Sigmoids) to ensure feasible decisions, and Optimization Layers (OPL) that embed an actual optimization problem within the network.

Experimental Validation

The proposed methods were evaluated on two distinct problems:

  • Synthetic Newsvendor Problem: A classic inventory management task with Dirichlet-distributed demand. This allowed for a direct comparison between E2E neural network outputs and exact, ground-truth mathematical solutions.
  • Economic Dispatch: A real-world power grid management problem utilizing a Kaggle dataset of historical wind power production and weather records (temperature, wind speed, and direction at 10, 30, and 60-minute intervals).

Key Findings

  • Performance Parity: In the Newsvendor task, the neural network-based implementations of Bayesian, ERM, and DRO approaches achieved near-perfect parity with their computationally expensive, exact optimization counterparts.
  • Task-Awareness Outperforms Baselines: In the Economic Dispatch problem, the E2E-CAL approach significantly outperformed the traditional predict-then-optimize (MLE) baseline. The MLE approach incurred much higher costs because its symmetric MSE loss ignored the massive asymmetric penalties associated with unmet electricity demand.
  • Robustness to Frequency: When data frequency dropped from 10 to 30 minutes, the E2E models remained competitive, whereas simple "lag-1" baselines (using the last observed value) failed as the environment became less stationary.
  • The Gradient Projection Pitfall: The authors identified a critical cautionary finding for practitioners using Optimization Layers (OPL). If a network with an OPL is initialized outside the feasible region, gradients can become perpendicular to the path toward the optimum. This causes the training process to circle the feasible set indefinitely without entering it, highlighting a major challenge in training differentiable optimization layers.

Limitations and Future Work

While the paper establishes a robust theoretical foundation, several limitations remain. The theoretical guarantee for the DRO algorithm requires the inner maximization problem to have a unique solution, currently excluding popular Wasserstein ambiguity sets. Additionally, while Optimization Layers offer high interpretability, the gradient projection issue necessitates future research into better initialization or projection strategies. Finally, as this work focuses on static, one-shot decisions, extending this Bayesian perspective to dynamic settings—such as Reinforcement Learning, where current actions influence future states—represents a promising avenue for future research.

Summary updated

BibTeX
@inproceedings{rychener2023end,
  author = {Yves Rychener and Daniel Kuhn and Tobias Sutter},
  title = {{End-to-End Learning for Stochastic Optimization: A Bayesian Perspective}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=DxONRbe1RxK},
}
Figure