Optimization and Constraint Modeling using LLMs with a Retrieval Augmented Generation Process
This paper demonstrates that a Retrieval-Augmented Generation pipeline leveraging a curated synthetic dataset significantly improves the accuracy and structural consistency of LLM-generated optimization and constraint models, offering a cost-effective alternative to fine-tuning for real-world decision-support applications.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are trying to give a very smart, very creative robot a set of instructions to solve a complex puzzle, like planning the most efficient route for a fleet of delivery trucks or scheduling hospital shifts. This field is called optimization, and it's the math behind making the best possible decisions when resources are limited. To do this, humans usually have to translate their messy, real-world problems into strict, rigid mathematical languages (like Linear Programming or Constraint Programming). It's like trying to explain a story to a robot that only speaks a language made entirely of strict rules and equations.
Recently, we've had a breakthrough with Large Language Models (LLMs). Think of these as super-advanced robots that have read almost everything on the internet. They are amazing at understanding stories and writing code, but they sometimes struggle when asked to follow strict mathematical rules. They might invent fake numbers, forget a crucial rule, or get the logic slightly wrong, which turns a perfect plan into a broken one. To fix this, researchers are using a technique called Retrieval-Augmented Generation (RAG). If an LLM is like a student taking a test, RAG is like giving that student a "reference sheet" of similar problems they've already solved, right before they start writing their answer. This paper asks a simple but powerful question: If we give an AI a library of perfect, pre-solved math puzzles, will it get much better at solving new ones?
The authors of this paper decided to build a massive, custom library of these puzzles to test their idea. They started by creating 500 brand-new optimization problems. Instead of just writing dry math questions, they used an AI to invent "personas"—like a busy logistics manager or a hospital administrator—and then asked another AI to turn those characters' real-world headaches into strict, formal math problems. They even wrote the correct computer code to solve each one, creating a "gold standard" answer key. They stored all 500 of these problem-and-solution pairs in a special digital filing cabinet called a vector database, which is designed to find items that are "semantically similar" (meaning they feel the same, even if the words are different).
Then, they set up a race. They took a powerful AI model (Qwen 3 30B Instruct) and gave it a series of new, unseen math problems. In the first round, the AI had to solve them alone, relying only on what it knew from its training. In the second round, they used their new RAG system: before the AI answered, the system searched their library of 500 problems, found the three most similar ones, and showed them to the AI as examples. To make sure the AI didn't get confused by bad examples, they added a "semantic gateway"—a smart filter that only let in examples that were a perfect match, rejecting anything that was too different.
The results were a clear victory for the team with the library. When the AI tried to solve problems on its own, it got the right answer about 32% to 40% of the time, depending on how hard the puzzle was. But when the AI was allowed to peek at the similar solved examples from their library, its accuracy jumped significantly. On one set of tests (NL4OPT), it went from getting 40% right to getting 72% right. On another set (MAMO Complex), it improved from 32% to 56%.
The paper suggests that this approach is a powerful alternative to the usual method of "fine-tuning," which involves retraining the entire AI model on new data—a process that is expensive and time-consuming. Instead, this study shows that simply giving the AI a well-organized, synthetic library of examples to reference can dramatically improve its ability to translate human ideas into correct, working mathematical models. The authors note that while the results are promising, they are based on a specific set of 500 synthetic problems and 25 test queries, so the method is still being explored. However, the findings point toward a future where non-experts could use AI as a reliable co-pilot to build complex decision-making tools without needing to be math wizards themselves.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.