NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Solving General Natural-Language-Description Optimization Problems with Large Language Models

Jihai Zhang, Wei Wang, Siyan Guo, Li Wang, Fangquan Lin, Cheng Yang, Wotao Yin

Introduction

Optimization problems are ubiquitous in modern industry, ranging from logistics scheduling to financial portfolio management. Despite their prevalence, a significant "usability gap" persists. Solving these problems typically requires a rare combination of domain expertise, mathematical modeling proficiency, and programming skills. While Large Language Models (LLMs) like GPT-4 have shown promise in natural language understanding, they often struggle with the rigorous logic and arithmetic required for optimization, frequently leading to "hallucinations" or mathematical inconsistencies. Furthermore, data privacy concerns often prevent enterprises from using cloud-based LLM services for sensitive proprietary data.

To address these challenges, we present OptLLM, a framework designed to bridge the gap between human-centric problem descriptions and machine-executable optimization solvers. OptLLM positions the LLM as a sophisticated translator rather than a direct calculator, leveraging its linguistic capabilities to formulate problems while offloading the heavy mathematical lifting to specialized, deterministic solvers.

Methods: The OptLLM Framework

The OptLLM framework is structured into three primary functional modules that facilitate a seamless transition from natural language to solved optimization results.

The OptLLM framework pipeline, illustrating the interaction between the user, the fine-tuned LLM modules, and the external solver.
  1. Interaction Refinement Module: This module acts as an intelligent consultant. If a user's initial query is underspecified—lacking necessary constraints or variables—the system initiates a multi-round dialogue to elicit the missing information and complete the problem description.
  2. Converter Module: At the core of the system, the Converter employs a "Formulator" to translate natural language into mathematical expressions and a "Coder" to convert these expressions into MAPL (MindOpt Algebraic Programming Language). A "Diagnostic" component provides a feedback loop to correct syntax errors before execution.
  3. Responser Module: The generated MAPL code is dispatched to an external solver (e.g., Alibaba's MindOpt). An "Interpreter" then processes the numerical output, translating it back into a natural language response for the user.

To enhance performance while maintaining efficiency, the system utilizes a 50B-parameter Qwen model fine-tuned via LoRA (Low-Rank Adaptation). This approach allows for high-precision specialization on optimization tasks with relatively modest hardware requirements.

Datasets and Evaluation

Given the scarcity of high-quality optimization datasets, a custom data generation pipeline was developed.

  • Fine-tuning Dataset: 15,000 instances were curated in both English and Chinese using a "seed-and-expand" methodology. Experts designed initial problem seeds, which were then expanded by LLMs and manually verified for accuracy.
  • Test Benchmarks: Two benchmarks, En100 and CN100, each containing 100 manually verified problems (including tasks from the NL4OPT competition), were used to evaluate the system's formula generation accuracy.

Key Results

The fine-tuned OptLLM (referred to as Qwen-SFT) was benchmarked against industry leaders GPT-3.5 and GPT-4. Accuracy was measured by the model's ability to generate formulas where every variable, objective, and constraint perfectly matched the ground truth.

Performance comparison of OptLLM (Qwen-SFT) against GPT-3.5 and GPT-4 across English and Chinese datasets.

As shown in the results, Qwen-SFT achieved a state-of-the-art accuracy of 87% on the En100 dataset, notably outperforming GPT-4 (82%). On the Chinese CN100 dataset, it matched GPT-4's performance at 80%. These results underscore the effectiveness of domain-specific fine-tuning for complex logical tasks.

Discussion and Insights

A key insight from this work is the strategic separation of language processing and mathematical solving. By treating the LLM as a translator, OptLLM avoids the common pitfalls of LLM-based arithmetic. Furthermore, the fine-tuning process allowed the model to master subtle mathematical nuances, such as the distinction between strict and non-strict inequalities ($>$ vs. $\geq$), which general-purpose models often overlook.

The architecture also prioritizes privacy. By supporting open-source models like Qwen and Llama, OptLLM enables local deployment, ensuring that sensitive business constraints remain within the enterprise's secure infrastructure.

Conclusion and Future Work

OptLLM demonstrates that fine-tuned LLMs, when integrated with external solvers, can significantly lower the barrier to entry for complex optimization. Future research will focus on incorporating Retrieval-Augmented Generation (RAG) to mitigate knowledge cutoff issues and expanding the framework's capability to handle increasingly diverse industrial scenarios.

Summary updated

BibTeX
@inproceedings{zhang2024solving,
  author = {Jihai Zhang and Wei Wang and Siyan Guo and Li Wang and Fangquan Lin and Cheng Yang and Wotao Yin},
  title = {{Solving General Natural-Language-Description Optimization Problems with Large Language Models}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.naacl-industry.42},
}
Figure