OptiMind: Improving Small Language Models for Optimization Modeling through Formulation Guidance and Multi-Turn Learning

Xinzhi Zhang, Zeyi Chen, Humishka Zope, Hugo Barbalho, Konstantina Mellou, Marco Molinaro, Janardhan Kulkarni, Ishai Menache, Sirui LiNeurIPS 2026

TL;DR

Translating real-world logistics and scheduling headaches into mathematical code that optimization solvers can crunch usually requires a PhD—or a massive, cloud-bound AI. OptiMind teaches a local, 20-billion-parameter small language model (SLM) to match frontier giants like GPT-5 at this task. It pulls this off by auditing messy benchmarks, distilling recurring math blunders into a "cheat sheet" of hints, and training the model via multi-turn reinforcement learning to debug its own formulations using real solver feedback.

What Problem Does This Paper Address?

Every day, supply chains, power grids, and airlines rely on mathematical optimization—specifically Linear and Mixed-Integer Linear Programming (LP/MILP)—to make decisions. While managers can easily describe their problems in plain English, translating those words into strict mathematical variables, objectives, and constraints is a major bottleneck.

Giant frontier models (like GPT-5 or Claude Opus) are getting surprisingly good at writing solver-ready Python code (e.g., GurobiPy). However, warehouses and hospitals often can’t send sensitive operational data to the cloud due to privacy, latency, and cost constraints; they need Small Language Models (SLMs) running locally. Until now, open-source SLMs have struggled mightily here. Unlike general coding, there is no massive "GitHub for optimization" to train on, existing synthetic datasets are riddled with errors, and standard one-shot prompting ignores how human experts actually work: writing a model, running the solver, inspecting the output, and iteratively fixing bugs.

Methods

OptiMind upgrades SLMs across the entire lifecycle—data cleaning, training, and inference—using three main ingredients:

  1. Class-Specific Hint Library: The authors noticed that models make predictable, structured mistakes on related problems (like swapping inflow and outflow signs in network-flow problems). By analyzing errors via both human experts and an automated teacher-model pipeline, they distilled ~200 compact, preventive "hints" organized across 53 canonical problem classes (e.g., Traveling Salesman).
  2. Hint-Guided Data Cleaning: Using these hints and stronger teacher models (o4-mini and GPT-OSS-120B with 64-sample majority voting), the team repaired missing data in training questions and regenerated clean solution trajectories and ground-truth objective values.
OptiMind's data-improvement pipeline
  1. Multi-Turn RL with Solver Feedback: Rather than relying solely on standard Supervised Fine-Tuning (SFT), OptiMind uses Group Relative Policy Optimization (GRPO)—a reinforcement learning algorithm—over a 3-turn interactive loop. The model writes Gurobi code, executes it, observes the solver's logs/errors/outputs, and revises its formulation. Crucially, the reward averages executable correctness across all turns, encouraging the model to get it right early and not break working solutions.

At test time, OptiMind classifies the user's problem, injects the matching hints into the prompt, and gives the model up to five turns of solver-assisted self-correction.

Figure 3: OPTIMIND inference pipeline. The hint library distilled during data improvement is reused at test time for class-conditioned prompt- ing, multi-sample decoding, and optional solver- feedback self-correction.

Datasets

  • Training: Cleaned versions of OR-Instruct (2.2k items) and OptMATH (2.3k regenerated linear problems).
  • Cleaned Evaluation Benchmarks: A team of operations research experts manually audited three established, hard benchmarks—IndustryOR, Mamo-Complex, and OptMATH (linear subset)—yielding 469 validated test instances.
  • Out-of-Distribution (OOD) Benchmarks: To test generalization, the authors evaluated on LogiOR, held-out nonlinear OptMATH problems, and a newly constructed arXiv dataset featuring eight novel optimization problems pulled directly from recent research papers.

Key Insights and Ideas

  • Existing benchmarks were shockingly broken: Manual audits revealed that 50% of IndustryOR, 51% of Mamo-Complex, and 41% of OptMATH test instances had missing data, ambiguities, or flat-out wrong ground-truth answers! Cleaning the test sets alone caused the base model's measured accuracy to jump from 40–60% to 70–90%.
  • Execution feedback fixes math errors, not just syntax: Even when Python code runs without crashing, solver outputs expose logical flaws (like inventory exceeding capacity). Multi-turn RL teaches the model to read those numbers and flip an inequality sign on the next turn.
  • Hints transfer across model families—even to giants: Hints curated from a 20B model's mistakes boosted a 9B Qwen model and even lifted GPT-5's accuracy by +4.7% on Mamo-Complex, proving domain checklists complement raw reasoning power.
  • RL preserves general skills better than SFT: While SFT degraded the base model's general language benchmark scores and broke its agentic tool-calling syntax, OptiMind-RL preserved those broader capabilities.

Key Results

Built on the open-source GPT-OSS-20B base model, OptiMind-RL (with expert hints and 5 solver turns) achieves 78.5% accuracy on IndustryOR, 92.3% on Mamo-Complex, and 91.0% on OptMATH.

Figure 4: Average accuracy for different models under 5 turns. Models colored in blue are open- sourced models up to 32B parameters, and models in purple are closed-sourced frontier models.
  • This crushes open-source baselines up to 32B parameters (including Qwen3-32B and domain-specialized SIRL-Gurobi-32B) by 12.3 to 27.2 percentage points.
  • Under the same 5-turn budget (without hints for baselines), this 20B model goes toe-to-toe with GPT-5, beating it by 2.9 points on Mamo-Complex and 1.1 points on OptMATH, while trailing by just 4.7 points on IndustryOR.
  • Applying the exact same cleaned data and hint recipe to Qwen3.5-9B without extra human effort yielded massive multi-turn RL gains (+6.3 to +15.8 points over SFT at five turns), confirming the pipeline's portability.

Limitations and Future Work

The authors do not include a dedicated limitations section, though several constraints are noted in the text:

  • Linear Focus: The core training pipeline and primary evaluations focus on linear problems (LP/ILP/MILP), with nonlinear optimization explored mainly as a smaller generalization study.
  • Objective-Value Proxy: Accuracy is automatically graded by checking if the solver's final objective number matches the ground truth. While an expert audit of 30 correct outputs found zero false positives, matching a single number remains a proxy for full structural correctness.
  • Compute Constraints on Ablations: Due to time and compute limits, several ablations (such as training data recipes and automatic hint filtering) were evaluated using SFT checkpoints rather than full RL retraining runs.

Summary updated

Abstract

Mathematical optimization drives decisions in supply chains, logistics, energy, and scheduling, but translating natural-language problems into solver-executable formulations remains a bottleneck. While frontier models show promise for this task, many deployments require small language models (SLMs) that run locally under privacy, latency, and cost constraints. Existing SLMs are limited by noisy data, ambiguous benchmarks, and one-shot inference that ignores the iterative, feedback-driven nature of optimization modeling. To address these challenges, we introduce OptiMind, a system that combines data cleaning and class-specific hints with training using solver feedback. OptiMind distills recurring formulation errors into class-specific hints that guide the repair of ambiguous problems and the regeneration of solution trajectories. This process provides reliable training data, which is then used for multi-turn RL to teach models to revise their formulations in response to solver feedback. At inference time, the same hint library guides further refinement as models revise their solutions over successive turns. To support reliable evaluation, we clean three challenging benchmarks from the literature. On these cleaned benchmarks, our 20B OptiMind-RL model outperforms strong open-source baselines and reaches frontier-model performance under the same protocol. The full hint library, cleaned test data, cleaning logs, and evaluation code are publicly available on [GitHub](https://github.com/microsoft/OptiGuide/tree/main/optimind), and our trained OptiMind-RL model is available on [HuggingFace](https://huggingface.co/microsoft/optimind-rl).
BibTeX
@inproceedings{zhang2026optimind,
  author = {Xinzhi Zhang and Zeyi Chen and Humishka Zope and Hugo Barbalho and Konstantina Mellou and Marco Molinaro and Janardhan Kulkarni and Ishai Menache and Sirui Li},
  title = {{OptiMind: Improving Small Language Models for Optimization Modeling through Formulation Guidance and Multi-Turn Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=PDqLeHA8wd},
}
Figure