Automating Natural Language to Mathematical Optimization Formulation

49 concepts46 papers1 proposal

Mathematical optimization is one of the most powerful tools in industrial engineering, logistics, and resource management. Solvers like Gurobi or CPLEX can find optimal schedules, supply chain routes, and factory allocations in seconds. However, these solvers are entirely unforgiving: they require inputs to be specified in rigid, low-level mathematical formats, such as matrices or precise algebraic constraints.

In the real world, problems do not arrive as equations; they arrive as messy, ambiguous natural language descriptions from business stakeholders or factory floor managers. Bridging this gap requires highly specialized human experts who understand both the domain context and mathematical programming. This mismatch creates a severe formulation bottleneck, preventing organizations from leveraging optimization at scale.

To eliminate this barrier, a major research direction has emerged: automating the translation of informal natural language descriptions into formal, solver-ready mathematical optimization models.

The Two-Stage Translation Problem

To understand why automating this process is difficult, it helps to break the translation down into two distinct stages:

$$\text{Natural Language Description} \xrightarrow{\text{Stage 1}} \text{Abstract Mathematical Model} \xrightarrow{\text{Stage 2}} \text{Low-Level Solver Code}$$

Stage 2: Compiling Math to Code

The second stage—moving from abstract mathematics (like objective functions and constraints) to low-level solver matrices—is largely a solved problem. Historically, writing low-level code for specialized solvers was tedious and error-prone, as noted by the authors of JuMP: A Modeling Language for Mathematical Optimization. To fix this, researchers built algebraic modeling languages and compilers. For instance, Akshay Agrawal et al. developed a modular rewriting system for CVXPY (A rewriting system for convex optimization problems) that uses "reductions" to automatically compile high-level, human-readable optimization problems into rigid solver formats.

Subsequent work extended these compilers to handle increasingly complex mathematical constructs. Alnur Ali et al. introduced a framework to automate the tedious verification and translation of stochastic constructs like expectations and chance constraints (Disciplined Convex Stochastic Programming: A New Framework for Stochastic Optimization). Similarly, Francesco Ceccon et al. created OMLT: Optimization & Machine Learning Toolkit to automate the labor-intensive process of embedding trained machine learning models as constraints within larger optimization problems.

Stage 1: The Modern Frontier (Text to Math)

While Stage 2 has been successfully compiled into software libraries, Stage 1—moving from unstructured text to abstract mathematics—remained a manual bottleneck. As Yaochu Jin argues in Evolutionary Optimization of complex Systems in Uncertain Environments, the initial phase of defining decision variables and objective functions presents a much greater practical hurdle than the optimization itself.

Large Language Models (LLMs) offer a potential bridge for this "last mile" of operations research. As envisioned by Segev Wasserkrug et al. in Enhancing Decision Making Through the Integration of Large Language Models and Operations Research Optimization, an LLM-powered copilot could allow non-experts to express high-level business requirements in natural language, which the system then converts into mathematically sound formulations and executable solver code.

Why General LLMs Fail at Autoformulation

If you hand a complex word problem to a standard, off-the-shelf LLM and ask it to write the optimization code, it will frequently fail. In A Survey of Optimization Modeling Meets LLMs: Progress and Future Directions, Ziyang Xiao et al. revealed that existing benchmarks for this task contained massive error rates, highlighting a fundamental gap between linguistic understanding and formal logic.

The failure occurs because optimization modeling requires an extreme level of precision and structural alignment:

Grounding LLMs via Solver-in-the-Loop Architectures

To overcome these failures, modern research has shifted away from single-prompt generation toward solver-in-the-loop and multi-agent architectures. The core intuition is simple: instead of forcing a single LLM to get the code perfectly right on the first try, we can use the optimization solver itself as an objective, unforgiving critic to guide the model.

[Natural Language] ──> [Multi-Agent LLM] ──> [Generated Code] ──> [Optimization Solver]
                             ▲                                           │
                             │                                           ▼
                             └────────── [Execution Feedback] ◄──── [Success/Error]

Multi-Agent Decomposition

Complex optimization problems are broken down into smaller, specialized sub-tasks. For example, Ziyang Xiao et al. introduced Chain-of-Experts (CoE), a framework that coordinates multiple specialized LLM agents (e.g., parameter extractors, constraint formulators) under a central conductor to tackle complex operations research problems. Similarly, Wantong Xie developed MURKA, a three-agent pipeline that automates the translation of business problems into executable code using multi-reward reinforcement learning to align linguistic knowledge with mathematical logic.

Execution-Driven Feedback Loops

When an LLM generates optimization code, that code can be executed in a real solver (like Gurobi). If the code crashes due to a syntax error, or if the solver returns an "Infeasible" status, this feedback is fed back to the LLM.

  • Ali AhmadiTeshnizi et al. demonstrated in OptiMUS that automating this iterative debugging loop nearly doubles the success rate of standard prompting strategies for Mixed-Integer Linear Programming (MILP).
  • Yifan Shi et al. built MIRROR, which couples a hierarchical retrieval system for expert examples with an execution-driven error correction loop to refine formulations without requiring model fine-tuning.

Reinforcement Learning and Process Rewards

Rather than relying solely on text-based self-reflection, recent frameworks use the solver to provide verifiable rewards for reinforcement learning.

  • Solver-Informed RL (SIRL): Developed by Yitian Chen et al. in Solver-Informed RL: Grounding Large Language Models for Authentic Optimization Modeling, this approach grounds an LLM's reasoning by using actual solver execution outcomes as verifiable rewards during training.
  • Process Reward Models (PRMs): To prevent models from arriving at the right answer through flawed logic, Yilin Wang et al. introduced OR-PRM, a process reward model that evaluates the step-by-step mathematical reasoning of an LLM during the formulation phase.
  • Experience Libraries: Minwei Kong et al. developed AlphaOPT, a framework where the LLM builds and refines a persistent "experience library" of structured insights derived from solver feedback, allowing it to generalize across different problem types without retraining.

Overcoming Data Scarcity via Bidirectional Synthesis

A core bottleneck in training specialized models for optimization is the lack of high-quality data. Real-world industrial optimization problems are often proprietary, and manual annotation of text-to-math pairs is incredibly expensive.

To solve this, researchers use bidirectional data synthesis. Instead of trying to write natural language problems and then hiring experts to formulate the math, the process is flipped.

[Seed Math Formulations] ──> [Back-Translate via LLM] ──> [Synthetic Natural Language]
                                                                   │
[Verified Dataset] ◄── [Solver Rejection Sampling] ◄── [Forward Translate & Execute]

In OptMATH, Hongliang Lu et al. proposed a framework that generates diverse mathematical formulations first, back-translates them into natural language descriptions, and then uses solver-based rejection sampling to verify the pairs. If an LLM cannot compile the generated text back into a formulation that matches the original solver behavior, the data point is rejected. This automated pipeline creates massive, high-fidelity datasets, allowing smaller models (e.g., 7B parameters) to achieve expert-level formulation accuracy.

Key Foundational Work

Approximation in Mathematical Domains (1987) — contributed 1 concept elements to this direction.
Imposing Structure on Linear Programming Problems: An Empirical Analysis of Expert and Novice Models (1986) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_mathematical_modeling_bottleneck_97e36208,
  title = {mathematical modeling bottleneck},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/mathematical-modeling-bottleneck/rdr_97e36208a96e48c9b00bf1728c6eba52},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-23},
}

This exact version (version 1, frozen text):

@misc{lacuna_mathematical_modeling_bottleneck_97e36208_v1,
  title = {mathematical modeling bottleneck},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/mathematical-modeling-bottleneck/rdr_97e36208a96e48c9b00bf1728c6eba52/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-23},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake