TL;DR
Training machine learning models to make optimal downstream decisions—a field known as "predict-and-optimize"—is notoriously slow because it requires solving NP-hard optimization problems in every training loop. This paper introduces a new family of contrastive loss functions and a solution caching mechanism that speeds up training by orders of magnitude while maintaining, or even improving, decision quality.
What Problem Does This Paper Address?
In many real-world scenarios, we use machine learning to predict parameters (like future energy prices) that are then fed into an optimization problem (like scheduling factory machines). The traditional "two-stage" approach minimizes prediction error (e.g., Mean Squared Error), but even small prediction errors can lead to disastrously sub-optimal decisions.
"Decision-focused learning" (or end-to-end learning) solves this by training the model to minimize the final regret—the loss incurred by the resulting decision. However, this creates a massive computational bottleneck: to calculate the gradient for backpropagation, you must solve a complex optimization problem for every single data point in every single training epoch. For NP-hard combinatorial problems, this makes training prohibitively slow.
Methods
The authors propose two primary innovations to break this bottleneck:
- Contrastive Loss Functions: Inspired by Noise-Contrastive Estimation (NCE), they treat the true optimal solution as a "positive" example and other feasible solutions as "negative" examples. The model is trained to maximize the score of the true optimal solution relative to the others. They introduce specific variants for linear cost functions to prevent the model from simply predicting "zero" for all costs.
- Solution Caching (Inner Approximation): Instead of calling an expensive solver every time, the authors maintain a cache of previously found solutions. During training, they only call the solver with a small probability (e.g., $p_{solve} = 5\%$). The rest of the time, they simply perform a fast lookup in the cache to find the best solution among those already seen.
As shown in Figure 1, this cache acts as an inner approximation of the feasible space. While standard methods often use "outer approximations" (relaxing constraints), this inner approximation provides a tighter, more structured view of the discrete solution space.
Datasets
The methodology was evaluated on three NP-hard combinatorial problems:
- Knapsack Problem: Selecting items to maximize value under a weight limit, using historical energy price data from 2011-2013.
- Energy-cost Aware Scheduling: A complex task-scheduling problem from CSPLib where the goal is to minimize total energy consumption costs based on fluctuating prices.
- Diverse Bipartite Matching: A matching task using the CORA citation network, where the goal is to maximize rewards while satisfying similarity and diversity constraints.
Key Insights and Ideas
- The "Aha" Moment for Caching: The authors realized that you don't need to find the absolute global optimum in every training step to get a useful gradient. A "good enough" solution from a growing pool of previous solutions is often sufficient to guide the model's weights in the right direction.
- Inner vs. Outer: Most existing work relies on continuous relaxations (outer approximations) to make problems differentiable. By using a discrete solution pool (inner approximation), the authors stay closer to the true combinatorial nature of the problem.
- Efficiency-Accuracy Trade-off: By setting $p_{solve}$ to just 5%, they found they could achieve state-of-the-art regret levels while calling the expensive solver 20 times less often.
Key Results
The results demonstrate a dramatic shift in the Pareto front of training time versus decision quality.
- Speedup: For the Knapsack problem, per-epoch runtime dropped from ~2-4 seconds to just 0.5 seconds. For the Energy Scheduling problem, the speedup was even more dramatic, reducing runtime from 42.5 seconds to 1.5 seconds per epoch in some cases.
- Performance: The proposed contrastive losses ($L_{MAP}^{(\hat{c}-c)}$) consistently matched or outperformed state-of-the-art methods like SPO+ and Blackbox differentiation in terms of final test regret.
- Scalability: The caching mechanism proved effective even when applied to other existing solver-agnostic methods, showing its broad utility as a training accelerator.
As seen in Figure 3, the caching methods (clustered on the far left of the x-axis) achieve low regret significantly faster than traditional approaches.
Limitations and Future Work
While highly effective, the paper notes a few areas for further exploration:
- Cache Management: As training progresses, the solution cache grows. While currently manageable, extremely long training runs on massive problems might eventually require strategies for pruning or managing the cache size.
- Linear Focus: The most effective loss variants were tailored for linear objective functions. Extending these specific regularized variants to non-linear objectives remains an open area.
- Warm-starting: The authors suggest that combining their caching approach with solver "warm-starting" (using the cache to give the solver a head start) could yield even further gains.
Summary updated