WorksComputer Science
RobustOPT: A Human–AI Collaborative Modeling System for Robust and Distributionally Robust Optimization
Abstract
Robust optimization (RO) and distributionally robust optimization (DRO) help decision makers manage uncertainty, but their practical use requires mathematical reformulation and implementation. Recent systems use large language models (LLMs) to generate code while relying on specialized modeling software to construct these reformulations. Their workflows offer limited support for user interaction, expertise reuse, and reformulation checking. To address these limitations, we present RobustOPT, an LLM-native human–AI collaborative modeling system for RO and DRO. LLMs directly derive explicit reformulations and generate code for standard optimization solvers, without relying on specialized RO/DRO modeling software. Users participate throughout the workflow by clarifying problem assumptions before reformulation, correcting models and customizing memory during reformulation, and revising decisions after solving. A customizable memory module enables users to maintain reusable expert knowledge and independently select Math memory for reformulation and Code memory for implementation. A pointwise reformulation check compares feasibility and worst-case cost at the same decision without requiring a known optimum. Application cases illustrate how uncertainty choices affect decisions and how users reoptimize after partial implementation. Experiments show that the memory module improves evaluation pass rates, while pointwise checks reveal reformulation errors hidden by agreement with a reference optimal value.
Introduction
Robust optimization (RO) and distributionally robust optimization (DRO) help decision makers choose actions when costs, demand, or supply are only partly known [8, 41]. Consider a buyer allocating orders among suppliers with uncertain prices. Price ranges alone do not determine whether the buyer should protect against every supplier charging its highest price at once. The chosen treatment of uncertainty must be expressed in a model, preserved in its mathematical reformulation, and reflected in the computed allocation. When prices change or some orders have already been placed, the buyer must also revise the remaining decisions.
Formulating and solving this problem requires domain knowledge, mathematical derivation, and programming expertise. The decision maker specifies the operational requirements and the uncertainty to be covered. A modeler derives a finite reformulation, a mathematical program with finitely many variables and constraints, and implements it in solver code. ROME and RSOME automate this transformation for models written in specialized modeling languages [18, 13]. More recently, large language models (LLMs) have made natural-language descriptions a starting point for optimization modeling. ORLM and OptiMUS generate models and code [22, 1], while DAOpt [57] and LLM4DRO [47] extend this approach to optimization under uncertainty. These two systems build on specialized modeling software such as RSOME, providing limited support for three practical needs: user interaction, expertise reuse, and reformulation checking.
First, practical modeling under uncertainty requires human oversight throughout the process. Initial descriptions may omit operating constraints or leave unclear which adverse conditions the decision must withstand. Automated derivations may then introduce errors that users need to identify and correct. After solving, prices or capacities may change while orders already placed must remain fixed. Interaction at individual stages helps with these needs, but users also need access to the intermediate information, equations, and code to follow the problem through successive revisions.
Second, effective use of expertise remains a challenge in LLM-based modeling. Established mathematical results and coding practices can help avoid errors that arise when an LLM relies on its own reasoning. Yet the knowledge needed to derive a reformulation differs from that needed to implement it. A duality rule may apply across solvers, whereas variable declarations and constraint interfaces depend on the chosen solver. Local interfaces and solver settings may also reflect users’ requirements absent from the problem description. Users need relevant knowledge for both tasks and a way to adapt it to these requirements.
Third, users need immediate check on reformulation correctness during modeling, when the ground-truth optimum is unknown. Some existing systems provide code-execution feedback, but a program can run successfully and return a solution even when the reformulation omits a constraint or misrepresents the uncertainty. The challenge is to check for such discrepancies within the modeling workflow and provide evidence that helps users identify and correct errors, without the known optimum.
We present RobustOPT (robustopt.tech), an LLM-based modeling system for RO and DRO that supports human–AI collaboration throughout the modeling and solution process. Its LLM-native workflow uses LLMs to formulate the original model, derive an explicit finite reformulation, and generate code for standard optimization solvers, without relying on specialized RO/DRO modeling software.
RobustOPT’s workflow has six steps: Input, Identification, Original model, Reformulation, Solver code, and Results, as shown in Figure 1. Starting from a description and data or an existing model, users confirm the modeling choices, review and revise the reformulation, and obtain solver code and a solution that they can subsequently update. Inputs, intermediate models, and code remain visible and editable throughout the process. Math memory and Code memory supply guidance for LLM-based derivation and implementation, respectively. Pointwise check provide evidence for revising the reformulation, and users can retain a reviewed correction in their own memory library. The three contributions are as follows.

Figure 1. Overview of the RobustOPT system.
An interactive workflow. RobustOPT supports user interaction at three stages: before reformu-
lation, during reformulation, and after solving. Before reformulation, users confirm facts and uncertainty assumptions. During reformulation, they correct the reformulation and customize the memory based on the feedback of pointwise reformulation check. After solving, they update data or fix selected decisions, then re-solve the revised problem, without another LLM call.
A customizable memory module. Mathematical and coding knowledge are organized in independently selectable libraries. For each stage, users can choose system-provided knowledge, maintain their own entries, or proceed without memory. They can inspect the supplied rules and adapt them to their modeling and solver requirements.
A pointwise reformulation check. For a given decision, an independent evaluator computes feasibility and worst-case cost from the original model and compares them with what the solver program reports. An adverse scenario, a distribution, or a pair of bounds can establish a discrepancy at that decision even when the optimal value is unknown.
The application cases show how uncertainty choices and fixed decisions affect the solution, with all 40 complete-input tasks reaching independently evaluated optima. The system evaluation results show the memory module significantly improves the accuracy and efficiency. Generated programs and controlled model changes expose errors hidden by optimal-value agreement and show how checking feedback guides repair.
Section 2 reviews related work. Sections 3–5 present the workflow, memory module, and pointwise check. Section 6 evaluates the three components, and Section 7 concludes. The electronic companion contains proofs, implementation details, experimental protocols, and additional results.
Related Literature
Optimization software typically accepts a model written in a modeling language, whereas LLM-based systems can begin with a natural language-described problem. We review these systems through the three concerns that motivate RobustOPT: user interaction, customizable memory, and reformulation checking.
Modeling Software and LLM-Based Systems
General-purpose algebraic modeling languages such as JuMP provide a structured interface between mathematical models and optimization solvers [33]. Specialized packages including ROME, YALMIP, JuMPeR, ROmodel, PyROS, and RSOME automate parts of robust or distributionally robust modeling [18, 31, 16, 48, 44, 13, 12]. They draw on the theory of uncertainty sets, ambiguity sets, and tractable counterparts [4, 7, 15, 36, 5] (Wiesemann et al. 2014). The applicability conditions of a reformulation are essential: for example, Xie [51] gives sufficient conditions for tractable convex reformulations of two-stage DRO over a type- Wasserstein ball. Once the user has written the uncertain model, the software can apply a prescribed transformation or solution algorithm. RSOME, for example, can display the resulting standard-form program. Cutting-set methods use a worst-case routine at successive decisions to solve a robust problem [37, 9].
LLM-based systems also address the translation from a problem description to a model. NL4Opt studies the extraction of structured modeling information, while Chain-of-Experts, LLMOPT, ORLM, and OptiMUS generate deterministic models and solver programs [42, 50, 24, 22, 1]. For optimization under uncertainty, DAOpt identifies uncertain quantities from a description and data, generates RSOME code with few-shot guidance, and revises the code using execution feedback [57]. LLM4DRO [47] presents an agentic workflow that validates an intermediate representation of the original DRO model against the user’s description and translates it into RSOME code.
DAOpt and LLM4DRO have explored LLM-based modeling for RO and DRO through specialized modeling software such as RSOME. However, their workflows provide limited support for user interaction, expertise reuse, and reformulation checking. These limitations restrict users’ ability to adapt and assess the generated models in practice. RobustOPT addresses these limitations through an LLM-native workflow that directly employs LLMs to derive explicit reformulations and generate code for standard solvers, without relying on specialized RO/DRO modeling software. RobustOPT supports user interaction throughout the modeling process, user customization and reuse of expert knowledge, and model-level reformulation checking, as shown in Table 1.
| System | Problems | Before | During | After | Entry maintenance | Math/Code selection | Execution check | Pointwise check |
| OptiMUS-0.3 | Deterministic | ✓ | ✓ | ✓ | ||||
| OptiGuide | Deterministic | ✓ | ✓ | |||||
| DAOpt | RO, DRO | ✓ | ||||||
| LLM4DRO | DRO | ✓ | ✓ | |||||
| RobustOPT | RO, DRO | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Table 1. Comparison among LLM-based modeling systems. Before, During, and After refer to user interaction before reformulation, during reformulation, and after solving, respectively. Entry maintenance refers to adding, editing, or removing entries in a user’s memory library. Math/Code selection denotes independent choices of Math memory and Code memory.
Human Involvement in Optimization Modeling
The choice of a protection criterion is itself a modeling decision. Iancu and Trichakis [23] show that a worst-case optimal solution can be Pareto dominated and develop methods to obtain Pareto robustly optimal solutions, motivating scrutiny of performance beyond a single worst-case value. Robust satisficing evaluates fragility relative to a performance target [32], and its predictive extension accounts for both distributional ambiguity and parameter estimation uncertainty [46]. Joint estimation and robustness optimization integrates parameter estimation with the choice of an uncertainty set that preserves desired performance [56]. These approaches motivate making protection assumptions explicit to the user; they are distinct from the fixed-set RO and DRO counterparts evaluated in our experiments.
Interviews with optimization practitioners document iterative modeling workflows in which stakeholder dialogue, data preparation, and validation remain central [26]. This evidence motivates supporting revision and review throughout modeling. Model management in decision support separates a model from its data and solver so that each can be reviewed and changed ([17]). Mixed-initiative systems divide work between a user and an automated agent according to who can resolve each decision ([21, 3]). Interactive multiobjective optimization keeps the decision maker involved as preferences are formed ([35]). Among LLM systems, OptiMUS-0.3 lets users correct parameters, natural-language clauses, mathematical formulations, and code ([2]). OptiGuide answers what-if questions about a solved supply-chain model ([28]). In DRO, Wang et al. [47] request clarification of missing modeling information.
RobustOPT connects confirmation of uncertainty assumptions, inspection and correction of the explicit reformulation, and revision of the computed decisions within one interactive workflow. When prices or capacities change, users can update the solution while holding decisions already implemented fixed.
Memory for LLMs and for Optimization Modeling
Reusable guidance can come from reference material or from experience. Retrieval-augmented generation supplies relevant documents ([27]), and MemGPT manages external memory ([39]). Reflexion and ExpeL retain feedback or extract experience from earlier attempts ([45, 54]). ReasoningBank and ACE distill strategies from past trajectories ([38, 52]). In optimization modeling, AlphaOPT builds an experience library of modeling insights, each with an applicability condition that can be refined across tasks ([25]).
For RO and DRO, Bertsimas and Margaritis [6] provide expert informational prompts for robust and adaptive robust optimization. The library of Wang et al. [47] includes DRO formulation examples, RSOME implementation practices, and recurring errors and their repairs. Their library combines LLM reflection with human review. AutoREM learns reformulation rules for box, budgeted, and polyhedral RO through offline adaptation, using structured memory updates and validation-based acceptance ([10]).
These studies show how documents, expert rules, and experience can supply modeling knowledge. RobustOPT organizes such knowledge in a customizable memory module. Users can maintain their own entries and independently select, edit, or omit Math memory for reformulation and Code memory for implementation. A modeler can thus retain a mathematical rule while adapting the code to local solver conventions.
Relation to AutoREM. AutoREM and RobustOPT share memory-guided LLM reformulation and a subsequent coding stage. AutoREM learns mathematical experience from solver feedback and freezes the memory for online use. Its Appendix G already distinguishes objective agreement from mathematical equivalence and reports expert audits of counterparts and coder fidelity. RobustOPT develops a complementary system contribution: users review uncertainty assumptions, formulations, code, and revised solutions; choose Math and Code libraries independently; and invoke automated comparisons of original and reformulated feasibility and cost at common decisions. These runtime comparisons do not require a known optimum. The analysis specifies premises for reformulation reuse and evidence that refutes exactness, while the experiments cover polyhedral and ellipsoidal RO and moment and Wasserstein DRO. The system-provided entries are written from the literature; they are not a new offline memory-learning algorithm. Finite pointwise checks can expose errors but cannot certify global equivalence. The two papers use different evaluation protocols, so their reported success rates are not directly comparable.
Verification of Generated Models
Optimization certificates and reformulation checks answer different questions. For example, the L0BnB framework obtains dual bounds and certifiably optimal solutions for a specified sparse regression model [20]; such a certificate presupposes the model being solved. RobustOPT checks whether a generated counterpart preserves the original uncertain model. Software validation offers several ideas for checking a generated reformulation. Translation validation checks an individual output of a transformation rather than establishing that every output will be correct [40]. Certifying algorithms supply independently checkable evidence [34]; an adverse scenario plays this role when it disproves a claimed robust guarantee. Property-based and metamorphic testing motivate examining multiple decisions and related parameter settings [14, 11]. Among approaches for optimization models, FLARE proves MILP reformulations equivalent to a reference with a theorem prover [43], and ModelEquivBench compares generated and reference models across several relations [55]. Li and Hai (2026) test necessary conditions on transformed LP instances. OptArgus uses LLM auditors to find errors [30, 49]. As Zhang et al. [53] observe, a model can reproduce a reference optimum and still be wrong.
RobustOPT’s pointwise reformulation check asks whether the original model and its reformulation assign the same feasibility and worst-case cost to a given decision. Matching the reported optimum leaves that question open at other decisions. The check fixes the original decisions, optimizes over any auxiliary variables in the reformulation, and compares the result with an independent worst-case evaluation. It assesses whether the transformation preserves the original model, whose agreement with the application still requires modeling judgment.
Interactive Workflow
A user of RobustOPT can examine how a choice about uncertainty enters the model, review its mathematical consequences, and revise a solution when circumstances change. Here, a user may be a decision maker specifying operational requirements or a modeler reviewing the mathematics and code. A portfolio example illustrates these decisions over the six steps of the workflow. The online system also provides a step-by-step user manual.
Overview
Users can begin with a problem description and data or with an existing uncertain model (Figure 1). LLMs extract the modeling information, draft the original model, derive its reformulation, and generate solver code. Users contribute domain knowledge and preferences, exercise modeling judgment, and decide whether to accept the proposed model and its revisions. They can supply missing information and inspect or edit the equations and code. Independent numerical routines perform the pointwise comparisons, and optimization solvers compute the solutions.
For a description, Identification extracts the decisions, constraints, parameters, and uncertain quantities and asks the user to resolve open questions. Original model then presents the proposed equations for review. A user who supplies an existing model can proceed directly to reviewing it. Once reviewed and accepted, the model serves as the working specification for reformulation and checking.
At Reformulation, the user can select mathematical rules from Math memory and inspect the resulting equations alongside the available check results. These results help the user decide whether to continue, request another derivation, or edit the equations. At Solver code, the user can select the solver and implementation instructions from Code memory, then review or revise the program. At Results, the user sees the solver status and, when a solution is available, its objective value and decisions. A fresh check can be requested if the program has been modified.
Users remain involved throughout the workflow. They clarify operational information before reformulation, review and revise equations during reformulation, and update data or fix implemented decisions after solving.
Before Reformulation: Choosing What to Protect Against
Some questions at Identification concern facts the user can supply, such as a purchasing budget or a missing item in a data array. Others call for a modeling decision even when the observations are complete. Consider a manufacturer buying 20 interchangeable parts from four suppliers before prices are settled. The price range for each supplier still leaves open which prices may reach their upper limits together.
One uncertainty set allows all four suppliers to charge their highest prices at once. Another retains each supplier’s bound but limits the combined size of the increases. By excluding some joint extremes, the latter may reduce the optimal worst-case cost. The manufacturer’s protection choice determines which joint price increases its purchases must withstand. At Identification the user reviews the extracted data and chooses among the alternatives. At Original model the user confirms that the objective, constraints, and uncertainty set express that choice.
During Reformulation: Reviewing and Revising
At Step 4, the LLM can review the proposed equations, while the pointwise check provides an independent numerical comparison with the original model. The check asks whether the original model and the reformulation agree on feasibility and worst-case cost or return at selected decisions, without requiring a reference optimum. The report shows the available comparisons and their results. An adverse scenario or distribution can help a modeler understand a disagreement and locate its source. Section 5 explains the checking mechanism.
A modeler who wants a new derivation can select Retry. The LLM receives the previous reformulation and the report, together with any instructions the modeler adds, such as a reminder to preserve a stated mean equality. With Edit, the modeler can instead change the displayed equations and check the revised formulation. The same option is available when the modeler prefers another representation, even if the report found agreement. A correction that applies more broadly can be saved in a personal memory library for future tasks.
After Solving: Adjusting and Re-Solving
A price or capacity may change after the original solve, while some orders have already been placed and cannot be changed. At Results the user can update available parameters, including the level of protection, fix the decisions already implemented, and reoptimize the remaining ones. When the changes are covered by the existing reformulation and can be applied to the program, re-solving requires no further LLM call.
Before re-solving, RobustOPT checks basic conditions on the revised data, such as a nonnegative uncertainty radius. The modeler reviews any additional assumptions required by the selected reformulation. The updated decisions and objective value can then be compared with the original solution. If the change calls for a new model or reformulation, the user can copy the task and return to the relevant earlier step.
A Walkthrough
In the two-asset portfolio from the RobustOPT gallery, an investor must allocate capital before either asset’s return is known. The investor uses System-provided memory and later considers a revised forecast and a position that must remain fixed.
Step 1: Input. The investor supplies the expected returns, the information available about return errors, and the restrictions on the allocation.
| Input: description and data | ||
| Description. Allocate up to one unit of capital between two assets before their returns are known. Borrowing and short sales are not allowed. Choose the allocation with the highest return we can guarantee for return errors in the range set by the research desk’s shape matrix. | ||
| Data. | ||
| asset 1 | asset 2 | |
| expected return | 10% | 8% |
| shape matrix of return errors | (0.0009, 0.0002) | (0.0002, 0.0016) |
Table 11.
Step 2: Identification. The capital constraint and nominal returns are specified. The remaining question is how the investor wishes to use the desk’s shape matrix . The model can retain the joint ellipsoid described by or use its componentwise ranges.
| Identification: what the system found and what it asks | |
| Decisions | shares , |
| Objective | maximize the guaranteed return |
| Uncertain | return errors , centered at zero, shape matrix |
| How should return errors be protected against? | |
| □ Componentwise intervals of and percentage points. Both errors may reach their worst values at once. | |
| ⊠ Joint ellipsoid . The two errors cannot reach their worst values together. |
Table 12.
Figure 2 illustrates what this choice implies for a portfolio invested equally in both assets. The dot on the ellipse marks the worst pair of errors under joint protection, a loss of 2.69 percentage points. Using componentwise intervals admits the lower corner of the rectangle, marked by the square, where the loss reaches 3.50 percentage points.

Figure 2. Joint and componentwise protection for the portfolio example. Deviations and losses are in percentage points.
Step 3: Original model. Having chosen the ellipsoid, the investor reviews the objective and constraints in the displayed model. Each term is editable before confirmation.
| Original model: confirm or edit |
Table 13.
Choice. Confirm the joint ellipsoid and this model.
Step 4: Reformulation. The investor selects System-provided Math memory. For a fixed allocation , the largest loss from return errors in the ellipsoid is , where . The reformulation bounds this loss by , which is subtracted from the nominal return. The investor reviews the equations and the check report before proceeding.
Reformulation and check report
Math memory. ☒ System-provided ☐ User-customized ☐ No memory
Reformulation. Factor the positive definite matrix . Maximize subject to , , , .
Check report. No discrepancy at the tested decisions.
Next. Continue, Retry, or Edit.
Step 5: Solver code. The investor chooses Gurobi and System-provided Code memory. In the program below, the constraint defining uses column of to implement . The investor can inspect or edit the program, or request new code before solving.
Solver code (excerpt)
Solver. Gurobi Code memory. System-provided
L = np.linalg.cholesky(Q)
t = m.addVar(lb=0.0, name="t")
for i in range(n):
m.addConstr(w[i] == gp.quicksum(L[j, i] * x[j] for j in range(n)))
m.addQConstr(gp.quicksum(w[i] * w[i] for i in range(n)) <= t * t)
m.setObjective(gp.quicksum(c[j] * x[j] for j in range(n)) - t, GRB.MAXIMIZE)
Step 6: Results. The investor sees the optimal allocation and its guaranteed return, with the models and check report available for inspection. Starting each time from that baseline, the investor considers two revisions. The first lowers asset 1’s expected return to 9%. The second retains the original forecasts and fixes to represent a position already established. Both revisions use the existing program and require no further LLM call.
| Results and revised solutions | |||
| asset 1 / asset 2 | guaranteed | request | |
| Baseline | 94.0% / 6.0% | 7.01% | – |
| Forecast revised | 79.3% / 20.7% | 6.15% | change data: expected return of asset 1 to 9% |
| Position fixed | 60.0% / 40.0% | 6.60% | fix decision: |
Table 2.
The lower forecast shifts 14.7 percentage points of capital to asset 2. Under the original forecasts, fixing the 60% position in asset 1 reduces the guaranteed return by 0.41 percentage points. The investor can also change another parameter or fix further decisions and re-solve.
The Customizable Memory Module
Deriving a finite reformulation requires mathematical rules for the uncertainty or ambiguity set at hand. Implementing the result also requires conventions specific to the solver. RobustOPT’s memory module lets users choose which rules the LLM receives for the derivation and which instructions it receives for the code. Users can adapt either to their own modeling practice, including interfaces to an existing code library, team conventions, and solver parameter settings. These local requirements need to be supplied explicitly alongside general mathematical knowledge.
Organizing and Using Memory
A memory library is an editable collection of rules supplied to the LLM at the relevant stage. Each memory entry groups related instructions and identifies their source and scope. At Step 4, Math memory supplies solver-independent rules for deriving a finite reformulation. At Step 5, a Code memory entry can give instructions specific to the selected solver, as the system-provided entries do for Gurobi.
Table 2 illustrates the distinction for an uncertain term , where is its coefficient vector. In the portfolio model, is the allocation . The mathematical rule gives the norm of for the worst deviation. The corresponding Gurobi instructions specify which elements of to use and which bounds to give the variables in the norm constraint.
Users select libraries independently for mathematical derivation and for the solver implementation reviewed at Step 5. The options are System-provided, User-customized, and No memory. When the user selects a library, the module supplies the entries for the stage and the problem family, together with entries shared across families. The task records the library and entries supplied to the LLM. With No memory, generation proceeds without additional rules at that stage.
System-Provided Memory
The memory format accommodates rules for different RO and DRO formulations. The system-provided library used in the experiments contains four Math entries and four Gurobi Code entries, covering polyhedral RO, ellipsoidal RO, moment DRO, and Wasserstein DRO. Users can extend their libraries with entries for other formulations. The mathematical rules draw on work on polyhedral and ellipsoidal RO and uncertainty budgets [4, 7], on ambiguity sets defined by moments [15], and on type-1 Wasserstein balls [36]. The rules specify details that can change the model, such as which uncertain constraints need separate multipliers or how restrictions on the support enter a Wasserstein dual.
The Code entries translate these results into Gurobi variables and constraints. For example, a dual multiplier for an equality constraint in a polyhedral uncertainty set is free in sign. A new Gurobi variable is nonnegative by default, so the Code entry specifies an explicit lower bound of for that multiplier.
User-Customized Memory
A modeler can inspect the system-provided entries and copy them to a personal library (Figure 3). The modeler can then add a rule, change the conditions under which it applies, or remove an entry. The account retains the library for later tasks and keeps earlier revisions available.

Figure 3. Selecting and maintaining Math and Code memory.
For example, a team may use the standard mathematical derivation but require its Gurobi models to have a prescribed name and to be built by a reusable function. A modeler can record these conventions in a personal Code entry and choose that library for implementation while keeping System-provided Math memory for the derivation. A check report may likewise reveal a missing bound that matters in other tasks. The modeler can review the correction and its scope, save it as an entry, and inspect subsequent formulations and programs for consistency with the saved rule.
Pointwise Reformulation Check
The pointwise reformulation check compares a solver implementation of the candidate reformulation with an independent evaluation of the original model. At a fixed decision, it tests whether the two agree on feasibility and, when feasible, worst-case cost. This comparison can reveal an error even when the models agree on the optimal decision and its value.
Reformulations and Silent Failures
Once an order has been optimized, a buyer may want to consider a different split between suppliers. The first example shows how a reformulation can misprice that split. The second shows how it can accept an order that cannot be filled.
Example 1. A buyer splits a unit order between two suppliers whose surcharges move in opposite directions. When supplier 1 charges , supplier 2 charges , with . Supplier 1 also charges a premium per unit. If is the share bought from supplier 1, the worst-case cost over all distributions of on is
A reformulation that maximizes each supplier’s surcharge separately gives . This ignores the fact that both surcharges depend on the same and cannot attain their maxima together. At , both models buy everything from supplier 2 at cost 1. At an equal split the surcharges offset each other exactly, so the worst-case cost is . The reformulation charges 2. If the premium falls to zero, splitting the order reduces the true worst-case cost to , while the reformulation reports 1 for every split (Figure 4).

Figure 4. Optimal-value agreement and pointwise discrepancies (Example 1).
Example 2. A buyer needs ten units. Supplier A charges one per unit and supplier B charges two. Under adverse conditions B can deliver only four units. At these prices both the original model and a program that omits B’s delivery limit buy everything from A at cost ten. Requiring six units from B exposes the missing constraint. The program accepts an order that B may be unable to fill.
Such errors can arise when a derivation uses an upper price endpoint without checking whether the purchase quantity can be negative, treats a fixed mean as an inequality bound, or evaluates costs exposed to the same shock under separate worst cases [19]. Their common feature is that the models disagree about at least one decision. To compare them, we need to identify that decision in both formulations.
Comparing the models at a fixed decision. Let collect the data, including costs, capacities, and the parameters of the uncertainty or ambiguity set. Write the original model as
The set imposes the original decision domains, including integrality, and the deterministic constraints. For , the RO expression is the worst case over the uncertainty set. For a DRO worst expectation, is the worst expected value over the ambiguity set. A maximization problem takes the form (1) on negating its objective. Let denote the feasible set of . We combine its cost and feasibility in one function, the extended worst-case cost , equal to on and elsewhere in .
The candidate finite program is
Its variables also include auxiliary quantities such as dual multipliers. The decision map identifies the original decisions in the program. For an order split , for example, the split is fixed but the program must still choose the auxiliary variables. The least cost the program assigns to any given is its projected value
with if the program has no feasible solution at . The two quantities to compare are now and . They express the extended cost assigned to the same decision in the original model and the finite program.
Table 3 illustrates how the original model can be evaluated independently at a fixed decision. For a budgeted constraint one need only sort the exposures and allocate the budget to the largest. For the moment-DRO losses and convex supports in the table, the evaluator computes the worst expectation through a finite convex program over distributional masses and locations, subject to the original support and moment conditions. These calculations use the uncertainty description directly, without relying on the candidate reformulation. Section EC.1.3 gives the derivations and conditions for the implemented routines.
Exactness and Reformulation Records
We define exactness by preservation of the extended worst-case cost. For decisions with finite worst-case cost, this also preserves feasibility. Some formulations are deliberately conservative and are intended to bound the cost from above.
Definition 1 (Exactness and conservativeness). A finite program is exact for if for every , and conservative if for every .
Defining both functions on all of also captures decisions that violate the original domains or constraints. Because an infeasible decision and a feasible decision with infinite worst-case cost both have extended value , the checker records constraint feasibility separately from cost. A conservative program may exclude some feasible decisions or charge them more than their original worst-case cost. The program of Example 2 fails even the conservative requirement by accepting an infeasible order. The program in Example 1 is conservative. Its excess charge for a split order matters precisely because the buyer wanted an exact cost.
The same distinction matters on a later solve. A price may change, or an order that has already been placed may have to be held fixed. A reformulation record makes explicit the premises under which the same equations apply.
Definition 2 (Reformulation record). A reformulation record is a tuple of the original model, a finite set of premises on , the finite program, and the decision map. Its premise region is . The record is valid if is exact for for every .
The next proposition states when the same reformulation can support a revised decision problem without a new derivation. Its premise is exactness throughout the stated parameter region.
Proposition 1 (Reuse of a reformulation). For a valid record, at every the two models have the same optimal value, and each optimal program solution yields an optimal original decision. Exactness persists after any restriction on the original decisions alone, including fixing some of them. If a program is only conservative at the data used, each feasible program solution still yields a feasible original decision with worst-case cost no greater than its reported cost.
For example, an endpoint rule for interval prices can still be used at new prices if its premise of nonnegative purchase quantities continues to hold. Table 4 distinguishes the derivation and premises needed over the whole region from the numerical agreement observed at particular decisions. Section EC.1.1 gives the proof and the converse for attained projected values.
| Evidence | Establishes |
| Derivation of each rule under its premises | validity if the rules are also applied, combined, and implemented correctly |
| Every premise of the derivation holds at | the current data lie in the region covered by the derivation |
| Completed, unflagged comparisons at the tested decisions and parameters | agreement of the two numerical evaluations at those points within the stated tolerances |
Table 4. Evidence for reformulation reuse and numerical checking.
The Multi-Level Check
At a selected decision , the checker fixes the original variables in the solver program and optimizes over its auxiliary variables. An independently written evaluator computes feasibility and worst-case cost at the same decision from a structured, machine-readable representation of the original model. This representation specifies the decisions, constraints, and uncertainty information required by the evaluator. The next proposition identifies the evidence needed to reject exactness. An admissible scenario or distribution can expose a cost understatement or an infeasible decision accepted by the program. To establish a cost overstatement, a lower bound on the program’s projected value must exceed an upper bound on the original worst-case cost.
Proposition 2 (Pointwise refutation). At a given decision , either of the following refutes exactness.
(a) A feasible program solution maps to . Either violates its original domain, or an admissible RO scenario or a DRO distribution in the ambiguity set violates an original constraint or yields a cost above . This also refutes conservativeness.
(b) The original model accepts , and bounds on its cost and the projected program value satisfy .
In Example 2, ordering six units from the second supplier gives part (a) when adverse conditions limit its delivery to four units. For an equal split in Example 1, the bounds and give part (b) at . This overstatement refutes exactness and remains consistent with conservativeness. The proof is in Section EC.1.1.
The framework combines several levels of checking (Table 5). Level M examines the original model’s feasibility, S checks program execution, and D1 evaluates the returned decision. D2 also examines nearby decisions, vertices when practical, and random trials. An order split is one such decision at which the error in Example 1 becomes visible. For parameterized models and programs, D2 repeats comparisons at changed data. D0 compares optimal values when a reference is available for benchmarking. Figure 5 shows the comparison shared by D1, D2, and D2, while Table 5 specifies the role of each level.

Figure 5. Pointwise comparison across checking levels.
| Level | Question | What is compared |
| M | Is the original model feasible? | nonempty sets; a feasible decision or an infeasibility certificate |
| S | Does the program run and solve? | execution and solver status |
| D1 | Is the returned decision as good as reported? | feasibility and worst-case cost at the returned decision |
| D2 | Does the program agree at other decisions? | feasibility and cost at trial decisions |
| D2 | Does the agreement survive a change of data? | S, D1, and D2 at changed parameter values |
| D0 | Is the optimal value right? (needs a reference) | the two optimal values |
Table 5. Checks and the evidence they provide.
In RobustOPT, Step 4 presents the reformulation with the available check results. For these numerical comparisons, the system prepares a program using its default solver and Code memory settings. At Step 5, users inspect the program and can customize the solver, Code memory, or code. If these choices change the implementation, a new comparison is needed to assess the revised program. Appendix EC.§ 2.1 describes this implementation.
The check report identifies the decision behind each numerical disagreement, or flag, and gives the two evaluations and any available supporting evidence. A flag becomes a counterexample when a witness or separated bounds satisfy Proposition 2 at a common decision. Both evaluations must use the same decision after accounting for numerical tolerances. For example, a trial point just outside a variable bound may be moved to the bound when fixing the program variables (Section EC.2.5). One counterexample suffices to refute exactness. The user can review the implicated equations and code, edit them or request another derivation, and save a reusable correction in the memory library.
A completed check with no flag records agreement within tolerance at the decisions and data examined. The report distinguishes that outcome from an incomplete comparison or one for which no applicable worst-case routine exists. To locate a discrepancy, the modeler reviews the structured representation against the original equations and the program against the displayed reformulation. The disagreement may originate in either representation or in the derivation itself. Model review addresses whether the original equations express the user’s requirements; the pointwise check examines their transformation into a finite program. Section EC.§ 2.2 gives the sampling and numerical protocols.
System Demonstration and Evaluation
Our evaluation examines the workflow’s support for clarifying uncertainty choices, editing displayed formulations, and fixing implemented decisions. We also compare Math and Code memory choices and examine whether pointwise comparisons reveal reformulation errors hidden by a correct optimal value. The constructed tasks cover polyhedral RO, ellipsoidal RO, moment DRO, and Wasserstein DRO, with benchmark reference values verified by independent numerical calculations. Appendix EC.§ 4.1 describes their construction and reference checks.
The main experiments use DeepSeek-V4.1-Flash-1017 as the base LLM and Gurobi as the optimization solver. Workflow cases start from descriptions and data. Each workflow task allows up to three attempts. Within an attempt, automatic repair returns an execution error or check result to the LLM as feedback for revision, subject to the limits in Appendix EC.§ 4.2. The run stops once solving and all requested checks complete without a flag; the independent evaluator then assesses the delivered solution. Memory comparisons start from original models and allow one attempt per configuration and task. Appendix EC.§ 4 gives the settings and benchmarks.
Objective agreement (OA) requires the reported optimum to lie within of the reference value. An evaluation pass (EP) additionally requires the returned decision to be feasible in the original model, its independently evaluated worst-case cost to agree with the reported value, and a completed pointwise check with no flag. Independent programs evaluate original feasibility and cost in the workflow cases. In the memory experiments the evaluator also compares the generated program with the benchmark at sampled decisions and at the reference optimizer, which only the evaluator sees.
Estimated token costs are reported in US dollars (USD). Mean elapsed times include unsuccessful attempts and repairs. The comparison across workflow models uses API-call time.
Evaluating the Interactive Workflow
The workflow suite contains 40 tasks, ten per family, covering signed and integer decisions, fractional uncertainty budgets, different matrix conventions, moment bounds, finite supports, and instances with 50–80 decisions. We also examine four of these tasks with open uncertainty choices (N01–N04) and four with post-solve changes (N05–N08). Table 6 summarizes the runs.
| Input or request | Units | Observed outcome |
| Complete descriptions | 40 tasks | 40 first-attempt evaluation passes |
| Missing information | 5 controls | 5 clarification requests |
| Invalid information | 5 controls | 5 correction requests |
| Infeasible or unbounded model | 2 controls | 2 correct solver statuses |
| Open protection choices | 4 tasks | 4 clarifications; N03 completed after a subsequent model edit |
| Cumulative post-solve changes | 4 chains | 16 verified revisions (9 retained programs, 7 regenerated copies) |
Table 6. Workflow cases and outcomes. Complete-input runs and open-choice cases are separate; the latter include a continuation after editing.
The service allocation case (N02) illustrates why uncertainty choices matter. A service provider allocates 20 divisible blocks among five sites whose costs depend on common factors through a loading matrix . The initial description leaves the joint range of the factors unspecified. The clarification specifies a Euclidean factor ball of radius 1.6. The resulting protection term is , and the optimal worst-case cost is CNY 8,389. Allowing each factor to reach the same bounds independently changes the protection term to . Under this box the original allocation costs CNY 10,336. Reallocating 7.77 of the 20 blocks reduces the cost to CNY 9,761.
With all modeling choices specified in the inputs, the base LLM at high reasoning and No memory delivered independently verified optimal solutions on the first attempt for all 40 tasks. None required code repair or check-guided repair. Supplementary results for GPT-6.1 Sol on the same inputs are reported in Appendix EC.§ 4.2 (Table EC.Table 3).
| Family | Uncertainty or ambiguity set | Worst case at a fixed decision |
| Box RO | choose each endpoint by the sign of its coefficient | |
| Budgeted RO | sort the exposures and spend the budget on the largest | |
| Polyhedral RO | or a finite scenario list | one linear program, or enumeration of the scenarios |
| Ellipsoidal RO | closed form | |
| Moment DRO | distributions on a support given by bounds, linear rows, a norm ball, or a finite point list, with affine moment conditions and upper bounds on or of affine functions | convex support: a finite convex program; finite support: an LP over the listed points |
| Wasserstein DRO | type-1 ball of radius around an empirical distribution, , , or metric, support as above | convex support: a finite convex program; finite support: a transport LP |
Table 3. Representative worst-case evaluations at a fixed decision.
Whereas the 40-task batch supplied complete inputs, separate runs left the protection choices in N01–N04 open to test interactive clarification. All four prompted clarification. The inventory case (N03) also illustrates correction through the interface. The LLM review identified interchanged holding and shortage costs in the initial objective and stopped the workflow for correction. In a subsequent continuation, we edited the displayed objective to charge holding for surplus stock and shortage for unmet demand. The revised solution attained a worst-case cost of 42.125, confirmed by an independent distribution-based LP. Appendix EC.§ 4.2 distinguishes these initial runs from the continuation after editing.
After solving, changes in prices or capacity may require a manager to revise the remaining decisions while keeping orders already placed fixed. In N05–N08 we first changed operating costs and then strengthened protection. The next two requests fixed successive groups of ten decisions at quantities specified in the original case baseline. Each of the 16 revised solutions matched an independently computed optimum for that particular combination of updated data and fixed decisions (Table 7). Nine requests updated inputs or variable bounds directly in the retained program. For the other seven, the generated code did not expose the affected quantity as an adjustable input, so RobustOPT generated a revised program in a copy of the task.
| Task | Application (unit) | Baseline | New data | New protection | Fix group 1 | Fix groups 1, 2 | |
| N05 | procurement (million CNY) | 50 | 2,717.82 | 3,045.03 R | 3,282.13 R | 3,349.66 R | 3,427.30 R |
| N06 | power dispatch (CNY) | 50 | 8,404.04 | 9,386.22 R | 11,857.08 R | 12,077.14 R | 12,326.62 R |
| N07 | stock allocation (thousand CNY) | 50 | 799.29 | 865.50 B | 969.33 B | 983.51 B | 999.81 B |
| N08 | freight (thousand CNY) | 80 | 557.08 | 599.75 R | 670.90 B | 694.47 B | 731.95 B |
Table 7. Optimal worst-case costs after cumulative changes. R denotes a retained program and B a regenerated copy. Each column retains the changes in the preceding column. Each group is fixed at predeclared quantities from the original case baseline.
The last three columns of Table 7 hold the updated data and protection level constant while fixing first one group of decisions and then a second. Their successive differences, calculated before rounding, give the increase in the optimal objective value from each additional group of fixed decisions. In procurement (N05), fixing the first group of orders adds CNY 67.53 million and fixing the second adds a further CNY 77.65 million. In freight (N08), the corresponding increases are CNY 23.57 thousand and CNY 37.48 thousand.
Evaluating the Memory Module
Using the base LLM with reasoning disabled, we first compared three memory configurations on 256 original models. With No memory, the generated programs passed evaluation on 81 tasks. A comparison library containing published RO rules [6] and our DRO extensions yielded 188. With the four Math and four Code entries of the system-provided library, the count rose to 241 (Table 8). The models have two to five decisions in RO and two to eight in DRO. With system-provided guidance all 64 ellipsoidal cases and 62 of 64 in each DRO family passed. Polyhedral RO accounted for 11 of the 15 remaining cases.
| Guidance | Reasoning | Polyhedral | Ellipsoidal | Moment | Wasserstein | EP | OA | USD | Min./task |
| No memory | off | 23 | 43 | 5 | 10 | 81 | 93 | 6.67 | 1.91 |
| Expert rules | off | 31 | 48 | 55 | 54 | 188 | 198 | 4.34 | 1.38 |
| System-provided | off | 53 | 64 | 62 | 62 | 241 | 242 | 2.90 | 0.69 |
| No memory | on | 64 | 64 | 63 | 64 | 255 | 255 | 9.38 | 5.67 |
Table 8. Memory and reasoning on 256 tasks starting from original models. Evaluation passes by family (out of 64), all tasks (out of 256), and cost and time.
With system-provided memory and reasoning disabled, 241 of 256 tasks passed evaluation (94.14%). With reasoning enabled and No memory, 255 passed (99.61%), with one timeout. The memory-assisted configuration passed 14 fewer tasks while reducing total token cost from $9.38 to $2.90 and mean time per task from 340.4 to 41.7 seconds. These reductions amount to 69.1% in cost and 87.8% in elapsed time (Figure 6). Of the 242 programs that passed the runtime check with system-provided memory, 241 also met the independent evaluation criteria (Table EC.Table 7).

Figure 6. Evaluation passes, token cost, and elapsed time on the same 256 tasks. Open markers indicate that reasoning was disabled. The filled marker denotes reasoning enabled.
To study the effect of Math memory and Code memory, we enabled Math and Code entries separately for LLM on a set of 64 challenging models, 16 per family, with reasoning disabled. The RO models have five decisions and the DRO models have six to eight. Math entries alone led to evaluation passes on 50 tasks, close to the 55 obtained with both types. Code entries alone yielded 13, compared with 15 when neither was supplied (Table 9). The LLM received the Math entries both for the initial derivation and for revisions after a failed check. The stronger result for Math memory is consistent with the need for a correct reformulation before coding. Code entries guide its implementation, for example by specifying how to declare a free variable in Gurobi or what interface the program should provide to the team’s existing code. Some instructions overlap between Math and Code entries, so Table 9 compares the supplied groups rather than disjoint types of knowledge.
| Guidance used | Neither | Math only | Code only | Math + Code |
| Evaluation passes (EP/64) | 15 | 50 | 13 | 55 |
| Objective agreement (OA/64) | 15 | 51 | 13 | 55 |
| Mean minutes per task | 2.10 | 1.15 | 2.36 | 1.20 |
| Token cost (USD) | 1.74 | 1.03 | 1.80 | 1.03 |
Table 9. Math and Code memory on 64 tasks starting from original models. Reasoning is disabled. Each task has one attempt, including permitted repairs.
With reasoning enabled on these 64 models, the base LLM passed evaluation on 62 tasks without memory and 63 with system-provided memory, which also reduced the recorded token cost and mean elapsed time (Table EC.Table 5). Appendix EC.§ 4.3 reports the full five-configuration comparison, together with supplementary GPT-6.1 Terra results (Table EC.Table 6).
User-customized memory also communicates requirements of an existing code library that are not specified by the optimization model. For a two-supplier procurement model, we retained System-provided Math guidance and selected a personal Code entry specifying a builder name, a Gurobi model name, and a prefix for printed output. The generated program followed the function and model naming requirements but omitted the requested output prefix. Its optimization result remained correct. The program minimized subject to and . It returned with cost , the analytical optimum (Appendix EC.§ 4.2).
Evaluating the Pointwise Check
A five-variable polyhedral RO program generated by LLM on the 64-model benchmark returned the correct optimum even though it admitted infeasible decisions. Its value matched the reference optimum of and agreed with the original model at both the returned decision and the reference optimizer. At 54 of 205 tested decisions, however, the program and the original model disagreed. For example, the program assigned a finite cost of 10.98 to . Even under zero shock this decision violates original constraint 5, since . In constraint 5, the program added its expression for the worst-case penalty to the left-hand side of the lower-bound constraint. Increasing the auxiliary variables could therefore satisfy the row even when the original decision was infeasible.
As a controlled comparison, we modified each of the 256 benchmark models once to represent a possible reformulation error. The changes replaced a robust constraint by a nominal one, transposed an ellipsoid factor, relaxed moment conditions, or changed a Wasserstein support or transport norm. Of these, 215 differed from the original model in feasibility or cost at some decision, and 211 of those had finite optimal values (Table 10). Comparing optimal values (D0) detected 136. Comparing values or feasibility at the returned decision (D1) detected 103, and testing multiple decisions (D2) detected 181. Among the 74 changes missed by both D0 and D1, D2 detected 55.
| Change | Non-equivalent / total | Finite-optimum cases | D0 | D1 | D2 | D0∪D2 |
| Polyhedral RO, robust constraint made nominal | 48/64 | 48 | 29 | 27 | 44 | 45 |
| Ellipsoidal RO, factor transposed | 49/64 | 49 | 28 | 16 | 23 | 33 |
| Moment DRO, mean equality made an upper bound | 39/39 | 39 | 33 | 30 | 39 | 39 |
| Moment DRO, upper mean bound removed | 19/19 | 19 | 10 | 4 | 19 | 19 |
| Moment DRO, variance bound removed | 6/6 | 2 | 2 | 0 | 2 | 2 |
| Wasserstein DRO, support widened | 36/46 | 36 | 16 | 8 | 36 | 36 |
| Wasserstein DRO, ground norm changed | 18/18 | 18 | 18 | 18 | 18 | 18 |
| Total | 215/256 | 211 | 136 | 103 | 181 | 192 |
Table 10. Controlled model changes detected by optimal-value comparison (D0), the returned decision (D1), and multiple-decision testing (D2).
Testing multiple decisions and comparing optimal values revealed different errors. The optimal-value comparison detected 11 changes missed by D2, bringing their combined count to 192 of 211. This complementarity was particularly clear for ellipsoidal changes, where D2 found 23 of 49, D0 found 28, and together they found 33. Disagreements near a curved feasibility boundary can be hard to sample. In a separate offline comparison across five seeds, boundary bisection detected 40–46 of the 49 ellipsoidal changes within 50 trial decisions, compared with 19–21 for mixed sampling. With 200 trials, bisection detected 48–49 (Appendix EC.4.4).
A check report can also guide a correction even when the decision itself stays the same. In an ellipsoidal portfolio task from the 64-model benchmark, the generated program incorrectly formed the transformed vector as rather than . Its rotated-cone constraints then represented , rather than the required norm . It reported a guarantee of 13.654 at an allocation for which the original model guarantees 13.196. D1 supplied an adverse scenario and D2 flagged 121 of 205 decisions. After two repair rounds, the program used the transposed factor and the correct norm constraints. It returned the same allocation with the corrected guarantee of 13.196 and agreed at all 205 tested decisions.
Across the five LLM configurations on the 64-model set, the first check flagged 93 runs spanning 58 distinct tasks. Of those 93 runs, 26 passed evaluation after one or two repair rounds, including three with reasoning and No memory. Some corrections required revisiting the counterpart itself. In a polyhedral task a scenario violated constraint 5 by 1.17, and the system traced the violation to dual signs and stopped code generation. In a separate continuation we edited the support-function signs, budget-dual scaling, and one-sided-set constraints in the displayed counterpart. The resulting program attained the independently verified optimum (Appendix EC.§ 4.2).
The memory runs used baseline parameters. Separate executable controls examined parameter changes (D2), which exposed four defects missed at the baseline. Appendix EC.4.4 gives these controls, including incomplete comparisons and numerical flags.
The original model used for comparison also matters. In selected IndustryOR cases, the displayed models and their programs shared omissions relative to references independently constructed from the problem descriptions. These omissions escaped comparison with the displayed model but were exposed by the independent reference, including an order using more transport modes than allowed. This illustrates why reformulation checking complements review of the original model against the intended problem (Appendix EC.4.5).
Conclusions
RobustOPT brings model confirmation, mathematical reformulation, solver implementation, and decision revision into one human–AI collaborative system for RO and DRO. Users determine the operational requirements and the treatment of uncertainty, while an LLM assists with formulation, derivation, and coding. The original model, explicit reformulation, and code remain available for inspection and editing as the problem develops.
The three components address different parts of this work. The interactive workflow connects the user’s modeling choices with later revisions to data and fixed decisions. Independently selectable Math and Code memory let users apply mathematical knowledge while specifying the interfaces and solver conventions required by their own code libraries. The pointwise check compares the original model and its reformulation at common decisions, returning evidence that can guide a correction. Together, these components give users control over both the mathematical model and the instructions used to construct its implementation.
The application cases show how changes to uncertainty assumptions affect the solution and how users can reoptimize remaining orders while keeping selected quantities fixed. The experiments show that the memory increased LLM’s evaluation passes with reasoning disabled. This configuration incurred lower token cost and took less time than reasoning alone, which achieved a higher pass rate. In a portfolio case, the pointwise check identified an overstated guaranteed return and guided a correction without changing the optimal allocation.
Future work could integrate review-guided continual learning into the memory module, using accumulated check results and user corrections to refine reusable Math and Code knowledge while retaining human oversight. Methodologically, extending the pointwise check to multistage adaptive problems would require tractable bounds on recourse costs after initial decisions are fixed, as well as broader evaluators for chance constraints and nonconvex losses. More broadly, we aim to develop RobustOPT as a platform for the operations research community by expanding its reviewed memory libraries across uncertainty classes and solver backends, and supporting longitudinal studies of how practitioners and students formulate, audit, and revise decisions under uncertainty.
| Math entry | Code entry | |
| Purpose | Derive the worst-case expression. | Implement that expression in Gurobi. |
| Rule | For and , the largest deviation of is . | Write and , with . Set the bounds of free variables explicitly. |
| Scope | Ellipsoidal RO. | Ellipsoidal RO in Gurobi. |
Table 2 (PDF p. 24). Mathematical and implementation guidance for an ellipsoid.
The examples use static decisions, RO losses of the form , and DRO losses of the form . Here is the nominal center, , , , and . The uncertainty and ambiguity sets are assumed nonempty. The displayed DRO evaluations are LPs for polyhedral support, moment functions, and metrics, and second-order cone programs otherwise. Oracle coverage and attainment conditions are detailed in EC.1.3.
Each configuration was run once per task, including permitted repairs. Cost is the estimated token cost for all 256 tasks. Time is mean elapsed minutes per task.
The first count column gives the number of changes that alter feasibility or cost at some decision out of all changes made. Detection counts use only changed models with finite optima. D2 includes the changed model’s optimizer, four neighbors, available box corners, and 40 further decisions, without the reference optimizer.
Electronic Companion
Proofs, Reference Derivations, and Oracles (Supporting Section 5)
Properties of Records and Pointwise Comparisons
We give the detailed statements and proofs of the two properties used in Section 5, then specify when checking additional decisions subsumes an optimal-value comparison. Throughout, is fixed and omitted where no confusion arises. Feasible points of a finite program have finite objective values. Recall that and for and otherwise, both defined for every .
Proposition 1 (detailed statement). Consider a record and .
(a) Decision equivalence. If is exact for , the two have the same optimal value; maps every optimal solution of to an optimal decision of ; and every optimal decision of at which the infimum in (3) is attained is the image of an optimal solution of .
(b) Reuse and decision fixing. If the record is valid, part (a) holds at every for the retained program . For every restriction of the original decisions alone, such as for , the restricted program is exact for the restricted original model.
(c) Conservative programs. If is only conservative for , every decision it accepts is feasible for and has a true worst-case cost no larger than the reported one, also under the restrictions in (b); the returned decision need not be optimal.
Proof of Proposition 1. (a) Exactness gives on . Since every has , . Let be optimal for and . Then , so and ; thus is optimal for . Conversely, let be optimal for and let attain . Then and , so is optimal for .
(b) For , validity of the record states that is exact for , and part (a) applies. Let be defined by constraints on alone. The restricted program has projected value for and otherwise, because the added constraint does not involve the other program variables. The restricted original problem has feasible set and objective , so its extended value is on and otherwise. Hence the two agree on , which is exactness of the restricted program.
(c) If on and is feasible for with , then , so and . Under a restriction to , on as in (b), so the same holds. That the returned decision need not be optimal is shown by Example 1 at : on , so is optimal for , whereas .
Claims of Example 1. The buyer’s cost is affine in , so its supremum over distributions on is attained by a point mass at an endpoint and equals . The separated program bounds the two surcharges by their own suprema, and , whose sum is 1. Thus on , so the separated program is conservative; it is not exact because . At , on and on , so at , and also has minimum 1 at . At , at , whereas . The two cases differ only in the deterministic premium .
Proposition 2 (detailed statement). Let .
(a) Suppose some with is feasible for . If , or a scenario (or a distribution ) violates a constraint of at or yields a cost above , then is neither exact nor conservative.
(b) If and , and a lower bound satisfies , then is not exact.
Proof of Proposition 2. (a) Since and , . If , then . If for some and , then , so and again . If instead , then . Each case violates both exactness and conservativeness. In DRO, gives for every , and the same argument applies. (b) Exactness would require , a contradiction.
Proposition EC.1 (Conditional inclusion of comparisons). Suppose both problems have finite optimal values, the program is solved exactly with returned decision , and has an optimal decision . Use exact pointwise values and feasibility, with tolerance for finite values and for , where . If the decisions examined by include and , then flags every program that or flags. If examines the baseline parameters with the decisions of , it flags every program that flags.
Proof of Proposition EC.1. D1 compares with the reported value , which is D2’s comparison at . If D0 flags with , its gap satisfies , while optimality of gives . If is infeasible or , D2 flags it directly. Otherwise, define the gap function . It is strictly increasing because . Hence , so D2 flags the finite-value discrepancy at . If D0 flags with , then beyond the same tolerance, because ; D2 flags at . If examines the baseline parameters with the test set of D2, it repeats every comparison of D2.
Reference Derivations for the Four Families
Ellipsoidal RO (walkthrough). Let with , and write with . For any , , attained at for . With , , so the worst-case return is , and the variables , , give the program of Section 3.5. After negating the maximization objective, its projected value equals the negative worst-case return at every feasible , and the program accepts exactly the decisions of the original model, so it is exact whenever . The transpose matters: in general. For the walkthrough data, ; at , while , the incorrect implementation using therefore reports a guaranteed return of 4.06%, whereas the original model guarantees 4.00%, and is the witness. Omitting leaves , which admits and makes the maximization unbounded.
Box and budgeted RO. Consider a row with , , and . Its worst case is , and LP duality gives
which is exact for every . Here and are the multipliers for the budget and coordinate bounds, respectively, and bounds componentwise. One may choose , or simply when . When is at least the number of uncertain coefficients, the budgeted set is the box and is optimal. The endpoint rule for a box replaces by ; it is exact only for , so its record carries the premise that the lower bounds of are nonnegative. For and , the worst case is , whereas the upper endpoints give .
Moment DRO on an interval. Let be scalar, convex piecewise affine in , and . Conic linear duality gives
when and (Slater conditions). The multipliers , , and correspond to normalization, the mean, and the mean absolute deviation bound. For each , the difference of the two sides is piecewise affine in with the single breakpoint , so the semi-infinite constraint holds if and only if it holds at . This yields an LP with constraints whose atoms do not depend on ; the breakpoint of the loss, which may depend on , need not be an atom because the constraints are imposed per affine piece. The dual of this LP is an LP over distributions on , which is how the oracle computes the worst case and its witness. For a vector with box support and coordinatewise mean and mean absolute deviation constraints, each affine-piece inequality separates by coordinate. The corresponding primal LP uses the joint Cartesian grid of these three-point sets; it does not assume independent coordinates.
The mean must be among the atoms. For on with and , the worst case at is , attained by , , : its mean is , its mean absolute deviation is , and . A faulty program omits the mean atom and restricts the distribution to , the endpoints and the loss breakpoint. The mean and normalization conditions, and , give and . The deviation bound then reduces to , so . Its worst-case loss is therefore . This understates the true worst-case cost of , and the distribution above supplies a counterexample under Proposition 2(a). At , by contrast, and the two programs coincide for every , with value for and : an error invisible at one parameter value and visible at another, which is what D targets.
Attainment at a zero-variance boundary. A dual used to replace a worst-expectation constraint must attain its value at the constraint boundary. For , only almost surely is possible, so . The unreduced dual uses a free intercept , a free mean multiplier , and a nonnegative second-moment multiplier . It requires for every . Introducing nonnegative auxiliary variables for the two affine pieces and bounding the dual value by gives
At , these conditions force and simultaneously and . Every is feasible with , , and . Thus the infimum is correct but the projected feasible set excludes . The full-space variance rule applies directly when the variance bounds are strictly positive. For a zero-variance coordinate, the modeler can substitute the mean before applying the rule to the remaining coordinates. This reduction concerns dual attainment. The primal fixed-decision evaluation is given in EC.1.3.
A fixed mean on a curved boundary can cause the same difficulty. On the unit disk, forces almost surely, so . Let be the multiplier on the mean constraint and . Taking the support function over the unit disk, the unreduced mean dual minimizes . Its objective is at least for every finite , but tends to zero along as . Substituting the forced point gives the attained value directly.
Wasserstein DRO of type 1. Let , a norm with dual norm , a polyhedral support containing the samples, and a loss . For ([36]),
Here is the multiplier on the transport budget, is the epigraph variable for sample , and contains the support multipliers for sample and loss piece . Without the support, and the condition becomes . In a scalar inventory problem with order quantity , demand support , overage cost , and shortage cost , the loss has slopes and in . Each unit of transport budget raises the loss at rate when mass moves upward and at rate when it moves downward, and only downward transport is limited by the support. When , upward transport alone can approach the full-space supremum, so the support is inactive and dropping it leaves the value unchanged at every decision; when , downward transport can become worst, the support then bounds it, and dropping it can overstate the worst case. For a single sample at zero, order quantity zero, and radius one, the loss has worst value on the nonnegative support and on the whole line. Removing the support leaves the value at 8 for but changes it from 1 to 8 for .
Lifted representations in modeling packages. A package can represent the same original model through a different but exact program, for example by lifting a piecewise affine loss into auxiliary random variables under an event-wise ambiguity set ([13]). Such a program serves as an independent reference only if its projected value agrees with the compact reformulation at every original decision. Eliminating the lifted variables reduces RSOME’s program for the moment and Wasserstein examples above to the compact LPs. On 44 moment DRO models with polyhedral, budgeted, ball, ellipsoidal, and full-space supports, RSOME’s native formulation and the routines of EC.1.3 agreed in all 132 evaluations, with a largest difference of relative to .
Worst-Case Routines
The routines read the structured representation of the original model. Each coefficient is an expression over the decisions, the uncertain parameters, and the data. These expressions are parsed and evaluated numerically without executing generated code or calling an LLM.
RO. For a constraint or objective affine in , the worst case is computed in closed form for box, budgeted, and ellipsoidal sets (Table 3), by one LP for a polyhedron, and by enumeration for a finite scenario list. The maximizer is the witness. A constraint required to hold for every realization of a DRO model is evaluated in the same way, over the support.
DRO. At a fixed decision , a piecewise linear loss is read from the expression tree as , with at most 4096 pieces. Moment functions may be affine (with , , or ), or or of an affine function (with ). The routine depends on the support .
Convex support. Let be closed and convex, given by bounds, linear rows , a norm ball, or their intersection. For a moment set the worst case is
Here is the probability mass assigned to group , is its unnormalized first moment, and is a lower bound on the group’s contribution to expected loss. The constraint uses the closed perspective of : for it means , and for it means that lies in the recession cone of . Convex moment conditions use perspective constraints. For example, becomes with and . The nonnegativity is necessary also at .
Collapsing the part of a distribution on which group attains to its conditional mean keeps every affine moment, does not increase a convex moment (Jensen’s inequality), and does not lower , because of affine functions is concave; the conditional mean lies in because is convex. At a feasible solution with positive masses, the atoms yield an admissible distribution with expected loss at least . To approximate zero-mass recession terms, choose any admissible distribution with finite first moment and mean . If there are groups, the allocation and is feasible with suitable loss and moment auxiliaries, by Jensen’s inequality. Mix the full feasible solution with this allocation using weight . The resulting masses are positive, convexity preserves feasibility, and the objective converges to its original value as . This establishes equality of the suprema. If every nonzero in an optimal solution has positive mass, the resulting atoms attain the worst case.
For a type-1 Wasserstein ball of radius around with convex support and an , , or metric, the same collapse per sample, which does not increase the convex transport cost, gives
Here is the share of sample assigned to group . For , is the displacement from the new atom to . The atoms , for , carry mass [cf. 36 Theorem 4.4]. Both programs are LPs when , the moment functions, and the metric are polyhedral (solved by HiGHS) and conic programs otherwise (solved by ECOS).
Finite support. The collapse requires convexity: for and , the distribution is admissible, but its conditional mean is not in . For a finite point list the routine therefore does not use the programs above. For a moment set it solves an LP over the probabilities of the listed points, with the moment conditions as linear constraints; for a Wasserstein ball it solves the transport LP from the samples to the listed points. Both are exact, and their solutions are finite worst-case distributions.
One-dimensional supports. For a scalar uncertain parameter on a bounded interval with piecewise affine moment functions, the routine solves an LP over the endpoints and the breakpoints of the loss and moment functions. A quadratic moment upper bound instead uses the convex-support conic program above, even in one dimension. For scalar Wasserstein balls, the transport LP also includes the samples and, on an unbounded interval, variables for transport along an unbounded ray. Structures outside the supported classes are reported as unavailable, never as passed.
Witnesses when the program’s solution has no finite counterpart. If an optimal solution of the convex-support program has with (or with ), that solution does not correspond to a finite distribution: it describes mass sent to infinity along a ray. The value of the program is still the supremum, but a finite witness must satisfy the original distributional restrictions. For Wasserstein DRO, a single far point on the ray would exceed the transport budget. A finite witness for an understatement can instead be a distribution that moves a vanishing share of the sample’s mass a distance proportional to along the ray, which stays within the budget and whose expected loss approaches the value as grows; for example, with , , , and , the distribution has distance 1 and expected loss for . For moment DRO, a finite witness must be checked against all moment conditions. An overstatement in this case is established by bounds, as in Proposition 2(b), with the dual value of the routine’s program as the upper bound.
Validation. At the reference decisions of the 256 benchmark models in § 6.2, the routines reproduced the certified optimal values within an absolute error of . Among 12,288 further decisions, 7,565 had a finite worst case; every returned scenario, distribution, or transport plan satisfied the stated restrictions and attained the returned value. At three further decisions per model, we recomputed the uncertain objectives and rows directly from the raw coefficients by independent methods (an LP in the uncertain coefficients for polyhedral RO, the quadratic form of the shape factor for ellipsoidal RO, a joint-grid LP or RSOME’s native formulation for moment DRO, and a closed form or the support-aware dual for Wasserstein DRO); all 1,728 values agreed within . The median time per decision, including the verification of the witness, was 1.10 ms for polyhedral RO, 0.45 ms for ellipsoidal RO, 0.60 ms for moment DRO, and 1.50 ms for Wasserstein DRO. On the 64 tasks of the memory benchmark, a cutting-plane method that uses only these routines to generate cuts reproduced the optimal values certified by RSOME, with every gap below , where is the cutting-plane lower bound (EC.4.3).
Coverage in the experiments. The workflow evaluation distinguishes constraints on nominal values, constraints that hold throughout the support, and constraints on worst-case expectations. It represents a one-dimensional norm ball as an interval. The historical program study uses the check results obtained for those programs. Section EC.§ 4 describes the model representations and data examined in each study.
Implementation of the Workflow and the Check (Supporting Sections 3 and 5)
Model Representation and Decision Map
Structured representation of the original model. The routines of EC.1.3 read a machine-readable representation of the original model, including the decisions with their domains, the uncertain quantity with its set or ambiguity set, the objective, and the constraints, each marked as nominal, holding for every realization, or holding in expectation. Coefficients are expressions over decision symbols, the uncertain symbol, and the data, so that a change of data flows through without rewriting the model. The LLM drafts this representation from the original mathematical model after user confirmation. The check verifies that the representation refers to the current model and that every datum it uses is bound to a unique input. The routines then evaluate it without an LLM. The decision maker confirms the business facts, and the modeler checks that the structured representation preserves the displayed equations. An omission shared by this representation and the code cannot be found by comparing them.
Numerical implementation. In the interactive workflow, Step 4 uses an LLM-generated implementation prepared with the system’s default solver and Code memory for its numerical comparisons. At Step 5, users can inspect the program, edit it, or request an implementation with their chosen solver and Code memory. The check report applies to the program and solver evaluated. After a change, a fresh check can be requested at Results. In the 40-task complete-input batches, delivery required a completed, unflagged check for the final program (Section EC.§ 4.2). Preparing the representations and revising code use the LLM; the worst-case evaluations and fixed-decision solves do not.
Decision map and fixing. The program declares each original decision as a solver variable, and the decision map records which variable represents which decision. To evaluate the program at , the check sets both bounds of the mapped variables to the requested values in a copy of the model, keeping the program’s own bounds and variable types. A request outside a bound by more than is rejected. For a smaller violation the program uses the bound itself (Section EC.2.5). After the solve, the original bounds are restored. If the map omits a decision, the comparison is incomplete. Certified infeasibility at the same accepted by the original model with finite worst-case cost is a counterexample with in Proposition 2(b). An unbounded fixed program with a valid improving ray witnesses an understatement when the original value is finite.
Checker Procedure and Reports
For each task, the report identifies the applicable levels in Table 5 and the comparisons that completed. Original-model evaluations require the loss, support, moment conditions, and row semantics accepted by the routines in EC.1.3. Execution status may be available even when an original-model comparison is not. D0 requires a supplied reference optimum, and D2 is requested separately from the baseline check.
Trial decisions. D2 tests the returned decision and four neighbors , where the coordinates of are independent draws. It also tests all vertices of the variable box when the bounds are finite and . The random budget ranges from 20 to 300 decisions, with a default of 200. In continuous models with linear deterministic constraints, up to half of the budget is spent on extreme points and convex combinations of points of the deterministic polyhedron. The balance is drawn from the variable box, with integer coordinates rounded and a window of scale (or 1 when is unavailable) for unbounded coordinates. These rounded trials test valid discrete assignments; they do not by themselves detect a program that incorrectly permits fractional decisions. If a share of a trial distribution lies in a region of disagreement beyond tolerance, independent draws from that distribution miss the region with probability . This calculation concerns the independent draws only. The protocol also includes structured decisions.
Trial parameters. D2 tries 20 parameter vectors formed from the data that both the program and the structured representation read, scaling the selected values by independent factors drawn uniformly from and renormalizing empirical probabilities. Vectors that violate a recorded premise are discarded. Structural threshold values, such as a zero radius, are tried separately. Each vector receives a fresh solve, level M, and D2 with 12 random decisions plus the structured points.
Comparison. At each decision, feasibility is compared first, then finite values within . Feasibility uses , scaled by row for deterministic rows. Agreement on infeasibility, incomplete comparisons, and numerical disagreements are counted separately. The first D2 disagreement at the baseline is re-solved with presolve disabled, and both results are stored. This automatic recheck does not rescale constraints or tighten solver tolerances, and does not apply to the parameter trials.
Statuses and certificates. A check ends as flag, no flag, incomplete, or not available. A report records the version of the model and the program, the parameter values, each decision examined, the solver status, the two values, and the available witness or bounds. A numerical disagreement is a verified counterexample only when the witness or separated bounds of Proposition 2 hold at the same decision. Assessing a flag therefore requires checking solver tolerances, scaling, and the decision actually used on each side. One verified counterexample suffices even if other comparisons are incomplete.
Level M
Level M checks that each set is nonempty when the corresponding feasibility problem is available. A decision with a finite extended cost witnesses feasibility. For eligible affine rows, a phase-one LP minimizes a common violation over the decision bounds, using the vertices of the uncertainty set when they are available, and otherwise drops the uncertain rows and uses the deterministic relaxation. Infeasibility, or a strictly positive minimal violation, of a valid relaxation certifies that the original problem is infeasible. A candidate with zero violation in a relaxation still requires checking the uncertain rows and integrality. Without a certificate or a feasible witness, level M reports that feasibility has not been established.
Walkthrough Program
Listing EC.1 shows the model-building part of the allocation program of § 3.5. Fixing leaves the free vector and the nonnegative scalar to be optimized. The coefficient of in row is for the lower Cholesky factor, which implements . The program used to test a transpose error uses instead.
Listing EC.1: Allocation program in Gurobi (model-building excerpt).
L = np.linalg.cholesky(Q) # Q = L L^T
x = m.addVars(n, lb=0.0, ub=1.0, name="x") # original decisions
w = m.addVars(n, lb=-GRB.INFINITY, name="w") # free linking variables
t = m.addVar(lb=0.0, name="t") # deviation, t >= 0
m.addConstr(gp.quicksum(x[j] for j in range(n)) <= 1.0)
for i in range(n):
loading = gp.quicksum(L[j, i] * x[j] for j in range(n))
m.addConstr(w[i] == loading) # w = L^T x
norm_squared = gp.quicksum(w[i] * w[i] for i in range(n))
m.addQConstr(norm_squared <= t * t) # ||w||_2 <= t
nominal_return = gp.quicksum(c[j] * x[j] for j in range(n))
m.setObjective(nominal_return - t, GRB.MAXIMIZE)
Numerical Flags
A flag that disappears on rescaling. For the allocation program at shape matrix and decision , the norm penalty is and the original value is , but the fixed program returned with . Its squared-cone residual, , lies below the feasibility tolerance of , although the objective differs by . Scaling the quadratic row by reduced the difference to , and tightening the solver tolerances with the original scaling reduced it to . The closed-form norm identifies the discrepancy as numerical. This was the only flag among the correct controls in Section EC.4.4.
Decisions at a bound. A requested decision within outside a variable bound can be moved to the bound when the program is fixed, while the original model is evaluated at the requested point. The workflow experiments used this convention. With a steep cost function, the two evaluations can differ even for identical models. In a separate test with identical models, evaluating both costs at the bound removed the discrepancy. This test establishes agreement at the bound only. A counterexample under Proposition 2 requires evidence at a common decision. A decision outside a bound by more than the tolerance remains infeasible in the program.
Re-Solving after a Change
Scenarios. A request at the Results step creates a scenario that records the baseline, each changed datum with the code input it is linked to, and the identities and values of fixed decisions. A datum can be changed only if it is linked to a unique input of the code. Fixing a decision requires locating its solver variable and choosing a value within its bounds. The retained program is executed with the new data and with the bounds of fixed variables set to their values. The original solution remains available if the user discards the scenario.
Premises. Before re-solving, the system evaluates the premises that a built-in catalog records for the original model’s family, for example nonnegative interval half-widths and budget for budgeted RO, a symmetric positive definite shape matrix and nonnegative radius for ellipsoidal RO, and a nonnegative radius and samples inside the support for Wasserstein DRO. A premise that fails, or whose truth cannot be determined from the data, sends the request back for review. Parameters that set the level of protection, such as a budget, a radius, or a variance bound, require the user’s confirmation. Conditions that a derivation relies on beyond the catalog, such as nonnegative decisions for an endpoint rule, appear in the selected rules. The modeler reviews these additional conditions before relying on the revised solution.
Memory (Supporting Section 4)
How the System Selects Entries
Table EC.Table 1 summarizes the information a modeler needs to judge where a rule applies and where it came from. In the experimental entries, conditions and exclusions are written within the rule text rather than stored as separate fields. For an original model, the system retrieves Math entries for the problem family and Code entries for the family and solver. Within that selection, the LLM identifies the rules whose stated conditions fit the model. The model record identifies the library and the entries supplied, so the modeler can trace a derivation even after editing a personal library.
Memory Content and Implementation
System-provided memory. We wrote one Math and one Code entry for each of the four families studied, drawing on textbooks and research papers. The polyhedral RO entry gives the LP dual for an uncertain row and treats the absolute values that arise in budgeted uncertainty with signed decisions. The ellipsoidal RO entry distinguishes a factor matrix from a shape or precision matrix and gives the support function in each case. The two DRO entries describe how moment conditions and restrictions on the support enter a worst-case expectation, and how the ground norm and support multipliers enter a Wasserstein dual. The accompanying Code entries cover Gurobi conventions for free variables, norm epigraphs, and second-order cones. They also tell the modeler which terms to compare after a discrepancy.
| Information | Content |
| Identity and revisions | entry identity and revision history |
| Type | Math for reformulation or Code for implementation |
| Scope | applicable families and subtypes, such as a moment condition or ground norm, and the relevant solver for Code entries. An unrestricted entry applies to all tasks. |
| Rule | mathematical transformation or implementation instruction |
| Conditions | assumptions about the model and data under which the rule applies |
| Exclusions | cases in which the rule must not be applied |
| Source | textbook, published rule, or modeler’s instruction. A Code entry can also identify the Math rule it implements. |
Table EC.1. Information in a memory entry.
Expert rules. For polyhedral and ellipsoidal RO, the comparison library draws on Prompts 2.1, 2.3, and 2.4 of Bertsimas and Margaritis [6]. For moment and Wasserstein DRO, we supplied textbook-based rules. § 6.2 distinguishes results for the published RO guidance from those for our DRO additions.
Checking conditions before a re-solve. The eight experimental entries express their assumptions in the text of the rule. They contain no executable entry-specific tests or separate lists of exclusions. When a parameter changes, the system checks the family conditions described in Section EC.2.6. A failed condition or an affected condition that cannot be evaluated sends the revision back for review. The modeler checks any additional assumptions required by the selected rule.
A Defective Entry and Its Propagation
The omitted bound on a dual variable. The rule concerns type-1 Wasserstein DRO with the metric, so that the dual norm is , and support , so that and in Section EC.1.2. The dual constraints of sample and piece then read and with , where is the epigraph variable of the sample. Writing , they become
The entry kept and but omitted . With the bound, the conditions on are feasible only if , and since the epigraph row is tightest at componentwise. Without it, every is feasible, so can be lowered and the program can understate the worst case. When every slope is nonpositive, as for a loss that does not increase in , the correct condition is also , and the omission is invisible.
Effect on the solution. In an earlier Wasserstein example, the system selected a rule that omitted the upper bound on . The generated equations and solver program both repeated the omission. The program returned . Adding only the 15 missing bounds raised the optimum to . Solving both programs again reproduced the two values without calling the LLM. The defective rule belonged to a different library from the one evaluated in § 6.2.
Applicability of the Experimental Rules
The results in Section 6.2 use the eight entries as originally written. We subsequently clarified their applicability conditions to help users decide when to use or adapt each rule. These clarifications are described below; they do not change the entries used in the reported experiments.
Polyhedral RO. The compact single-budget formula applies to the stated centered perturbations with coordinate bounds. Shifted sets, general absolute-value constraints, or multiple budgets fall outside that formula and require the corresponding support-function dual. For bounds , this dual retains the endpoint coefficients and , even when an interval does not contain zero and one of these coefficients is negative. Deterministic equalities pass through unchanged. An equality required to hold for every uncertain realization instead requires two opposing robust inequalities.
Ellipsoidal RO. The factor-image representation allows a rectangular or rank-deficient matrix, whereas the inverse-quadratic representation requires a positive definite matrix. For a singular shape matrix, the factor-image form avoids an invalid matrix inverse. In either representation, the direction of an explicit minimum or maximum must be read together with the inequality direction.
Moment DRO. The full-space mean–variance rule applies directly with strictly positive variance bounds. For the stated positive-radius ball and ellipsoid templates, an interior mean gives an attained dual. Zero variance bounds or fixed means on curved support boundaries can prevent attainment in an unreduced dual. For example, on the unit disk, forces almost surely. The worst expectation of is zero, while the unreduced support-function dual approaches zero without attaining it. Before using an exact epigraph, zero-variance coordinates are substituted by their means; other boundary cases require reduction or a check of dual attainment.
Wasserstein DRO. The stated type-1 formula applies to a maximum of affine loss pieces and assumes every positive-mass empirical atom lies in the support. It uses the dual of the ground norm and retains all support terms. At zero radius, the worst expectation reduces to the empirical expectation and can be evaluated directly. An explicitly finite support requires a finite-scenario formulation; replacing it by its convex hull can enlarge the ambiguity set.
Experimental Methods and Additional Results (Supporting Section 6)
The workflow experiments used the base LLM with reasoning enabled and No memory. An LLM reviewed the equations and could return them for revision before coding. In the memory experiments this review was advisory, so coding could proceed after an unfavorable assessment. The programs evaluated by the numerical check used the memory and solver configurations specified for each experiment. The independent numerical comparison itself used no LLM. The 64-task and 256-task sets draw on the same four model families but contain separately constructed instances.
Task Construction
The workflow cases cover business descriptions, modeling choices, and post-solve changes. The two model collections vary mathematical structures and dimensions and contain distinct numerical instances.
Workflow cases. The suite combines 32 application cases with eight interaction cases, giving ten per family. The first group comprises sixteen existing and sixteen additional cases covering signed and integer decisions, fractional budgets, correlated perturbations, moment equalities and inequalities, and finite versus continuous support. Paired cases distinguish similar descriptions with different mathematical meanings. For example, E21 and E22 interpret the same numerical matrix as a shape matrix and a precision matrix, respectively; M21 and M22 distinguish an exact mean from a mean upper bound. Table EC.2 lists the coverage.
Each case contains a description, data, mathematical specification, and independently checked reference. Input preparation separates the description and data from the derivation and reference answer. N01–N04 begin with open protection choices for the interaction study; their completed descriptions are used in the 40-case batch. N05–N08 provide larger procurement, generation, inventory, and transport cases with 50, 50, 50, and 80 original decisions. Changes and fixed decisions are specified before the runs. These synthetic cases are selected for coverage.
The 256-model collection. Each family contributes 64 instances. In both RO families, the number of decisions and the number of constraint rows each take the values two, three, four, and five, with sixteen instances at each size. Exactly one expression among the objective and constraint rows is deterministic. The remaining expressions use box, budgeted, or general polyhedral uncertainty in the polyhedral family and ellipsoidal uncertainty in the ellipsoidal family. Decision bounds may allow positive values, negative values, or both. Both minimization and maximization objectives occur.
The DRO objectives take the form
The moment models have two to eight decisions, two to five uncertain coordinates, and two to five affine pieces. Ten combinations of moment information and support occur, each six or seven times: fixed means with box, polyhedral, ball, ellipsoidal, or budgeted support; mean intervals with box, polyhedral, or ellipsoidal support; mean and absolute-deviation bounds with box support; and mean and variance bounds on full space. The Wasserstein models have two to eight decisions, two to six uncertain coordinates, one to four affine pieces, and five to 25 equally weighted samples. They cross three ground norms, , , and , with four supports: full space, the nonnegative orthant, a box, and a polyhedron. Each combination occurs five or six times.
The recorded base seeds are 26102803, 26102813, 26102823, and 26102833 for polyhedral RO, ellipsoidal RO, moment DRO, and Wasserstein DRO, respectively. Reference preparation replaced three ellipsoidal and seven Wasserstein instances whose reference computations were unresolved, using new draws of the same subtype. The retained reference values agree between explicit and native formulations within ; the largest absolute difference is . The numerical arrays used for these calculations also supply the original equations and parameter tables shown to the LLM. Reference values and decisions are excluded from its input.
The mixed 64-model collection. The 64-model collection has 16 instances per family, using separately sampled parameters and larger configurations. Each RO instance has five decisions, five rows, and an uncertain objective. Each polyhedral instance contains at least two general polyhedral rows; each ellipsoidal instance contains four ellipsoidal rows and one deterministic row. Moment models have six to eight decisions, four or five uncertain coordinates, and two to five affine pieces. They combine fixed or interval means, absolute deviations, and variances with box, polyhedral, ball, ellipsoidal, budgeted, or full-space supports. Wasserstein models have six to eight decisions, four to six uncertain coordinates, two to four affine pieces, and 15 to 25 samples. The , , and groups contain six, five, and five cases, respectively, distributed over box, polyhedral, and nonnegative supports.
The generator uses NumPy’s default random-number generator with base seed 26103100 and separate streams indexed by family, task, and candidate draw. For RO, it samples the decision-bound magnitude uniformly from and rounds it to one decimal place. Nominal objective coefficients are drawn on the one-decimal grid from to . Constraint coefficients are drawn on the grid from to , with additional zero coefficients. Right-hand sides are formed around a sampled decision with nonnegative slack. Budgeted perturbations have deviations from to and budget drawn from , where is the number of perturbed coefficients. General polyhedra combine coordinate bounds with one or two linear relations. Ellipsoid factors come from a Cholesky factorization of a rounded matrix , where and the diagonal entries of are uniform on .
For moment DRO, the mean coordinates are uniform on . Supports are constructed around that mean. Box half-widths range from to , absolute-deviation bounds from to , and variance bounds from to . Entries of and are uniform on , and entries of and on . For Wasserstein DRO, empirical samples come from a diagonal normal distribution, with coordinate means uniform on and standard deviations uniform on . Absolute values give the nonnegative-support samples. Box bounds enclose the samples with a margin; polyhedral supports add two inequalities that also contain them. The radius is uniform on , and all loss coefficients are uniform on . Both DRO families use with one or two additional linear inequalities. Their coefficients are rounded to four decimal places, and Wasserstein radii to six.
A candidate is retained only when its reference has a finite objective with magnitude at most , the RSOME decision satisfies the original robust constraints within , and an independent worst-case evaluation reproduces its objective. A cutting-plane lower bound must also close the optimality gap within . The generator permits a new draw when these conditions fail. All 64 retained instances passed on the first draw. The reference computations and rendering of the numerical models use no LLM.
The Workflow Suite
Tasks. Each of the 40 synthetic tasks includes numerical data and a description of the decision and its uncertain inputs (Table EC.2). An independent grader computes a reference optimum and evaluates the returned decisions in the original problem. For N01–N08 an independent program also computes the reference for each revised state. These calculations require no LLM.
Protocol. We ran the workflow with LLM at high reasoning, Gurobi, full review, and No memory. Within an attempt the system allows one retry of the analysis, one retry of a rejected reformulation, two repairs of code that fails to run, and two repairs following a counterexample. A repair supplies the previous output and the diagnostic feedback to the LLM for revision. The system then checks the revised program. A task stops as soon as a solve completes with an unflagged, complete check or uses its maximum of three attempts. The grader reads the reference only after the run. All 40 cases passed on their first attempt without code or check repairs, and the independent grader verified feasibility, cost, and optimality. We also replayed the interactions and recovered the same displayed results in all 40 cases.
Open protection choices. For N01–N04 the experimental inputs comprise an open description followed by a clarification of the protection requirement. N01 specified hard individual bounds with a budget of 1.5, and N02 specified a factor ball of radius 1.6. N03 fixed the means, bounded the variances, and selected the listed finite support. N04 selected twelve planning scenarios as support, ten equally weighted observations, and a mean transport distance of at most 3. All four prompted clarification. N01, N02, and N04 yielded correct models and solutions. In N03 the LLM review identified reversed holding and shortage costs in the original objective and stopped the run. The subsequent user-edit continuation in Table EC.Table 4 corrected that objective and yielded
| Task | Key feature | Task | Key feature | Task | Key feature |
| Polyhedral RO | |||||
| R02 | signed positions; absolute values needed | R04 | integer coverage; robust MILP | R05 | fractional budget |
| R10 | asymmetric coupled polyhedron | R21 | signed net positions, fractional budget | R22 | one shock on supply and limit sides |
| R23 | coupled shocks on three rows | R24 | ten suppliers, 20 decisions, coupled budget | N01 | open choice: box or budget |
| N05 | 50 suppliers; post-solve changes | ||||
| Ellipsoidal RO | |||||
| E01 | spherical ellipsoid; interior solution | E02 | factor , shape , precision | E03 | precision-matrix input |
| E04 | shared shock in coefficients and right side | E21 | matrix read as shape | E22 | same matrix read as precision |
| E23 | signed rows, off-diagonal ellipsoid | E24 | 24 resources, correlated costs | N02 | open choice: joint factor radius |
| N06 | 50 generators; post-solve changes | ||||
| Moment DRO | |||||
| M04 | shifted ellipsoidal shock | M10 | mean and absolute deviation | M11 | joint capacity, coordinatewise deviation |
| M13 | mean and variance on full space | M21 | exact mean | M22 | mean upper bound |
| M23 | one joint distribution for two areas | M24 | 20 items, coupled capacity, deviation | N03 | open choice: exact mean, variance bound |
| N07 | 50 warehouses; post-solve changes | ||||
| Wasserstein DRO | |||||
| W02 | full-space portfolio, metric | W05 | hinge loss, nonnegative support | W07 | box support, large radius |
| W10 | triangular support; mass splitting | W21 | finite candidate support | W22 | convex hull of the same points |
| W23 | nonuniform reference, Euclidean transport | W24 | 24 regions, 32 samples, mass splitting | N04 | open choice: scenario support |
| N08 | 80 lanes; post-solve changes |
Table EC.2. The workflow suite.
an independently verified solution. Thus the initial open-choice runs produced three solutions; completion of N03 required the later edit. In the separate 40-task batch, the descriptions included these choices from the start.
Input and solver controls. The input controls retain stated or recommended modeling choices and supply no additional values when numerical data are missing. Five underspecified inputs prompted clarification. Five invalid inputs prompted correction, including a Wasserstein radius of 0.5 when moving the sample at 2 to support [0, 1] requires distance at least 1. The remaining two controls returned infeasible and unbounded solver statuses, respectively.
Completion and cost. All ten completed-input cases in each family met OA and EP on their first attempt. The 40 cases required 283 model responses at an estimated token cost of $2.51. Mean elapsed time was 8.46 minutes per task and median time was 8.25 minutes.
N02 under two protection requirements. The chosen factor ball gives a protection term of and an optimal worst-case cost of CNY 8,389.46. An offline comparison used independent factor bounds, changing the protection term to . At the allocation chosen for the ball, worst-case cost under the box is CNY 10,335.67. The box-optimal allocation moves 7.77 of the 20 blocks, fills sites C and D, and costs CNY 9,760.62.
Cumulative changes. Each of the 16 requests restated all cumulative changes against the retained baseline. Fixed quantities for groups A and B (ten decisions each) came from the predeclared original case, independent of the new run. Protection changes included from 6.5 to 15.5 in N05, from 1.5 to 4 in N06, and from 0.22 to 0.85 in N08. All four baselines and 16 revised states met their own independent feasibility, objective, and fixed-quantity checks. N05 and N06 reused code at all four states. N07 regenerated all four because the shortage penalties were not exposed as adjustable inputs in the code. The last three states also changed , the variance bound on the operating stress index, which likewise lacked an adjustable input. N08 reused the first state and regenerated the final three because the Wasserstein radius was not exposed as an input. These seven requests returned to the original-model stage and generated new reformulations and programs. They therefore did not test the premises for reusing the baseline program. We evaluated all revised solutions independently. No further pointwise check was requested.
Additional base LLM. GPT-6.1 Sol used medium reasoning and No memory with the same 40 inputs, clarification choices, solver, and stopping rule (Table EC.3). N03 initially produced a reformulation that the coding stage could not read and succeeded on its second attempt. The other 39 tasks succeeded on their first. Three outputs needed format corrections; none required repair after an execution error or a pointwise check.
Some GPT runs resumed after corrections to the workflow implementation. Recorded responses were replayed only when the complete API request matched, including the model, reasoning settings, and prompt. The evaluation used 247 replayed responses and 40 newly generated responses, all from GPT-6.1 Sol with medium reasoning. A separate replay of the 283 DeepSeek responses reproduced the DeepSeek outcomes on the corrected implementation. The 40 new GPT responses covered all seven calls for each of N02 and N05–N08, plus five calls for W10. Across 41 task attempts, the 287 distinct GPT responses comprise 280 calls in successful paths, two format corrections in M24 and W05, and five calls in N03’s unsuccessful first attempt.
Table EC.3 counts each response once at its original token usage and tariff. The GPT estimate of $17.44 includes $13.33 for retained responses and $4.11 for new ones. Local replay incurs no additional API charge and differs from the provider’s input-token caching, whose charges follow the original usage records. The DeepSeek estimate is $2.51. Mean API time sums original call latencies over all evaluated attempts and divides by 40, giving 8.43 minutes for DeepSeek and 3.55 for GPT; local replay time is excluded. The totals exclude 23 additional GPT responses used for implementation diagnostics rather than the evaluated task paths.
Table EC.3: Workflow configurations on the same 40 completed-input cases, both using No memory.
| Model | Reasoning | First-attempt EP | Final EP | Responses | Cost (USD) | API min./task |
| DeepSeek-V4.1-Flash-1017 | high | 40 | 40 | 283 | 2.51 | 8.43 |
| GPT-6.1 Sol | medium | 39 | 40 | 287 | 17.44 | 3.55 |
Table EC.3. Workflow configurations on the same 40 completed-input cases, both using No memory.
Editing and customization. Table EC.4 compares three cases resumed from the point of a user edit, with time measured from that point. In N03 the modeler corrected the displayed objective from to . With reasoning enabled and No memory, the corrected model returned with worst-case cost 42.125. An independent LP over 81 joint outcomes confirmed this value. In the polyhedral case, the modeler edited the reformulation and obtained an optimum of . The revised program passed the external evaluation, including the comparison at the reference decision. In the third case, the analyst added a Code entry to a personal library and retained the system-provided Math entries, with reasoning disabled. The generated code followed the requested builder and model names but omitted the requested prefix in its printed output. One correction to the structure of the generated response preceded the final check.
Table EC.4: Solutions after editing the model, reformulation, or Code memory.
| Continuation | Objective | Completed D2 points | LLM calls | Seconds |
| Personal Code convention | 5.414214 | 205 | 6 | 41.35 |
| N03 original-model edit | 42.125000 | 221 | 5 | 472.93 |
| Polyhedral counterpart edit | 205 | 3 | 43.58 |
Table EC.4. Solutions after editing the model, reformulation, or Code memory.
The Memory Benchmark
Reference calculations. The 64-model collection described in Appendix EC.§ 4.1 uses references computed with RSOME and a cutting-plane method driven by the check’s worst-case routines, which account for mass sent to infinity. All 64 instances satisfied the reference tests. The largest cutting-plane gap relative to was , below , where is the cutting-plane lower bound. The method took 3 to 91 iterations (median 9).
Configurations on the 64-task set. Table EC.5 compares results on the same individual tasks. With reasoning disabled, 42 tasks succeeded only with system-provided memory in its comparison with No memory, and two succeeded only with No memory. For system-provided memory versus expert rules, the corresponding counts were 23 and two. Relative to No memory, expert rules gave 26 gains and seven losses. The breakdown was three gains and seven losses for RO, and 23 gains and no losses for DRO. The comparison library uses published guidance for the two RO families and our extensions for DRO. With reasoning enabled, the total rose from 62 to 63 of 64 when system-provided memory was added. The remaining program was mathematically correct but triggered the numerical flag described below.
| Memory | Reasoning | Polyh. | Ellips. | Moment | Wass. | EP/64 | OA/64 | First flagged | Calls (median) | Cost (USD) | Min./task |
| No memory | off | 2 | 13 | 0 | 0 | 15 | 15 | 45 | 9 | 1.74 | 2.10 |
| Expert rules | off | 1 | 10 | 12 | 11 | 34 | 35 | 32 | 8 | 1.50 | 1.72 |
| System-provided | off | 10 | 15 | 15 | 15 | 55 | 55 | 11 | 4 | 1.03 | 1.20 |
| No memory | on | 16 | 15 | 16 | 15 | 62 | 62 | 3 | 4 | 3.04 | 5.74 |
| System-provided | on | 16 | 16 | 16 | 15 | 63 | 64 | 2 | 4 | 2.54 | 5.20 |
Table EC.5. Configurations on 64 original models, one attempt each. Family columns count evaluation passes out of 16.
Separate 256-task set. Each family contributes 64 models, with two to five decisions in RO and two to eight in DRO. Table 8 compares three guidance choices with reasoning disabled and a fourth configuration with reasoning enabled and No memory. All four use the base LLM, the same implementation, and the same numerical inputs. Two independent formulations, one explicit and one native to the modeling package, were used to check the 256 reference values within . No numerical instance was common to the 64-task and 256-task sets. The controlled-change study uses these same 256 base models, with one deliberate alteration to each model.
Independent selection of Math and Code entries. Table 9 compares four choices on the same 64 tasks with reasoning disabled. The Math-only condition supplies mathematical guidance for the reformulation and any check-guided repair. The Code-only condition supplies implementation guidance when generating the solver program. Both conditions allow one attempt per task, including internal retries, across all 64 tasks. Math-only gave EP = 50 and OA = 51 in 333 calls. Code-only gave EP = 13 and OA = 13 in 553 calls. Mean elapsed time and cost include all 64 tasks. The results for neither and both types of guidance come from the earlier comparison in Table EC.Table 5. We subsequently ran the two single-stage configurations on the same tasks, using a common implementation and the same external grading criteria. Some of the mathematical and coding instructions overlap, so the comparison measures the effect of supplying each group of entries as written.
GPT memory configurations. Table EC.Table 6 compares three GPT-6.1 Terra configurations on the same 64 models. Each used advisory review, the same repair limits, four concurrent tasks, and one attempt per task. All three were evaluated at the reference decision as well as the ordinary trial decisions. System-provided memory was used with reasoning disabled, and No memory was used with medium or high reasoning. The experiment therefore compares complete configurations. In all three, OA = EP. With memory, all 48 RO and moment DRO tasks and 13 of the 16 Wasserstein tasks passed. The remaining three stopped before producing a usable input to the coding stage. With reasoning enabled and No memory, all 64 passed. None of the three configurations triggered a check-guided repair.
| Guidance | Reasoning | EP/64 | Calls | Cost (USD) | Case min./task | API min./task |
| System-provided | none | 61 | 261 | 7.45 | 1.58 | 1.40 |
| No memory | medium | 64 | 256 | 8.09 | 2.58 | 1.92 |
| No memory | high | 64 | 257 | 9.54 | 3.04 | 2.84 |
Table EC.6. GPT-6.1 Terra configurations on 64 models, one attempt per task including permitted repairs.
Case time includes recorded network waits and local computation. API time sums the original latencies of returned model calls. Queue pauses and offline grading are excluded. Waiting for failed requests added 571.87 seconds in the high-reasoning group, 2,466.16 in the medium group, and 541.71 in the system-provided group, summed over all 64 cases in each. For Terra, the rates per миллион tokens were $1 for ordinary input, $0.05 for cache hits, $1.25 for cache writes, and $5 for output. Sol uses twice those rates. Cache-write tokens are excluded from ordinary input, and reasoning tokens are already included in output. The Sol estimates price only the token usage returned by the provider.
External grading and numerical flags. The evaluator constructs the original model from the benchmark arrays, runs S, D1, and D2 with and seed 1, and compares projected values at the reference optimizer. The reference optimizer is available only during external grading. A program passes evaluation when it matches the optimal value and the audit completes without a flag at any tested decision.
Two programs on the 64-task set illustrate different reasons for an audit flag. With expert rules and reasoning disabled, a Wasserstein program matched the optimal value but omitted the box support. At an interior decision it gave 1.1827229, exceeding the independently verified original dual upper bound of 1.1793091. With system-provided memory and reasoning enabled, the only value-matching program that did not pass evaluation had a gap of at one probe, just above tolerance . Turning off presolve restored agreement. The stated scoring rule counts the initial numerical flag and gives EP = 63.
Runtime checks and external evaluation. Table EC.Table 7 partitions the 256 final outcomes for each configuration. We classified a delivery as clear when the solve completed and all requested D2 comparisons finished without a flag. Four clear deliveries failed external grading, three with No memory and reasoning disabled and one with system-provided memory. All four passed their ordinary D2 probes, missed the reference objective tolerance, and disagreed at the reference optimizer. In the system-provided case, a polyhedral RO program reported 20.969268 against 27.711220, a 24.3% difference between reported and reference objectives. This discrepancy measures the error in the reported objective; we did not measure the economic loss from implementing the returned decision. Flags in the other columns include numerical discrepancies that have not been individually adjudicated.
| Memory | Reasoning | EP | Not EP | Flagged | Incomplete | No completed solve |
| No memory | off | 81 | 3 | 43 | 1 | 128 |
| Expert rules | off | 188 | 0 | 19 | 2 | 47 |
| System-provided | off | 241 | 1 | 4 | 0 | 10 |
| No memory | on | 255 | 0 | 0 | 0 | 1 |
Table EC.7. Final outcomes of the 256-task memory runs. The five numeric columns partition each configuration.
The first check was flagged on 148, 88, 21, and zero tasks in these four configurations. After the permitted repairs, 27, 41, nine, and zero of those tasks passed evaluation, respectively. These counts follow each flagged program through repair within the same attempt. Final success totals also include programs whose first checks were incomplete or unavailable. The separate retry comparison below uses eleven cases from the 64-task set.
Actual check coverage. The four 256-task configurations ran the check 409, 379, 282, and 258 times, including rechecks within an attempt. All used the baseline data and requested M, S, D1, and D2. Across these calls, the numbers of completed D2 comparisons were 78,580, 72,983, 57,631, and 53,831, with 7,144, 6,778, 1,856, and 620 requested comparisons reported incomplete. Repeated checks of the same task and decision are counted each time. Restricting to final clear deliveries gives 17,832, 39,580, 51,070, and 53,831 complete comparisons. The external memory evaluation also uses the baseline data and adds the reference decision. Section EC.4.4 evaluates separately on programs with adjustable parameters.
Time and token estimates. Times use elapsed duration of the recorded first attempt for every task, including unsuccessful tasks and automatic repairs. Queue pauses, separate preliminary runs, and offline grading are excluded. In the 256-task runs, total calls are 2,068 without memory or reasoning, 1,596 with expert rules, 1,151 with system-provided memory, and 1,042 with reasoning alone. Total elapsed task times are respectively 489.34, 353.49, 177.83, and 1,452.46 minutes. Cost differences include the number and length of repair calls and reasoning output, not simply the added entry text.
The Check Study
Archived programs. The audit covered 68 workflow and 32 one-request programs. Of 100 programs, 86 solved to optimality and 74 matched the reference objective. The benchmark grader compared values at the reference decision, the returned decision when available, their midpoint, and forty further decisions (usually 43 points, once 42). Among the 74 objective matches, 63 completed without a flag, ten were incomplete, and one was refuted. That moment DRO program reported the optimum 2 at a decision whose original worst-case cost was .
Prior assessments. Before developing the check, the authors assessed the reformulation and code for 32 workflow and 32 one-request programs using the task specifications and references. Among eight assessed as defective, D2 flagged five and was incomplete on three. D0 and D1 each flagged four, together covering the same five. Among the 56 assessed as correct, D2 completed without a flag on 48 and was incomplete on eight.
Controlled changes. The modifications in Table 10 represent omissions or misinterpretations of uncertainty information. They make robust constraints nominal, transpose ellipsoid factors, relax mean or variance conditions, widen supports, or change transport norms. Each design tests the changed model’s optimizer, four Gaussian neighbors, the available box corners, and further decisions from the box and the nominal relaxation. All 256 unchanged copies agreed. The comparison below covers 211 non-equivalent changes with finite optima. It excludes 41 changes classified as equivalent in the controlled study and four changed models without finite optima.
With trial decisions centered on the changed optimizer, D2 detected 181 changes. Centering on the original optimizer gave 175 detections, and combining both sets gave 192. Under the changed-optimizer protocol, 75 changes preserved the optimal value, of which D2 detected 56. Restricting to the 74 changes missed by both D0 and D1 left 55 D2 detections. Combining D0 with D2 detected 192 of 211 changes, with row totals of 45, 33, 19, 29, 36, and 18 in Table 10. This count comprised 102 changes flagged by all three checks, 23 by D0 and D2 only, eleven by D0 only, one by D1 and D2 only, and 55 by D2 only. Nineteen escaped all three checks.
The offline boundary experiment used a policy that bisects the segment from the most recent commonly accepted decision toward a decision rejected by both models, up to twelve times. Over five seeds, it detected 40–46 of the 49 ellipsoidal changes at a budget of 50 decisions, compared with 19–21 for mixed sampling. At 200 decisions it detected 48–49. On the 48 polyhedral changes it detected 40–44, compared with 45–47 for mixed sampling. The workflow runs use the sampling procedure in Section EC.§ 2.2.
Executable controls. Twelve deliberately flawed and seven correct programs were checked at 200 random decisions plus structured points. Where adjustable parameters existed, each program was also tested at 20 random parameter vectors and at specified boundary or structural settings. On the flawed programs, baseline D2 flagged eight. Parameter changes exposed the remaining four. One program reduced an interval support to three points, two removed a sign restriction on a deviation or budget multiplier, and one omitted the nonnegative support. Among the programs flagged at baseline, one matched the intended optimum of 2.5, but its decision (2, 1) violated the displayed model by 1 at . All seven correct programs passed baseline checks. Six had adjustable parameters and passed all 120 random vectors. The only numerical flag among 31 specified settings arose in the ellipsoidal allocation example at 0.01 (Section EC.2.5). Each program took 0.01–6.85 seconds to check.
A sampling miss. Across the five configurations in Table EC.Table 5, one delivered program passed all 205 D2 probes yet failed the external reference criteria. This polyhedral program with system-provided memory and reasoning disabled rejected the reference optimizer and reported −7.6310 against −7.6341. D0 flagged the objective discrepancy. None of the 205 decisions lay in the region that separated the models.
Repair after a flagged comparison. Table EC.Table 8 follows the 93 task–configuration runs of Table EC.Table 5 whose first checked program was flagged, spanning 58 distinct tasks. A program that returned a solution was checked at 205 decisions (the returned one, four neighbors, and 200 random ones). When a program returned no solution, it was checked at the 200 random decisions. In the repair case of § 6.3, D2 flagged 121 of 205 decisions in the first program, the first repair was unbounded at level S and flagged 160 of 200 decisions, and the second repair agreed at all 205. The complete attempt used 15 LLM calls and 7.7 minutes.
| Memory | Reasoning | Flagged | Returned a solution | EP after repair | Still flagged | Other |
| No memory | off | 45 | 38 | 7 | 9 | 29 |
| Expert rules | off | 32 | 19 | 10 | 9 | 13 |
| System-provided | off | 11 | 6 | 5 | 4 | 2 |
| No memory | on | 3 | 2 | 3 | 0 | 0 |
| System-provided | on | 2 | 2 | 1 | 1 | 0 |
| All | 93 | 67 | 26 | 23 | 44 |
Table EC.8. Flagged task–configuration runs and final outcomes within the same attempt.
Returned a solution: the first flagged program solved and returned a decision. Other: the attempt ended without a solved program or with an incomplete check.
Retries with and without diagnostics. We compared one continuation of each kind for the eleven tasks whose first program was flagged with system-provided memory and reasoning disabled (Table EC.Table 5). Both began at the same failure state, with the same previous counterpart, task, memory, numerical stopping checks, and limit of two repair cycles. The comparison removed the D1/D2 diagnostics and previous diagnostic review from the repair prompts. Five tasks passed evaluation with detailed feedback and four without it. Three succeeded in both conditions, two only with detailed feedback, one only without, and five in neither. Replaying the original continuations reproduced all eleven outcomes, and inspection of the new requests confirmed removal of the diagnostics. The comparison covers eleven of the 93 flagged runs, with one continuation per task and condition.
Published Programs for a Deterministic Benchmark
Of the 100 IndustryOR programs released for ORLM-LLaMA-3-8B, 37 reproduced the objective label within relative tolerance , allowing for rounded labels [22]. Against our readings of the problem texts, 22 represented the intended problem and three represented a different one, including a disputed storage-cost interpretation. Of the remaining twelve, ten labels disagreed with our reference, one was disputed, and one problem lacked data [53]. We selected four discrepant programs and three controls to examine the distinction between checking the generated program against the displayed model and checking it against the intended reference .
At the returned decision, four neighbors, and 200 random decisions, all three controls agreed with . Programs 7, 69, 73, and 11 disagreed with on 37, 69, 38, and 19 of 205 decisions, respectively. For example, problem 7 accepted despite a limit of two transport modes. The three separately evaluable displayed models shared their code’s omission and raised no flags at these points. Under uniform perturbations of up to in each numerical parameter, the program and reference optima differed on 59 of 200 instances of problem 69 and five of 198 solvable instances of problem 7.
References
- [1]Ali AhmadiTeshnizi, Wenzhi Gao, and Madeleine Udell. OptiMUS: Scalable optimization modeling with (MI)LP solvers and large language models. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 577–596. PMLR, 2024.arxiv.org/abs/2402.10172
- [2]Ali AhmadiTeshnizi, Wenzhi Gao, Herman Brunborg, Shayan Talaei, Connor Lawless, and Madeleine Udell. OptiMUS-0.3: Using large language models to model and solve optimization problems at scale, 2026. Preprint, arXiv:2407.19633, version 4.arxiv.org/abs/2407.19633
- [3]Saleema Amershi, Dan Weld, Mihaela Vorvoreanu, Adam Fourney, Besmira Nushi, Penny Collisson, Jina Suh, Shamsi Iqbal, Paul N. Bennett, Kori Inkpen, Jaime Teevan, Ruth Kikin-Gil, and Eric Horvitz. Guidelines for human-AI interaction. In Proceedings of the 2019 CHI Conference on Human Factors in Computing Systems, pages 1–13. ACM, 2019.DOI
- [4]Aharon Ben-Tal, Laurent El Ghaoui, and Arkadi Nemirovski. Robust Optimization. Princeton University Press, Princeton, NJ, 2009.
- [5]Aharon Ben-Tal, Dick den Hertog, and Jean-Philippe Vial. Deriving robust counterparts of nonlinear uncertain inequalities. Mathematical Programming, 149(1–2):265–299, 2015.
- [6]Dimitris Bertsimas and Georgios Margaritis. Robust and adaptive optimization under a large language model lens, 2025. Preprint, arXiv:2501.00568.arxiv.org/abs/2501.00568
- [7]Dimitris Bertsimas and Melvyn Sim. The price of robustness. Operations Research, 52(1):35–53, 2004.DOI
- [8]Dimitris Bertsimas, David B. Brown, and Constantine Caramanis. Theory and applications of robust optimization. SIAM Review, 53(3):464–501, 2011.
- [9]Dimitris Bertsimas, Iain Dunning, and Miles Lubin. Reformulation versus cutting-planes for robust optimization. Computational Management Science, 13(2):195–217, 2016.DOI
- [10]Jinbiao Chen, Shuang Jin, Guoyun Zhang, Junyu Zhang, Guanyi Wang, and Hanzhang Qin. Automated reformulation of robust optimization via memory-augmented large language models. In Advances in Neural Information Processing Systems, 2026.arxiv.org/abs/2605.11813
- [11]Tsong Yueh Chen, Fei-Ching Kuo, Huai Liu, Pak-Lok Poon, Dave Towey, T. H. Tse, and Zhi Quan Zhou. Metamorphic testing: A review of challenges and opportunities. ACM Computing Surveys, 51(1):4:1–4:27, 2018.DOI
- [12]Zhi Chen and Peng Xiong. RSOME in Python: An open-source package for robust stochastic optimization made easy. INFORMS Journal on Computing, 35(4):717–724, 2023.DOI
- [13]Zhi Chen, Melvyn Sim, and Peng Xiong. Robust stochastic optimization made easy with RSOME. Management Science, 66(8):3329–3339, 2020.DOI
- [14]Koen Claessen and John Hughes. QuickCheck: A lightweight tool for random testing of Haskell programs. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 268–279, 2000.
- [15]Erick Delage and Yinyu Ye. Distributionally robust optimization under moment uncertainty with application to data-driven problems. Operations Research, 58(3):595–612, 2010.DOI
- [16]Iain R. Dunning. Advances in Robust and Adaptive Optimization: Algorithms, Software, and Insights. PhD thesis, Massachusetts Institute of Technology, 2016.
- [17]Arthur M. Geoffrion. An introduction to structured modeling. Management Science, 33(5):547–588, 1987.DOI
- [18]Joel Goh and Melvyn Sim. Robust optimization made easy with ROME. Operations Research, 59(4):973–985, 2011.DOI
- [19]Bram L. Gorissen, Ihsan Yanıkoğlu, and Dick den Hertog. A practical guide to robust optimization. Omega, 53:124–137, 2015.DOI
- [20]Hussein Hazimeh, Rahul Mazumder, and Ali Saab. Sparse regression at scale: Branch-and-bound rooted in first-order optimization. Mathematical Programming, 196(1–2):347–388, 2022. doi: 10.1007/s10107-021-01712-4.DOI
- [21]Eric Horvitz. Principles of mixed-initiative user interfaces. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, pages 159–166. ACM, 1999.
- [22]Chenyu Huang, Zhengyang Tang, Shixi Hu, Ruoqing Jiang, Xin Zheng, Dongdong Ge, Benyou Wang, and Zizhuo Wang. ORLM: A customizable framework in training large models for automated optimization modeling. Operations Research, 73(6):2986–3009, 2025.DOI
- [23]Dan A. Iancu and Nikolaos Trichakis. Pareto efficiency in robust optimization. Management Science, 60(1):130–147, 2014. doi: 10.1287/mnsc.2013.1753.DOI
- [24]Caigao Jiang, Xiang Shu, Hong Qian, Xingyu Lu, Jun Zhou, Aimin Zhou, and Yang Yu. LLMOPT: Learning to define and solve general optimization problems from scratch. In International Conference on Learning Representations, 2025.arxiv.org/abs/2410.13213
- [25]Minwei Kong, Ao Qu, Xiaotong Guo, Wenbin Ouyang, Chonghe Jiang, Han Zheng, Yining Ma, Dingyi Zhuang, Yuhan Tang, Junyi Li, Shenhao Wang, Haris Koutsoupoulos, Hai Wang, Cathy Wu, and Jinhua Zhao. AlphaOPT: Formulating optimization programs with a self-improving LLM experience library. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD), 2026.arxiv.org/abs/2510.18428
- [26]Connor Lawless, Jakob Schoeffer, and Madeleine Udell. “it was a magical box”: Understanding practitioner workflows and needs in optimization, 2025. URL https://arxiv.org/abs/2509.16402. Preprint, arXiv:2509.16402.
- [27]Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. Retrieval-augmented generation for knowledge-intensive NLP tasks. In Advances in Neural Information Processing Systems, volume 33, pages 9459–9474, 2020.arxiv.org/abs/2005.11401
- [28]Beibin Li, Konstantina Mellou, Bo Zhang, Jeevan Pathuri, and Ishai Menache. Large language models for supply chain optimization, 2023. Preprint, arXiv:2307.03875.arxiv.org/abs/2307.03875
- [30]Zhong Li, Zihan Guo, Xiaohan Lu, Juntao Wang, Jie Song, Chao Shen, Jiageng Wu, and Mingyang Sun. OptArgus: A multi-agent system to detect hallucinations in LLM-based optimization modeling, 2026. Preprint, arXiv:2605.11738.arxiv.org/abs/2605.11738
- [31]Johan Löfberg. Automatic robust convex programming. Optimization Methods and Software, 27(1):115–129, 2012.
- [32]Daniel Zhuoyu Long, Melvyn Sim, and Minglong Zhou. Robust satisficing. Operations Research, 71(1):61–82, 2023. doi: 10.1287/opre.2021.2238.DOI
- [33]Miles Lubin, Oscar Dowson, Joaquim Dias Garcia, Joey Huchette, Benoît Legat, and Juan Pablo Vielma. JuMP 1.0: Recent improvements to a modeling language for mathematical optimization. Mathematical Programming Computation, 15:581–589, 2023. doi: 10.1007/s12532-023-00239-3.DOI
- [34]Ross M. McConnell, Kurt Mehlhorn, Stefan Näher, and Pascal Schweitzer. Certifying algorithms. Computer Science Review, 5(2):119–161, 2011.DOI
- [35]Kaisa Miettinen, Francisco Ruiz, and Andrzej P. Wierzbicki. Introduction to multiobjective optimization: Interactive approaches. In Jürgen Branke, Kalyanmoy Deb, Kaisa Miettinen, and Roman Słowiński, editors, Multiobjective Optimization: Interactive and Evolutionary Approaches, volume 5252 of Lecture Notes in Computer Science, pages 27–57. Springer, Berlin, 2008.DOI
- [36]Peyman Mohajerin Esfahani and Daniel Kuhn. Data-driven distributionally robust optimization using the Wasserstein metric: Performance guarantees and tractable reformulations. Mathematical Programming, 171:115–166, 2018.
- [37]Almir Mutapcic and Stephen Boyd. Cutting-set methods for robust convex optimization with pessimizing oracles. Optimization Methods and Software, 24(3):381–406, 2009.DOI
- [38]Siru Ouyang, Jun Yan, I-Hung Hsu, Yanfei Chen, Ke Jiang, Zifeng Wang, Rujun Han, Long Le, Samira Daruki, Xiangru Tang, Vishy Tirumalashetty, George Lee, Mahsan Rofouei, Hangfei Lin, Jiawei Han, Chen-Yu Lee, and Tomas Pfister. ReasoningBank: Scaling agent self-evolving with reasoning memory. In International Conference on Learning Representations, 2026.arxiv.org/abs/2509.25140
- [39]Charles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E. Gonzalez. MemGPT: Towards LLMs as operating systems, 2023. Preprint, arXiv:2310.08560.arxiv.org/abs/2310.08560
- [40]Amir Pnueli, Michael Siegel, and Eli Singerman. Translation validation. In Tools and Algorithms for the Construction and Analysis of Systems (TACAS 1998), volume 1384 of Lecture Notes in Computer Science, pages 151–166, Berlin, 1998. Springer.DOI
- [41]Hamed Rahimian and Sanjay Mehrotra. Frameworks and results in distributionally robust optimization. Open Journal of Mathematical Optimization, 3:1–85, 2022.DOI
- [42]Rindranirina Ramamonjison, Timothy Yu, Raymond Li, Haley Li, Giuseppe Carenini, Bissan Ghaddar, Shiqi He, Mahdi Mostajabdaveh, Amin Banitalebi-Dehkordi, Zirui Zhou, and Yong Zhang. NL4Opt competition: Formulating optimization problems based on their natural language descriptions. In Proceedings of the NeurIPS 2022 Competitions Track, volume 220 of Proceedings of Machine Learning Research, pages 189–203. PMLR, 2022.arxiv.org/abs/2303.08233
- [43]Hannah Robbins, Connor Lawless, Madeleine Udell, and Ellen Vitercik. FLARE: Verifying MILP reformulations with LLM-based theorem proving, 2026. Preprint, arXiv:2608.25220.arxiv.org/abs/2608.25220
- [44]Jason A. F. Sherman, Natalie M. Isenberg, John D. Siirola, and Chrysanthos E. Gounaris. PyROS: The Pyomo robust optimization solver, 2026. Optimization Online preprint.
- [45]Noah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan, and Shunyu Yao. Reflexion: Language agents with verbal reinforcement learning. In Advances in Neural Information Processing Systems, volume 36, pages 8634–8652, 2023.arxiv.org/abs/2303.11366
- [46]Melvyn Sim, Qinshen Tang, Minglong Zhou, and Taozeng Zhu. The analytics of robust satisficing: Predict, optimize, satisfice, then fortify. Operations Research, 73(5):2708–2728, 2025. doi: 10.1287/opre.2023.0199.DOI
- [47]Ziyu Wang, Zhuolin Wang, Yi Chen, Zhi Chen, and Guodong Lyu. LLMs make robust stochastic optimization easier: An agentic workflow, 2026. Working paper, SSRN 7283098.DOI
- [48]Johannes Wiebe and Ruth Misener. ROmodel: Modeling robust optimization problems in Pyomo. Optimization and Engineering, 23:1873–1894, 2022.arxiv.org/abs/2105.08598
- [49]Jiajeng Wu, Chao Shen, Zihan Guo, Junyan Shao, Zongyan Zhang, Jie Song, Zhong Li, and Mingyang Sun. Fix what’s wrong, keep what’s right: Hallucination repair for LLM-based optimization modeling, 2026. Preprint, arXiv:2610.12529.arxiv.org/abs/2610.12529
- [50]Ziyang Xiao, Dongxiang Zhang, Yangjun Wu, Lili Xu, Yuan Jessica Wang, Xiongwei Han, Xiaojin Fu, Tao Zhong, Jia Zeng, Mingli Song, and Gang Chen. Chain-of-experts: When LLMs meet complex operations research problems. In International Conference on Learning Representations, 2024.
- [51]Weijun Xie. Tractable reformulations of two-stage distributionally robust linear programs over the type-∞ Wasserstein ball. Operations Research Letters, 48(4):513–523, 2020. doi: 10.1016/j.orl.2020.06.003.DOI
- [52]Qizheng Zhang, Changran Hu, Shubhangi Upasani, Boyuan Ma, Fenglu Hong, Vamsidhar Kamanuru, Jay Rainton, Chen Wu, Mengmeng Ji, Hanchen Li, Urmish Thakker, James Zou, and Kunle Olukotun. Agentic context engineering: Evolving contexts for self-improving language models. In International Conference on Learning Representations, 2026.arxiv.org/abs/2510.04618
- [53]Xinzhi Zhang, Zevi Chen, Humishka Zope, Hugo Barbalho, Konstantina Mellou, Marco Molinaro, Janardhan Kulkarni, Ishai Menache, and Sirui Li. OptiMind: Teaching LLMs to think like optimization experts, 2025. Preprint, arXiv:2509.22979.
- [54]Andrew Zhao, Daniel Huang, Quentin Xu, Matthieu Lin, Yong-Jin Liu, and Gao Huang. ExeL: LLM agents are experiential learners. Proceedings of the AAAI Conference on Artificial Intelligence, 38(17):19632–19642, 2024.arxiv.org/abs/2308.10144
- [55]Penglin Zhu and Jungang Xu. ModelEquivBench: Certifying multi-relational evaluation of LLM-generated optimization models, 2026. Preprint, arXiv:2607.29431.arxiv.org/abs/2607.29431
- [56]Taozeng Zhu, Jingui Xie, and Melvyn Sim. Joint estimation and robustness optimization. Management Science, 68(3):1659–1677, 2022. doi: 10.1287/mnsc.2020.3898.DOI
- [57]Wenzhuo Zhu, Zheng Cui, Wenhan Lu, Sheng Liu, and Yue Zhao. DAOpt: Modeling and evaluation of data-driven optimization under uncertainty with LLMs, 2025. Preprint, arXiv:2511.11576.arxiv.org/abs/2511.11576