OptiChat: Bridging Optimization Models and Practitioners with Large Language Models

Hao Chen, Gonzalo Esteban Constante-Flores, Krishna Sri Ipsit Mantri, Sai Madhukiran Kompalli, Akshdeep Singh Ahluwalia, Can Li · OpenReview

Abstract

Optimization models have been applied to solve a wide variety of decision-making problems. These models are usually developed by optimization experts but are used by practitioners without optimization expertise in various application domains. As a result, practitioners often struggle to interact with and draw useful conclusions from optimization models independently. To fill this gap, we introduce OptiChat, a natural language dialogue system designed to help practitioners interpret model formulation, diagnose infeasibility, analyze sensitivity, retrieve information, evaluate modifications, and provide counterfactual explanations. By augmenting large language models (LLMs) with functional calls and code generation tailored for optimization models, we enable seamless interaction and minimize the risk of hallucinations in OptiChat. We develop a new dataset to evaluate OptiChat's performance in explaining optimization models. Experiments demonstrate that OptiChat effectively bridges the gap between optimization models and practitioners, delivering autonomous, accurate, and instant responses.

Introduction

In industries such as logistics, energy, and manufacturing, Mixed-Integer Linear Programs (MILPs) are the gold standard for complex decision-making. However, these models are typically authored in abstract mathematical code (e.g., Pyomo or GAMS) by specialized experts. For the "practitioners"—the decision-makers on the ground—these models often remain black boxes. When a model reports infeasibility or suggests a counter-intuitive strategy, practitioners must wait for an expert to translate the mathematical output into a business explanation. This bottleneck slows decision-making and limits trust in automated systems. OptiChat addresses this by providing a natural language interface that allows non-experts to troubleshoot and query optimization models directly.

System Architecture

OptiChat utilizes a multi-agent framework to process user queries through a structured pipeline, ensuring that natural language is accurately translated into technical actions. The system is composed of several specialized agents:

  1. The Illustrator Agent: Maps technical variable names (e.g., model.x[i,j]) to their physical meanings (e.g., "shipping volume from warehouse $i$ to customer $j$").
  2. The Coordinator Agent: Routes questions as either "solution-agnostic" (general theory) or "solution-specific" (requiring active model solving).
  3. The Engineering Team: This core component uses a hybrid approach to prevent hallucinations. The Operator Agent uses predefined functions for standard tasks like sensitivity analysis, while the Programmer & Evaluator Agents write and debug custom code for complex counterfactual queries. Finally, the Reminder Agent provides syntax guidance to ensure correct indexing and parameter usage.
The OptiChat framework architecture, illustrating the interaction between LLMs, modeling software, and optimization solvers.

Evaluation and Query Types

To evaluate OptiChat, the authors curated a comprehensive dataset featuring 24 optimization models sourced from libraries like GAMS and the Pyomo Cookbook. These models cover diverse domains including supply chain and power systems, and are significantly more complex than previous benchmarks like NLP4LP. The evaluation dataset includes 172 question-answer pairs drafted by 29 optimization experts, categorized into five distinct interaction types: diagnosing, retrieval, sensitivity, what-if, and why-not (counterfactuals).

Examples of the five query types handled by OptiChat: Diagnosing, Retrieval, Sensitivity, What-if, and Why-not.

Key Results and Insights

Experiments demonstrate that OptiChat provides a significant leap in both speed and reliability for optimization modeling tasks:

  • Efficiency: OptiChat generates troubleshooting advice and model descriptions in under one minute, a task that takes human experts between 18 and 55 minutes.
  • Accuracy: Utilizing OpenAI’s o3 reasoning model, OptiChat achieved an overall accuracy of 88.9%. In specialized tasks like sensitivity analysis and data retrieval, accuracy reached as high as 94-97%.
  • Context Awareness: Ablation studies confirmed that the "Illustrator" and "Reminder" agents are critical. Without them, LLMs frequently fail due to incorrect variable indexing or a lack of physical context.
  • Reasoning Capabilities: Advanced reasoning models like o3 proved particularly effective at "why-not" queries, which require the system to invent new constraints to test user hypotheses.

Conclusion

OptiChat successfully bridges the gap between complex mathematical models and domain practitioners. By combining the natural language capabilities of LLMs with the precision of predefined optimization functions, it offers a reliable, autonomous interface for decision support. Future work will focus on extending the system to handle multi-turn dialogues and integrating Reinforcement Learning from Human Feedback (RLHF) to further align explanations with practitioner needs.

Summary updated

BibTeX
@misc{chen2025optichat,
  author = {Hao Chen and Gonzalo Esteban Constante-Flores and Krishna Sri Ipsit Mantri and Sai Madhukiran Kompalli and Akshdeep Singh Ahluwalia and Can Li},
  title = {{OptiChat: Bridging Optimization Models and Practitioners with Large Language Models}},
  year = {2025},
  eprint = {2501.08406},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.08406},
}
Figure