OptiRepair: Closed-Loop Diagnosis and Repair of Supply Chain Optimization Models with LLM Agents
Organizations: Massachusetts Institute of Technology. · Alibaba Group.
Abstract
Supply chain optimization models frequently become infeasible because of modeling errors. Diagnosis and repair require scarce OR expertise: analysts must interpret solver diagnostics, trace root causes across echelons, and fix formulations without sacrificing operational soundness. Whether AI agents can perform this task remains untested. We decompose this task into two phases: a domain-agnostic feasibility phase that iteratively repairs any LP using IIS-guided diagnosis, and a domain-specific validation phase that enforces five rationality checks grounded in inventory theory. We test 22 API models from seven families on 976 multi-echelon supply chain problems and train two 8B-parameter models with self-taught reasoning and solver-verified rewards. The trained models reach 81.7% Rational Recovery Rate (RRR) -- the fraction of problems resolved to both feasibility and operational rationality -- versus 42.2% for the best API model and 21.3% on average. The gap concentrates in Phase 1 repair, where API models average 27.6% recovery rate versus 97.2% for trained models. Two gaps separate current AI from reliable model repair: solver interaction, as API models restore only 27.6% of infeasible formulations; and operational rationale, as roughly one in four feasible repairs violate supply chain theory. Each gap requires a different intervention -- targeted training closes the solver interaction gap, while explicit specification as solver-verifiable checks closes the rationality gap. For organizations adopting AI in operational planning, formalizing what 'rational' means in their context is the higher-return investment.
Figures & tables
| Configuration | RRR |
|---|---|
| Trained 8B pipeline (best) | 81.7% |
| Best API (GPT-5.2 / Gemini 2.5 Pro) | 42.2% |
| Average API (22 models, 7 families) | 21.3% |
| Framework | Task | Oracle | Multi-step | Self-Corr. | Rationality |
|---|---|---|---|---|---|
| NL4Opt ( Ramamonjison et al., 2023 ) | NL LP | — | — | — | — |
| OptiBench ( Yang et al., 2024 ) | Formulation | — | — | — | — |
| MAMO ( Huang et al., 2024 ) | Complex LP | — | — | — | — |
| ORLM ( Huang et al., 2025 ) | Formulation | — | — | — | — |
| LEAN-LLM-OPT ( Liang et al., 2026 ) | Formulation | Solver | ✓ | — | — |
| AIM-Bench ( Zhao et al., 2025 ) | Inventory | Closed-form | — | — | ✓ |
| Type | Error Name | Operational Meaning | Difficulty |
|---|---|---|---|
| ME-1 | Demand Inflation | Overstated downstream demand | Hard |
| ME-2 | Lead Time Error | Misspecified replenishment lead time | Hard |
| ME-3 | Balance Violation | Impossible inventory balance state | Easy |
| ME-4 | Capacity Reduction | Production capacity below demand | Hard |
| ME-5 | Cost Structure Error | Non-monotonic holding costs | Easy |
| ME-6 | Bullwhip Amplification | Forced upstream order amplification | Medium |
| # | Model | RR | RRR | P2Pass | Steps | # | Model | RR | RRR | P2Pass | Steps |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | GPT-5.2 | 53.5 | 42.2 | 79.0 | 14.0 | 12 | Claude Haiku 4.5 | 20.8 | 19.0 | 91.5 | 7.4 |
| 2 | Gemini 2.5 Pro | 53.9 | 42.2 | 78.4 | 9.3 | 13 | GPT-o3 | 19.7 | 19.0 | 96.4 | 7.5 |
| 3 | DeepSeek-R1-0528 | 53.2 | 37.0 | 69.5 | 13.8 | 14 | GPT-4.1 | 18.0 | 17.6 | 98.0 | 5.9 |
| 4 | Gemini 2.5 Flash | 45.1 | 32.0 | 71.1 | 9.5 | 15 | GPT-4.1 Mini | 17.2 | 17.2 | 100.0 | 6.6 |
| 5 | Qwen2.5-7B | 41.2 | 31.0 | 75.2 | 8.1 | 16 | GPT-5 Mini | 18.7 | 16.9 | 90.6 | 6.8 |
| 6 | Claude Opus 4.5 | 33.5 | 30.3 | 90.5 | 16.6 | 17 | GPT-o1 | 14.9 | 13.5 | 90.5 | 4.4 |
| Model | Arch. | P1 RR | RRR | ME-2 | ME-4 | ME-5 | Steps | Tokens |
|---|---|---|---|---|---|---|---|---|
| Qwen3-8B ( OptiSTaR ) | Qwen | 97.2 | 81.7 | 64.5 | 61.3 | 100.0 | 5.2 | 3,439 |
| Llama-3.1-8B ( OptiSTaR ) | Llama | 97.2 | 80.3 | 67.7 | 74.2 | 100.0 | 4.3 | 3,180 |
| Best API (GPT-5.2) | — | 53.5 | 42.2 | 41.9 | 38.7 | 100.0 | 14.0 | 20,730 |
| Avg. API (22 models) | — | 27.6 | 21.3 | 3.7 | 4.7 | 87.3 | 7.8 | 30,078 |
| P1 Model | P2 Model | P1 RR (%) | RRR (%) |
|---|---|---|---|
| Qwen3-8B pipeline (8B) | |||
| Qwen3-8B OptiSTaR | Qwen3-8B P2 OptiSTaR | 97.2 | 81.7 |
| Qwen3-8B OptiSTaR | Claude Opus 4.5 | 97.2 | 69.4 |
| Qwen3-8B OptiSTaR | GPT-5.2 | 96.8 | 68.7 |
| Claude Opus 4.5 | Qwen3-8B P2 OptiSTaR | 55.6 | 45.1 |
| GPT-5.2 | Qwen3-8B P2 OptiSTaR | 63.0 | 55.6 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Type | Injection Mechanism | IIS Signature | Difficulty |
|---|---|---|---|
| ME-1 | Add systematic offset ( – demand mean) to demand propagation at one echelon | Multiple demand_prop constraints + capacity bounds | Hard |
| ME-2 | Remove arrival term from all inventory balance constraints at target echelon | Multiple inv_balance constraints + backorder caps | Hard |
| ME-3 | Force net inventory ( ) to value below achievable minimum | Single inv_balance constraint with impossible target | Easy |
| ME-4 | Set order capacity to – demand mean at retailer | Multiple capacity constraints + inventory balance | Hard |
| ME-5 | Inflate upstream holding cost to – downstream cost | None ( Optimal but irrational); detected by rationality oracle | Easy |
| ME-6 | Add constraints forcing exceeding capacity | Multiple bullwhip_force constraints + supply cap | Medium |
| Error | Base-stock | Bullwhip | Inv. alloc. | Cost consist. | Order smooth. | Exclusion rationale |
|---|---|---|---|---|---|---|
| ME-1 | ✓ | – | ✓ | ✓ | – | Demand inflation creates legitimate order variance |
| ME-2 | ✓ | – | ✓ | ✓ | – | Lead-time repair creates legitimate order variance |
| ME-3 | ✓ | – | ✓ | ✓ | – | Balance repair creates legitimate order variance |
| ME-4 | ✓ | – | ✓ | ✓ | – | Capacity change creates legitimate order variance |
| ME-5 | – | – | – | ✓ | – | Cost-only error; cost consistency detects the root cause |
| ME-6 | – | – | – | – | ✓ | Bullwhip error; only order smoothing is artifact-free |
| Model | ME-1 | ME-2 | ME-3 | ME-4 | ME-5 | ME-6 | ME-7 | ME-8 | ME-9 | ME-10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Qwen3-8B (trained) | 85.2 | 64.5 | 96.7 | 61.3 | 100 | 89.3 | 91.7 | 88.0 | 96.4 | 86.7 |
| Llama-3.1-8B (trained) | 81.5 | 67.7 | 93.3 | 74.2 | 100 | 85.7 | 87.5 | 84.0 | 92.9 | 83.3 |
| GPT-5.2 | 7.4 | 41.9 | 73.3 | 38.7 | 100 | 7.1 | 50.0 | 36.0 | 57.1 | 6.7 |
| Gemini 2.5 Pro | 0.0 | 6.5 | 63.3 | 6.5 | 100 | 60.7 | 50.0 | 60.0 | 57.1 | 23.3 |
| DeepSeek-R1 | 3.7 | 12.9 | 76.7 | 9.7 | 100 | 0.0 | 58.3 | 60.0 | 42.9 | 10.0 |
| Gemini 2.5 Flash | 0.0 | 3.2 | 66.7 | 9.7 | 100 | 21.4 | 41.7 | 44.0 | 21.4 | 13.3 |
| Rank | Model | ME-1 | ME-2 | ME-3 | ME-4 | ME-5 | ME-6 | ME-7 | ME-8 | ME-9 | ME-10 | Overall |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | GPT-5.2 | 7.4 | 41.9 | 73.3 | 38.7 | 100 | 7.1 | 50.0 | 36.0 | 57.1 | 6.7 | 42.2 |
| 2 | Gemini 2.5 Pro | 0.0 | 6.5 | 63.3 | 6.5 | 100 | 60.7 | 50.0 | 60.0 | 57.1 | 23.3 | 42.2 |
| 3 | DeepSeek-R1-0528 | 3.7 | 12.9 | 76.7 | 9.7 | 100 | 0.0 | 58.3 | 60.0 | 42.9 | 10.0 | 37.0 |
| 4 | Gemini 2.5 Flash | 0.0 | 3.2 | 66.7 | 9.7 | 100 | 21.4 | 41.7 | 44.0 | 21.4 | 13.3 | 32.0 |
| 5 | Qwen2.5-7B | 40.7 | 0.0 | 66.7 | 9.7 | 90.0 | 3.6 | 29.2 | 36.0 | 0.0 | 33.3 | 31.0 |
| 6 | Claude Opus 4.5 | 3.7 | 6.5 | 70.0 | 3.2 | 100 | 35.7 | 37.5 | 20.0 | 25.0 | 0.0 | 30.3 |
| Parameter | Range | Distribution |
|---|---|---|
| Number of echelons | Uniform | |
| Planning periods | Uniform | |
| Topology | Serial | Fixed |
| Holding cost | per unit/period | Uniform |
| Backorder cost | per unit/period | Uniform |
| -to- ratio | to | Derived |
| Train | Test | Total | |
| Total problems | 692 | 284 | 976 |
| ME-1 (Demand Inflation) | 78 | 27 | 105 |
| ME-2 (Lead Time Error) | 89 | 31 | 120 |
| ME-3 (Balance Violation) | 87 | 30 | 117 |
| ME-4 (Capacity Reduction) | 89 | 31 | 120 |
| ME-5 (Cost Structure Error) | 71 | 30 | 101 |