Manuscript Offprint

arXiv:2610.30917

Harnessing Language Models as Optimization Modeling Agents

Yunxiang Luo, Xin Xu, Tianhao Chen, Zhixi Xiong, Peiqi Jiang, Fan Zhang, Wei Shao, Xuejian Gao, Yuwei Fan, Can Yang

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. Despite the simplicity, both harnesses outperform six adapted agentic workflows under 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.

1 Introduction

Operations research (OR) provides a principled foundation for decision-making in resource-constrained settings, with optimization models supporting applications such as supply-chain management and transportation (Dantzig, 1963; Hillier et al., 1995). In practice, an optimization problem often begins as a natural-language description of the decision context, available resources, and desired outcomes. Translating this description into a correct optimization model requires identifying decision variables, an objective, and constraints while preserving the semantics of the original problem (Ramamonjison et al., 2023). Natural-language optimization modeling therefore connects language understanding, mathematical formulation, and executable problem solving.

Large language models (LLMs) offer a way to automate this translation from problem descriptions to executable optimization models. Existing approaches pursue two complementary directions. One organizes inference through specialized agents or stages for formulation, coding, and debugging (Xiao et al., 2024; AhmadiTeshnizi et al., 2024). The other treats it as a reasoning task and develops domain-specific capabilities through supervised fine-tuning (SFT) or reinforcement learning (RL) (Huang et al., 2025; Chen et al., 2025). The two directions differ in whether they modify the inference workflow or the model parameters.

Agentic post-training further connects model capabilities with the systems surrounding them: models can be trained to use tools and interact with environments (Kimi Team, 2025; GLM-4.5 Team, 2025), but the opportunities to exercise these capabilities depend on the inference procedure. The same frozen LLM can act as a direct generator or repeatedly execute and revise a solver program. An inference harness is the layer that organizes an LLM's tools, context, state, and control flow (Meng et al., 2026). Comparisons across optimization systems are difficult to interpret when backbones, benchmarks, inference procedures, and grading protocols all differ. This motivates our central question: how do different harnesses shape the optimization-modeling performance of a frozen LLM, and when does explicit formulation state add value?

In this paper, we study this question through a unified harness view of optimization modeling (Figure 1). Direct Generation is the single-step setting: the model produces a solver program without an opportunity to revise it after execution.

∗^{*}Equal contribution.

†^{\dagger}Correspondence: macyang@ust.hk

Figure

Figure 1: Three inference interfaces for the same frozen model. OptiCycle adds execution feedback and persistent Python state; OptiState additionally maintains a revisable five-element formulation. The hidden grader evaluates submitted answers and provides no feedback during inference.

We design two OR-oriented harnesses for interactive modeling. OPTICYCLE organizes code generation, solver execution, feedback interpretation, and revision into a cycle within a persistent Python environment. OPTISTATE adds a structured and revisable formulation comprising sets, parameters, variables, the objective, and constraints. This state makes intermediate modeling decisions explicit and available for reconsideration during subsequent interaction. Both harnesses use a single model role with frozen weights; reference answers remain hidden, and grading occurs only after submission.

We evaluate these settings on nine benchmarks comprising 2,634 problems and 11 Qwen variants from 0.6B to 27B parameters. OPTICYCLE improves Qwen3.5-9B macro accuracy by 18.74 percentage points over Direct Generation. In a shared-backbone comparison with six adapted OR workflows, it achieves 62.74% on Qwen3-4B and 65.21% on Qwen3.5-9B, exceeding the strongest competing baselines by 8.53 and 4.29 percentage points, respectively. These comparisons share the backbone and evaluation protocol while retaining method-specific inference budgets.

Our contributions are as follows:

• A unified harness view of optimization modeling for LLMs. We compare direct generation, execution-guided revision, and formulation-state-guided revision while keeping model weights fixed.

• Two simple and effective modeling harnesses. OPTICYCLE enables iterative code execution and repair, while OPTISTATE adds a revisable representation of the optimization formulation.

• Comprehensive evaluation across diverse benchmarks and baselines. We evaluate 11 Qwen variants on nine benchmarks containing 2,634 problems and compare against six adapted workflows under shared backbones and grading.

• An analysis of effectiveness and cost. Execution-guided revision produces broad gains, whereas formulation state provides model-dependent benefits at higher token consumption.

References (29)