# Contextual Scenario Generation for Two-Stage Stochastic Programming

arXiv: https://arxiv.org/abs/2502.05349 · HTML: https://mlsanity.com/paper/2502.05349/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 23 of its 53 references that are in the map.
- First posted on arXiv 7 Feb 2025.

## Builds on (most cited first, 23 of 23)

- [Attention Is All You Need](https://mlsanity.com/paper/1706.03762/) (2017)
- [Deep Sets](https://mlsanity.com/paper/1703.06114/) (2017)
- [Differentiable Convex Optimization Layers](https://mlsanity.com/paper/1910.12430/) (2019)
- [Kernel Mean Embedding of Distributions: A Review and Beyond](https://mlsanity.com/paper/1605.09522/) (2016)
- [Smart "Predict, then Optimize"](https://mlsanity.com/paper/1710.08005/) (2017)
- [Melding the Data-Decisions Pipeline: Decision-Focused Learning for Combinatorial Optimization](https://mlsanity.com/paper/1809.05504/) (2018)
- [From Predictive to Prescriptive Analytics](https://mlsanity.com/paper/1402.5481/) (2014)
- [A Review on Bilevel Optimization: From Classical to Evolutionary Approaches and Applications](https://mlsanity.com/paper/1705.06270/) (2017)
- [The Cramer Distance as a Solution to Biased Wasserstein Gradients](https://mlsanity.com/paper/1705.10743/) (2017)
- [A Measure-Theoretic Approach to Kernel Conditional Mean Embeddings](https://mlsanity.com/paper/2002.03689/) (2020)
- [A Survey of Contextual Optimization Methods for Decision Making under Uncertainty](https://mlsanity.com/paper/2306.10374/) (2023)
- [Unbalanced Optimal Transport, from Theory to Numerics](https://mlsanity.com/paper/2211.08775/) (2022)
- [Integrated Conditional Estimation-Optimization](https://mlsanity.com/paper/2110.12351/) (2021)
- [Posterior Sampling Based on Gradient Flows of the MMD with Negative Distance Kernel](https://mlsanity.com/paper/2310.03054/) (2023)
- [Conditional Generative Moment-Matching Networks](https://mlsanity.com/paper/1606.04218/) (2016)
- [Landscape Surrogate: Learning Decision Losses for Mathematical Optimization Under Partial Information](https://mlsanity.com/paper/2307.08964/) (2023)
- [Neur2SP: Neural Two-Stage Stochastic Programming](https://mlsanity.com/paper/2205.12006/) (2022)
- [A learning-based algorithm to quickly compute good primal solutions for Stochastic Integer Programs](https://mlsanity.com/paper/1912.08112/) (2019)
- [Evaluating Aleatoric Uncertainty via Conditional Generative Models](https://mlsanity.com/paper/2206.04287/) (2022)
- [Universal Representation of Permutation-Invariant Functions on Vectors and Tensors](https://mlsanity.com/paper/2310.13829/) (2023)
- [Problem-driven scenario generation: an analytical approach for stochastic programs with tail risk measure](https://mlsanity.com/paper/1511.03074/) (2015)
- [Y-Diagonal Couplings: Approximating Posteriors with Conditional Wasserstein Distances](https://mlsanity.com/paper/2310.13433/) (2023)
- [Value Function Gradient Learning for Large-Scale Multistage Stochastic Programming Problems](https://mlsanity.com/paper/2205.08934/) (2022)

## Abstract (arXiv)

Two-stage stochastic programs (2SPs) are widely used for decision-making under uncertainty, but their practical deployment is often limited by the large number of scenarios needed to approximate the conditional distribution of uncertain outcomes. We study contextual scenario generation: given contextual information, learn to produce a small, user-specified set of surrogate scenarios that, when used as input into the 2SP, lead to high-quality 2SP decisions. Existing scenario generation methods either ignore contextual information or are computationally burdensome in this setting. We propose contextual scenario generation (CSG), which learns a mapping from context to a set of surrogate scenarios. We develop two complementary methodologies: (i) a distributional approach that learns a mapping from context to scenarios by minimizing a kernel-based distance to the conditional distribution, and (ii) a task-based approach that selects the mapping to optimize decision quality via differentiating through a learned surrogate of the downstream 2SP objective. Both approaches are broadly applicable and require only repeated solution of the underlying subproblems and 2SPs defined on the generated scenarios. We provide finite-sample generalization guarantees and demonstrate strong empirical performance across multiple 2SP classes.
