Translating real-world business requirements into rigorous mathematical models, such as Mixed-Integer Linear Programs (MILP), is a critical yet challenging task. While Large Language Models (LLMs) have shown promise in general reasoning, they often falter in optimization modeling due to the inherent ambiguity of natural language and a severe lack of high-quality, large-scale training data. Existing datasets are typically small and limited to simple linear programming problems.
To address this "data drought," the OptMATH framework introduces a scalable bidirectional synthesis approach that generates 200,000 high-quality problem triplets consisting of natural language descriptions, mathematical formulas, and problem data.
The OptMATH Framework
The core of OptMATH is a three-step closed-loop process designed to ensure mathematical rigor and linguistic diversity. Unlike traditional methods that rely solely on LLM generation, OptMATH employs a "generate-then-verify" strategy.
- Reverse Data Generation: The process begins with 53 mathematical templates. A complexity scoring function $S(PD)$ is used to tune parameters like variable counts and constraint types to generate specific Problem Data (PD). An LLM then "back-translates" these formulas into natural language (NL) descriptions.
- Forward Modeling & Evaluation: To verify the generated data, an "AutoFormulator" translates the NL back into code. A professional solver (e.g., Gurobi) then solves both the original and the generated problems.
- Rejection Sampling: If the optimal values of both versions match, the data is accepted. This "solution-equivalence" check ensures the training data is grounded in mathematical truth rather than just plausible-sounding text.
Datasets and Complexity
The framework produced OptMATH-Train, a massive dataset of 200,000 samples across 10+ domains including logistics, finance, and energy. Additionally, the authors curated OptMATH-Bench, a challenging benchmark composed of complex instances where descriptions are significantly longer and more intricate than those in previous benchmarks like NL4OPT.
As shown in the distribution above, the dataset covers a wide range of complexities, from "Easy" to "Hard," with many problems exceeding 10,000 characters. This diversity allows models to learn long-context reasoning and handle the nuances of real-world constraints.
Key Results and Insights
By fine-tuning the Qwen2.5 model family on this synthetic data, the authors achieved state-of-the-art results:
- Superior Performance: The OptMATH-Qwen2.5-32B model achieved 95.9% accuracy on NL4OPT and 89.9% on MAMO EasyLP, outperforming much larger models like GPT-4 (89.0% and 87.3% respectively).
- Handling Hard Tasks: On the OptMATH-Bench, the 32B model scored 34.7%, more than doubling GPT-4's performance (16.6%) and surpassing the 671B parameter DeepSeek-V3 (32.6%).
- Efficiency: The results demonstrate that for specialized domains like Operations Research, high-quality synthetic data can allow smaller models (7B-32B) to outperform general-purpose giants.
Conclusion
OptMATH provides a robust solution to the data scarcity problem in optimization modeling. By combining reverse generation with solver-based verification, the framework creates a self-improving flywheel: as the model improves, the rejection sampling pass rate increases, providing even better data for subsequent training. Future work will focus on expanding the variety of optimization types and integrating reinforcement learning to further refine model accuracy.
Summary updated