LLMs Make Robust Stochastic Optimization Easier: An Agentic Workflow
Abstract
Distributionally robust optimization (DRO) provides a principled framework for decision-making under uncertainty, but its practical use remains challenging due to the need to specify uncertainty, ambiguity sets, mathematical formulations, and solver-compatible implementations. This paper studies the automatic translation of natural-language (NL) problem descriptions into mathematical formulations and executable code. We construct an NL-to-DRO dataset in which each instance contains an NL description, an intermediate representation (IR) of the formulation, and executable Robust Stochastic Optimization Made Easy (RSOME) code, covering diverse DRO structures for systematic evaluation. We further develop a Large Language Model (LLM)-based workflow centered on the IR for formulation, validation, and code generation, supported by a modeling knowledge library derived from the dataset. Experiments with closed-source LLMs show substantial improvements over direct code generation, with success rates reaching 91.1%. The proposed workflow lowers barriers to DRO modeling and helps practitioners, educators, and students connect NL descriptions with rigorous formulations and executable code. A companion website, https://zoe-wan.github.io/LLM4DRO/, provides access to the workflow for practical use.