Opt-Verifier: Unleashing the Power of LLMs for Optimization Modeling via Dual-Side Verification

Haoyang Liu, Jie Wang, Boxuan Niu, Xiongwei Han, Yian Xu, Mingxuan Ye, Zijie Geng, Fangzhou Zhu, Tao Zhong, Mingxuan Yuan, Jianye Hao

TL;DR

Large Language Models (LLMs) are getting good at automatically generating mathematical optimization models, but they often make subtle errors that are hard to catch. This paper introduces Opt-Verifier, a novel framework that uses LLMs to verify these generated models from both a structural and a solution perspective, significantly improving accuracy and reliability.

What Problem Does This Paper Address?

Operations Research (OR) relies heavily on mathematical optimization models to solve complex problems in areas like manufacturing, logistics, and finance. Traditionally, building these models requires significant human expertise to translate natural language problem descriptions into precise mathematical formulations (defining variables, constraints, and objectives). While recent advancements in Large Language Models (LLMs) show promise in automating this process, a major hurdle remains: verifying the correctness of the generated models. LLMs can produce models that look right and even pass basic code execution checks, but they might miss crucial implicit constraints or generate solutions that are logically flawed. This lack of robust verification hinders the adoption of LLMs for critical optimization tasks, as it can lead to inaccurate or even nonsensical results.

Methods

Opt-Verifier tackles this problem with a two-pronged verification approach, leveraging LLMs themselves to act as verifiers.

  1. Structure-Augmented Modeling: Before verification, Opt-Verifier first distills a "multi-level modeling structure" from the problem description. This involves identifying the high-level problem type (e.g., "Maximum Flow"), its specific variants (e.g., "Single Commodity Maximum Flow"), and then detailing low-level structural components (e.g., "Directed Network," "Capacity Constraints," "Flow Conservation"). This structured understanding serves as a template.
  2. Dual-Side Verification:
    • Structure-Side Verification: This component checks if the generated optimization model's structure (variables, constraints, objective) accurately reflects the problem description and the identified multi-level structure. It uses an LLM agent to "back-translate" the model into its structural components and then compares this interpretation against the original structural template. This helps catch omissions or misinterpretations of constraints.
  3. Solution-Side Verification: This component focuses on the validity of the model's solution. It uses LLMs to interpret the numerical solution in natural language, explaining what it means in the context of the original problem. Another LLM agent then critiques this interpretation to identify logical or mathematical inconsistencies that might be missed by standard solver checks (e.g., a solution suggesting more water flows out of a reservoir than flows in).

The feedback from these verification steps is then used to refine the model.

Datasets

The paper evaluates Opt-Verifier on several established benchmarks for optimization modeling:

  • NL4Opt: A benchmark for natural language to optimization modeling.
  • Mamo ComplexLP: Contains linear programming problems.
  • ComplexOR: A comprehensive dataset of linear and mixed-integer programming problems.
  • IndustryOR: Features problems from various industry scenarios.
  • OptMATH: A collection of challenging optimization problems.

The authors also mention using cleaned versions of these benchmarks for fair comparison and conducting experiments on large-scale instances derived from ComplexOR.

Key Insights and Ideas

  • The "Implicit Constraint" Problem: A major challenge is that LLMs often miss constraints that are not explicitly stated but are fundamental to the problem type (e.g., flow balance in network problems). Opt-Verifier's structure-side verification is designed to catch these.
  • Beyond Code Execution: Relying solely on solver output is insufficient. A model can run without errors but still produce a logically flawed solution. Opt-Verifier's solution-side verification addresses this by interpreting the meaning of the solution.
  • Multi-Level Structure as a Blueprint: Decomposing the problem into high, medium, and low-level structural components provides a robust template for LLMs to follow, guiding them towards correct formulations.
  • LLMs as Verifiers: The novel idea of using LLMs not just to generate but also to verify the generated models is a key contribution, leveraging their natural language understanding and reasoning capabilities.
  • Plug-and-Play Capability: Opt-Verifier is designed to be a general framework that can be applied to models generated by any LLM, enhancing its practical utility.

Key Results

  • Opt-Verifier achieved over 20% improvement in solving accuracy compared to baseline methods across popular benchmarks.
  • It significantly outperforms state-of-the-art LLMs, even when using a weaker base LLM (GPT40-mini) compared to more powerful models used by baselines.
  • The dual-side verification mechanism effectively identifies various error types, including variable, constraint, and objective errors, with high precision and recall.
  • Opt-Verifier demonstrates high efficiency, achieving shorter solving times and using fewer tokens compared to some multi-agent baselines.
  • The framework shows strong generalization capabilities, performing well on complex problems that are difficult for standard LLM prompting methods.

Limitations and Future Work

  • Computational Cost: While efficient, the verification process still involves LLM calls, which can be computationally intensive. The paper notes that verification steps are "lightweight" relative to modeling and debugging, but it's still an overhead.
  • Reliance on LLM Capabilities: The effectiveness of Opt-Verifier is inherently tied to the reasoning and understanding capabilities of the LLMs used for verification.
  • Future Work: The authors suggest exploring more advanced LLM techniques for verification and refinement, and further investigating its application to even more complex and diverse problem types. They also highlight the potential for Opt-Verifier to enhance existing LLM-based optimization frameworks.

Summary updated

BibTeX
@inproceedings{liu2026opt,
  author = {Haoyang Liu and Jie Wang and Boxuan Niu and Xiongwei Han and Yian Xu and Mingxuan Ye and Zijie Geng and Fangzhou Zhu and Tao Zhong and Mingxuan Yuan and Jianye HAO},
  title = {{Opt-Verifier: Unleashing the Power of LLMs for Optimization Modeling via Dual-Side Verification}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=L7NsVVUm9H},
}
Figure