TL;DR
When routing a delivery truck, you don't actually care about predicting the exact travel time of every road in the city—you just want to find the fastest route. Decision-focused learning (DFL) trains models directly for this downstream optimization goal, rather than raw prediction accuracy, but it traditionally assumes you get to see the ground-truth costs of every road afterward, even the ones you didn't drive on. This paper introduces BayesianSPO, the first framework to make DFL work in an online, real-world setting where you learn on the fly and only observe outcomes for the choices you actually make, avoiding a nasty mathematical feedback loop along the way.
What Problem Does This Paper Address?
Many real-world systems follow a "predict-then-optimize" pipeline: observe some context (like weather and traffic), predict unknown costs (road travel times), and run a combinatorial solver to pick an optimal action (the shortest path). Standard machine learning minimizes prediction error across all roads equally. DFL improves on this by training the predictor end-to-end to minimize decision regret—focusing the model's capacity on errors that actually flip the solver's final decision.
However, standard DFL relies on two cozy assumptions: offline batch training and full feedback (knowing what would have happened on roads not taken). In reality, dispatchers operate online and receive semi-bandit feedback—you only see travel times for the roads you just drove down, while the rest remain question marks.
Unfortunately, standard DFL surrogate losses (like SPO+) require a complete cost vector to run counterfactual solver calls and compute a gradient. If you naively fill in the missing costs using your model's own predictions, you trigger imputation degeneracy: bad guesses on unobserved roads can flip the counterfactual optimal route, feeding a biased gradient back into your model that reinforces the exact prediction errors that caused the bad guesses in the first place.
Methods
To break this self-confirming loop while balancing exploration and exploitation, the authors propose BayesianSPO. It builds on standard Neural-Linear Bandit architectures (a shared feature extractor paired with per-component Bayesian linear regression heads) and standard Upper Confidence Bound (UCB) exploration, but rewires how the system learns:
- Decoupled Analytical Heads: Each selectable component (or "arm," like an individual road) gets a Bayesian linear head updated analytically using only true, observed costs. These heads supply cost predictions, uncertainty estimates ($\sigma_i$) for UCB exploration, and stable imputations to fill in missing costs for the solver.
- Decision-Focused Shared Representation: Instead of training the underlying feature extractor for prediction accuracy, it is trained using the SPO+ decision loss computed on completed cost vectors (observed costs + posterior imputations).
- Gradient Masking: Here is the crucial circuit-breaker. Even though imputed costs go into the solver to calculate the SPO+ gradient, the authors zero out the gradient entries for all unobserved arms before backpropagating into the shared feature extractor. Imputed values help frame the optimization context, but cannot directly corrupt the representation weights.
Datasets
The authors convert offline optimization tasks into sequential online semi-bandit problems across six benchmarks:
- Synthetic Benchmarks (from PyEPO): 10,000-round online adaptations of Knapsack ($n=32$ and $n=100$ items), Shortest Path ($8\times 8$ and $20\times 20$ grids), and a modified binary cardinality-constrained Portfolio Optimization ($n=32$ assets, pick $k=5$) designed so semi-bandit feedback is cleanly defined.
- Real-World Energy Scheduling: An online adaptation of an industrial scheduling benchmark using 789 days of historical Irish SEMO electricity market data (394 days for setup/tuning, 395 days of online evaluation), scheduling 20 tasks across 5 machines.
- Controlled Diagnostic: A synthetic 4-arm task where 2 input features dictate the optimal decision and 3 "nuisance" features shift costs without changing the optimal choice.
Key Insights and Ideas
- Self-imputation + optimization = echo chamber: In prediction tasks, ignoring unobserved arms is easy. In DFL, the optimizer couples all arms together. Guessing missing values with your own model lets hallucinations dictate counterfactual decisions, creating a toxic feedback loop unless you decouple imputation from gradient updates.
- Exploration naturally polices imputation error: A neat theoretical insight (Theorem 1) shows why you don't need to endlessly explore every irrelevant arm to get good SPO+ training signals. Because UCB prefers uncertain arms, if an unobserved arm is actually competitive ("contested") with a chosen arm, its uncertainty can be at most twice the uncertainty of the arm you did pick and observe. Observing chosen arms implicitly bounds the imputation error on the unchosen alternatives that matter!
- Ignoring nuisance noise under partial feedback: On the 4-arm diagnostic, prediction-focused models waste representation capacity tracking nuisance features just to nail exact cost numbers. Even seeing only half the arms per round, BayesianSPO allocates 56% of its feature weight norm to decision-critical inputs, compared to just 36% for its MSE-trained twin.
Key Results
Across all six benchmarks, BayesianSPO achieves the lowest mean cumulative regret, outperforming standard linear/neural bandits (LinUCB, Thompson Sampling, NeuralUCB) and BayesianMSE (an identical architecture trained with masked prediction error instead of masked SPO+). The gains over BayesianMSE are statistically significant on five of the six tasks:
- Portfolio Optimization: Drops cumulative regret by ~32%, from $101.5 \pm 9.8$ (BayesianMSE) down to $68.6 \pm 3.4$ (and far below LinUCB's $357.2$).
- Combinatorial Tasks: Lowers regret from $54.6\text{K}$ to $49.6\text{K}$ on Knapsack-100, and from $26.2\text{K}$ to $22.9\text{K}$ on $20\times 20$ Shortest Path ($8\times 8$ SP is a statistical tie at $6.4\text{K}$ vs. $6.5\text{K}$).
- Irish Energy Scheduling: Achieves a final cumulative regret of 92.81M cost units over 395 days versus 101.14M for BayesianMSE—a statistically significant 8.2% reduction.
Limitations and Future Work
- Theory-Practice Gap: The theoretical regret bounds assume a fixed feature map with linear true costs, whereas the actual algorithm updates its representation online and is tested on nonlinear synthetic data.
- Decision-Blind Exploration: Standard UCB explores based on individual arm cost uncertainty, which doesn't necessarily mean uncertainty about which overall decision is optimal. Future methods could use optimization geometry to actively explore arms that resolve decision boundaries or yield better counterfactual gradients.
- Extra Solver Calls & Stale Features: Computing SPO+ gradients requires extra solver calls each round (though far less burdensome than full-dataset epochs in offline DFL). Furthermore, past observations stored in the Bayesian heads aren't updated when the feature extractor shifts; replaying historical data through updated features is a promising next step.
Summary updated