Developer Tools

IR2Solve autoformulates optimization problems with 1 LLM call, 22.9x fewer tokens

One semantic LLM call replaces 39-call agent workflows in optimization modeling

Deep Dive

IR2Solve, from Penglin Zhu and colleagues, tackles a core problem in applying LLMs to operations research: turning natural-language optimization problems into machine-readable solver formulations. Direct code generation is brittle — models often produce schema errors, bad indices, or infeasible constraints. Iterative repair and multi-agent approaches fix this but at high inference cost. IR2Solve's key idea is a structured intermediate representation (ModelIR) that explicitly encodes sets, parameters, variables, objectives, and constraints using restricted Python-like expressions. After a single semantic LLM call produces this IR, two deterministic stages — verification and IR-to-solver compilation — handle the rest, eliminating costly LLM-driven error correction.

In benchmarks across six optimization problem sets, IR2Solve achieves strong objective correctness, staying competitive with existing autoformulation systems. A controlled ablation on 153 IndustryOR and ComplexLP instances isolates the gains from the structured IR interface, scalar-constraint instructions, and deterministic verification. Most striking are the efficiency numbers: on a ten-instance cost panel, IR2Solve uses exactly one semantic call per problem, while Chain-of-Experts and SAC-Opt require 8 and 39 calls, consuming 3.3x and 22.9x more tokens respectively. This accuracy-cost trade-off suggests structured intermediate representations plus deterministic post-processing offer a practical path to scalable LLM-based optimization modeling.

Key Points
  • IR2Solve uses 1 semantic LLM call per optimization problem vs. 8 (Chain-of-Experts) and 39 (SAC-Opt) baseline calls
  • Token consumption is 3.3x lower than Chain-of-Experts and 22.9x lower than SAC-Opt on matched instances
  • ModelIR explicitly represents sets, parameters, variables, objectives, and constraints, enabling deterministic verification and compilation for solver-ready output

Why It Matters

Slashes LLM inference costs for optimization modeling while keeping accuracy, making autoformulation practical for real-world ops research.

📬 Get the top 10 AI stories daily