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6 |
+
- unsloth/gpt-oss-20b-BF16
|
| 7 |
+
tags:
|
| 8 |
+
- optimization
|
| 9 |
+
- operations-research
|
| 10 |
+
- milp
|
| 11 |
+
- gurobi
|
| 12 |
+
- sft
|
| 13 |
+
- transformers
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Model Overview
|
| 17 |
+
|
| 18 |
+
OptiMind-SFT is a specialized 20B parameter model designed to bridge the gap between natural language and executable optimization solvers. It automates the translation of complex decision-making problems—such as supply chain planning, scheduling, and resource allocation—into correct MILP formulations.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Model Summary
|
| 22 |
+
|
| 23 |
+
**Developer:** Microsoft Research, Machine Learning and Optimization (MLO) Group \
|
| 24 |
+
**Model Architecture:** Mixture-of-Experts (MoE) variant of the transformer architecture (gpt-oss family). \
|
| 25 |
+
**Parameters:** 20 Billion (3.6B activated) \
|
| 26 |
+
**Inputs:** Natural language optimization problem description. \
|
| 27 |
+
**Context Length:** 128,000 tokens \
|
| 28 |
+
**Outputs:** Mathematical formulation and executable Python code using GurobiPy. \
|
| 29 |
+
**GPUs:** 8x NVIDIA B200 (Training), 8x NVIDIA H100 (Inference/Evaluation) \
|
| 30 |
+
**Training Time:** ~8 hours \
|
| 31 |
+
**Public Data Summary:** Cleaned subsets of [OR-Instruct](https://huggingface.co/datasets/CardinalOperations/OR-Instruct-Data-3K) and [OptMATH-Train](https://huggingface.co/datasets/Aurora-Gem/OptMATH-Train) \
|
| 32 |
+
**Dates:** Trained in October 2025 \
|
| 33 |
+
**Status:** Static model trained on cleaned public datasets \
|
| 34 |
+
**Release Date:** November 2025 \
|
| 35 |
+
**License:** MIT \
|
| 36 |
+
**Model Dependencies:** [unsloth/gpt-oss-20b-BF16](https://huggingface.co/unsloth/gpt-oss-20b-BF16) \
|
| 37 |
+
**Additional Assets:** [GitHub Repository](https://github.com/microsoft/OptiGuide)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# Usage
|
| 41 |
+
|
| 42 |
+
## Sample Useage
|
| 43 |
+
|
| 44 |
+
OptiMind-SFT is best served with **SGLang**. we use SGLang’s OpenAI-compatible API together with the official openai Python client:
|
| 45 |
+
|
| 46 |
+
```
|
| 47 |
+
pip install "sglang[all]" openai gurobipy
|
| 48 |
+
|
| 49 |
+
# Make sure you have a valid Gurobi license and PYTHON>=3.12
|
| 50 |
+
python -m sglang.launch_server \
|
| 51 |
+
--model-path microsoft/OptiMind-SFT \
|
| 52 |
+
--host 0.0.0.0 \
|
| 53 |
+
--port 30000 \
|
| 54 |
+
--tensor-parallel-size 1 \
|
| 55 |
+
--trust-remote-code
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Below is the sample code to query the model:
|
| 59 |
+
```
|
| 60 |
+
from openai import OpenAI
|
| 61 |
+
|
| 62 |
+
# SGLang exposes an OpenAI-compatible endpoint
|
| 63 |
+
client = OpenAI(
|
| 64 |
+
base_url="http://localhost:30000/v1",
|
| 65 |
+
api_key="EMPTY" # Not used by local SGLang, but required by the client
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
system_prompt = """You are an expert in optimization and mixed integer programming. You are given an
|
| 69 |
+
optimization problem and you need to solve it using gurobipy.
|
| 70 |
+
Reason step by step before generating the gurobipy code.
|
| 71 |
+
When you respond, first think carefully.
|
| 72 |
+
After thinking, output the math modeling of the problem.
|
| 73 |
+
Finally output a ```python ...``` code block that solves the problem.
|
| 74 |
+
The code must include:
|
| 75 |
+
import gurobipy as gp
|
| 76 |
+
from gurobipy import GRB
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
user_problem = "A factory produces products A and B with capacity and demand constraints ..."
|
| 80 |
+
|
| 81 |
+
response = client.chat.completions.create(
|
| 82 |
+
model="microsoft/OptiMind-SFT",
|
| 83 |
+
messages=[
|
| 84 |
+
{"role": "system", "content": system_prompt},
|
| 85 |
+
{"role": "user", "content": user_problem},
|
| 86 |
+
],
|
| 87 |
+
temperature=0.9, # recommended default
|
| 88 |
+
top_p=1.0, # recommended default
|
| 89 |
+
max_tokens=4096,
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
print(response.choices[0].message.content)
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
This will return a response that first describes the mathematical model and then includes a python code block implementing it in gurobipy.
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
## Primary Use Cases
|
| 99 |
+
|
| 100 |
+
- Translating natural-language Operations Research (OR) problems into mixed-integer linear programs (MILPs) and corresponding `gurobipy` code for research and prototyping.
|
| 101 |
+
- Studying and benchmarking NL to MILP modeling pipelines on public OR datasets such as IndustryOR, Mamo-Complex, and OptMATH.
|
| 102 |
+
- Educational use for teaching how to derive optimization models (variables, constraints, objectives) from informal problem descriptions.
|
| 103 |
+
- Performing ablations and research on solver-in-the-loop prompting and multi-turn correction in domain-specific modeling tasks.
|
| 104 |
+
|
| 105 |
+
## Out-of-Scope Use Cases
|
| 106 |
+
|
| 107 |
+
- General-purpose chat, open-domain reasoning, or tasks unrelated to optimization modeling.
|
| 108 |
+
- Safety-critical or regulated applications (e.g., healthcare, finance, legal decisions, credit scoring) without expert human review of both the model output and the resulting optimization.
|
| 109 |
+
- Fully automated deployment where optimization results are used directly for real-world decisions without human oversight.
|
| 110 |
+
- Automatic execution of generated code in production systems without sandboxing, logging, and appropriate security controls.
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
## Technical Requirements & Integration
|
| 114 |
+
|
| 115 |
+
We recommend **≥32GB GPU VRAM** (e.g., A100/H100/B200) for comfortable inference, especially for long prompts and multi-turn interactions.
|
| 116 |
+
Please checkout our [GitHub page](https://github.com/microsoft/OptiGuide) for instructions on the inference pipeline.
|
| 117 |
+
|
| 118 |
+
# Data Overview
|
| 119 |
+
## Training and Validation Data
|
| 120 |
+
We fine-tune OptiMind-SFT on cleaned versions of the OR-Instruct and OptMATH training sets, and validate on a held-out validation split drawn from the same cleaned corpora.
|
| 121 |
+
|
| 122 |
+
## Testing Data
|
| 123 |
+
For testing, we use manually cleaned and expert-validated versions of the IndustryOR, Mamo-Complex, and OptMATH benchmarks. Please visit our [GitHub page](https://github.com/microsoft/OptiGuide) to download the cleaned benchmarks.
|
| 124 |
+
|
| 125 |
+
# Known Technical Limitations
|
| 126 |
+
|
| 127 |
+
- The model can still produce incorrect formulations or invalid code, or declare feasibility/optimality incorrectly.
|
| 128 |
+
- It is specialized to OR benchmarks; behavior on general text or other problem domains is not guaranteed.
|
| 129 |
+
- No dedicated red-teaming against unsafe content categories (e.g., hate, violence, self-harm) or jailbreak attacks has been performed; the paper focuses on technical robustness metrics.
|
| 130 |
+
|
| 131 |
+
Users **must** keep a human in the loop for all consequential decisions and carefully review any generated code before execution.
|
| 132 |
+
|
| 133 |
+
# Other Sources & Maintenance
|
| 134 |
+
- Evaluation code and cleaned benchmarks: [GitHub page](https://github.com/microsoft/OptiGuide)
|
| 135 |
+
- Paper: [Arxiv link](https://arxiv.org/abs/2509.22979)
|
| 136 |
+
For questions, issues, or feature requests, please use the GitHub issue tracker or the Hugging Face “Community” tab.
|
| 137 |
+
|
| 138 |
+
# Citation
|
| 139 |
+
If you use OptiMind-SFT or the associated datasets/benchmarks in your work, please cite:
|
| 140 |
+
|
| 141 |
+
```
|
| 142 |
+
@article{chen2025optimind,
|
| 143 |
+
title={OptiMind: Teaching LLMs to Think Like Optimization Experts},
|
| 144 |
+
author={Chen, Zeyi and Zhang, Xinzhi and Zope, Humishka and Barbalho, Hugo and Mellou, Konstantina and Molinaro, Marco and Kulkarni, Janardhan and Menache, Ishai and Li, Sirui},
|
| 145 |
+
journal={arXiv preprint arXiv:2509.22979},
|
| 146 |
+
year={2025}
|
| 147 |
+
}
|
| 148 |
+
```
|