AI models can write optimization code that runs cleanly and still gets the problem wrong, and a new system called ReLoop is built to catch it.
Researchers found that large language models translating natural-language requests into optimization code often produce programs that execute without errors and return solver-feasible answers that are nonetheless wrong, a feasibility-correctness gap that reached 90 percentage points on compositional problems. ReLoop attacks this with two mechanisms: structured generation, which splits code writing into four stages (understand, formalize, synthesize, verify) to stop mistakes at the source, and behavioral verification, which tests how a formulation responds to solver-based parameter perturbation, an external check that does not depend on the model reviewing its own work. Paired with a diagnostic recovery step, the combined system reports 100 percent executable code and consistent accuracy gains across three benchmarks. The team also released RetailOpt-190, 190 retail optimization scenarios designed to expose the multi-constraint interactions where LLMs most often fail.
The finding matters because optimization code is a plausible-looking output that is hard to audit. It compiles. It runs. A solver hands back a number. Nothing about that process tells you whether the model understood the problem it was asked to solve, which is exactly the failure mode ReLoop is designed to surface.
One number in the paper deserves a caveat: the largest single-benchmark gain, 8.5 points on RetailOpt-190, is credited to a model the paper calls Claude Opus 4.6, a designation that does not correspond to any Claude model Anthropic has publicly released, so that specific figure should be treated as unverified until the model is properly identified.