Strategy-Aware Optimization Modeling with Reasoning LLMs

Ruiqing Zhao, Fengzhi Li, Yuan Zuo, Rui Liu, YanSong Liu, Yunfei Ma, Fanyu Meng, Junlan Feng

Executive Summary

Large language models (LLMs) can generate syntactically valid optimization programs but often struggle to choose an effective modeling strategy, leading to incorrect formulations and inefficient solver behavior. To address this, researchers introduce SAGE (Strategy-Aware Guided rEasoning), a framework that makes modeling strategy explicit during both data construction and post-training. By utilizing a solver-verified multi-strategy dataset and a novel Segment-Weighted GRPO reinforcement learning approach, SAGE significantly improves formulation accuracy, diversity, and solver efficiency.

The Challenge of Optimization Modeling

In Operations Research (OR), translating a messy natural language description into a precise mathematical model is notoriously difficult. While modern LLMs excel at generating syntactically correct code, they frequently stumble on the "global design" of a model.

For instance, an LLM might blindly create variables for every possible route in a transportation problem—even non-existent ones—resulting in runtime errors or massive, inefficient constraint matrices. Human experts avoid these pitfalls by first committing to a high-level Modeling Strategy (e.g., a flow-based versus an assignment-based paradigm). Current automated optimization systems lack this explicit strategic reasoning, typically treating modeling as a single-step code generation task.

Methodology: The SAGE Framework

SAGE tackles this gap through a two-phase framework designed to teach LLMs to think like operations researchers:

  1. Multi-Strategy Data Synthesis: A teacher model (DeepSeek-R1) generates multiple candidate strategies for a single problem. These strategies are verified by a solver (Gurobi) against ground-truth answers. An LLM-as-Judge then deduplicates the results to ensure the dataset contains diverse, semantically distinct modeling paradigms.
  2. Segment-Weighted GRPO: Standard Reinforcement Learning (RL) treats every token in a response with equal importance. SAGE introduces a weighted objective that prioritizes the strategy segment. Because early strategic choices dictate the success of the entire model, the RL algorithm assigns more credit to these high-level planning decisions.
  3. Composite Rewards: The model is evaluated based on three criteria:
  4. Format: Adherence to a structured <think>, <strategy>, <modeling>, and <check> template.
  5. Correctness: Whether the generated code correctly solves the problem.
  6. Efficiency: A novel reward that penalizes models requiring excessive solver iterations or nodes, encouraging sparse and tight formulations.

Datasets and Evaluation

SAGE was evaluated across eight diverse benchmarks, ranging from classical linear programming (NL4OPT, MAMO-Easy, NLP4LP, OptiBench) to complex, real-world scenarios with hierarchical constraints (MAMO-Complex, ComplexOR, IndustryOR, OptMATH). Alongside the framework, the researchers released a new 108K solver-verified multi-strategy dataset derived from OptMATH and IndustryOR.

Key Insights and Results

  • Accuracy and Complex Problem Mastery: SAGE improved the average pass@1 accuracy from 72.7% to 80.3% over the strongest open-source baseline. On the most difficult "Complex" benchmarks, SAGE outperformed other RL-based models by approximately 15.4%.
  • Strategy as a Constraint: Forcing the model to commit to a strategy before writing code naturally restricts its decision variables to the correct index space. This drastically reduces logic mismatches and KeyErrors.
  • Solver Efficiency: At the largest problem scales, SAGE produced more compact constraint systems with 14.2% fewer constraints than baselines like DeepSeek-V3, leading to significantly lower solve times. Interestingly, SAGE-generated models sometimes use more variables but fewer constraints—an "extended formulation" that makes the problem easier for a solver to digest by creating a sparser constraint matrix.
  • Formulation Diversity: When allowed multiple attempts (pass@16), SAGE discovered 19–29% more distinct valid formulations, demonstrating a robust understanding of different ways to frame the same problem.

Limitations and Future Directions

While SAGE represents a significant step forward, the authors note a few limitations:

  • Domain Specialization: SAGE is highly tailored to Operations Research. Its reasoning templates and efficiency rewards would require significant adaptation for other domains like general software engineering.
  • Teacher Dependency: Initial data construction relies on a strong teacher model (DeepSeek-R1). Future work could explore self-evolving methods where the model improves its own strategies autonomously.
  • Ground Truth Requirement: The current reward system requires a ground-truth answer to verify correctness, complicating its application to open-ended real-world problems where the optimal answer is unknown. Moving toward formulation-level verification could address this limitation in future iterations.

Summary updated

BibTeX
@inproceedings{zhao2026strategy,
  author = {Ruiqing Zhao and Fengzhi Li and Yuan Zuo and Rui Liu and YanSong Liu and Yunfei Ma and Fanyu Meng and Junlan Feng},
  title = {{Strategy-Aware Optimization Modeling with Reasoning LLMs}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=xEN1n4vu1j},
}
Figure