Harnessing Language Models as Optimization Modeling Agents
Organizations: The Hong Kong University of Science and Technology · Huawei
Abstract
Large language models (LLMs) can translate natural-language optimization problems into solver programs, but reliably producing correct formulations and implementations remains challenging. Existing approaches improve optimization modeling through agentic workflows or task-specific post-training. This raises a practical question: can a lightweight harness using a single model role achieve competitive performance without additional training? We introduce OPTICYCLE and OPTISTATE, two lightweight inference harnesses for optimization modeling, and evaluate them on nine benchmarks comprising 2,634 problems using 11 Qwen variants spanning 0.6B-27B parameters. Our results show that execution-guided revision consistently improves macro accuracy over direct generation for all evaluated models, with gains of up to 49.46 percentage points. Despite their simplicity, both harnesses outperform six adapted agentic workflows in same-model comparisons and four evaluated post-trained optimization models at comparable model sizes, without additional training. Explicit formulation state provides further but model-dependent improvements, suggesting that additional structure is not universally beneficial.
Figures & tables
| Method | Complex OR | Industry OR | Opti Bench | MAMO easy | MAMO complex | NL4Opt | NLP4LP | OptMath | ICML Comp. | Macro |
| avg@64 | avg@16 | avg@4 | avg@4 | avg@8 | avg@8 | avg@8 | avg@8 | avg@8 | Avg. | |
| Qwen3-4B | ||||||||||
| Direct Generation | 29.08 | 33.88 | 54.38 | 80.06 | 27.61 | 72.45 | 72.88 | 9.41 | 72.62 | 50.26 |
| CAFA | 46.09 | 35.06 | 60.79 | 79.49 | 30.15 | 79.24 | 69.16 | 11.14 | 76.77 | 54.21 |
| Reflexion | 43.84 | 25.50 | 50.99 | 82.52 | 13.27 | 77.17 | 70.71 | 7.15 | 70.52 | 49.07 |
| Chain-of-Experts | 28.30 | 23.31 | 48.84 | 71.09 | 6.93 | 71.25 | 72.68 | 4.14 | 65.12 | 43.52 |
| Model | direct | OptiCycle | OptiState |
|---|---|---|---|
| Qwen3-0.6B | 0.06% | 0.01% | 0.01% |
| Qwen3-1.7B | 2.93% | 13.28% | 26.79% |
| Qwen3-4B | 50.26% | 62.74% | 64.22% |
| Qwen3-8B | 58.01% | 65.49% | 65.00% |
| Qwen3-14B | 17.53% | 66.99% | 66.38% |
| Qwen3.5-0.8B | 0.00% | 2.48 % | 0.71% |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Benchmark | Trajectories per problem ( ) |
|---|---|
| ComplexOR | 64 |
| IndustryOR | 16 |
| OptiBench | 4 |
| MAMO-easy | 4 |
| MAMO-complex | 8 |
| NLP4LP | 8 |
| Method | Adapted procedure | Budget |
|---|---|---|
| Direct Generation | Generate a complete solver program and execute it once. | One model call |
| CAFA | Use compact OR-specific prompting and examples. | One model call |
| Reflexion | Generate tests and an initial program, execute it, reflect on the observations, and revise. | At most one revision |
| Chain-of-Experts | A conductor selects three of seven expert types; a reducer combines their outputs. | Three experts and a reducer |
| OptiMUS | A manager schedules Formulator, Programmer, and Evaluator roles over structured state. | At most ten scheduling steps |
| AutoFormulation | Use UCT search over parameters, variables, the objective, equalities, and inequalities. | Eight search steps; branching factor three |
| Method | Complex OR | Industry OR | OptiBench | MAMO easy | MAMO complex | NLP4LP | NL4Opt | ICML Comp. | OptMath | Macro |
|---|---|---|---|---|---|---|---|---|---|---|
| avg@64 | avg@16 | avg@4 | avg@4 | avg@8 | avg@8 | avg@8 | avg@8 | avg@8 | Avg. | |
| Qwen3-0.6B | ||||||||||
| Direct Generation | 0.00 | 0.12 | 0.04 | 0.00 | 0.18 | 0.05 | 0.00 | 0.00 | 0.15 | 0.06 |
| OptiCycle | 0.00 | 0.06 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.01 |
| OptiState | 0.00 | 0.00 | 0.04 | 0.04 | 0.00 | 0.00 | 0.05 | 0.00 | 0.00 | 0.01 |
| Qwen3-1.7B | ||||||||||
| Method | Complex OR | Industry OR | OptiBench | MAMO easy | MAMO complex | NLP4LP | NL4Opt | ICML Comp. | OptMath | Macro |
|---|---|---|---|---|---|---|---|---|---|---|
| avg@64 | avg@16 | avg@4 | avg@4 | avg@8 | avg@8 | avg@8 | avg@8 | avg@8 | Avg. | |
| Qwen3.5-0.8B | ||||||||||
| Direct Generation | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 | 0.00 |
| OptiCycle | 0.43 | 0.31 | 2.73 | 8.82 | 0.00 | 3.31 | 3.21 | 3.29 | 0.23 | 2.48 |
| OptiState | 0.17 | 0.00 | 0.74 | 2.80 | 0.06 | 0.72 | 0.82 | 1.07 | 0.00 | 0.71 |
| Qwen3.5-2B | ||||||||||
Large Language Model-Guided Optimization
Large Language Model-Guided Optimization uses language models to propose, steer, and refine solutions to hard search and design problems.
See all 600 papers