CHORUS++: An agentic RAG framework with iterative refinement for linear programming code generation
摘要
Large Language Models have transformed automated code generation across general programming domains. In the specialized field of operations research, however, translating natural language problem descriptions into executable optimization solver code remains difficult due to strict syntactic requirements. Existing methods relying on static retrieval or one-shot generation frequently fail to align human intent with rigid solver APIs, resulting in hallucinated constraints and execution errors. To address this, we introduce CHORUS++, an agentic framework that replaces fragile one-shot generation with a loop of hierarchical retrieval, multi-layer validation, and iterative self-correction. Our results show that this approach allows open-source models, such as Llama-3.3 (70B), to achieve an accuracy of 78.89% on the NL4Opt-Code benchmark. This performance substantially exceeds the zero-shot capability of proprietary frontier models (GPT-4-Turbo: 63.67%) and permits even smaller 14B-parameter models, e.g., Phi-4, to surpass closed-source baselines. Additionally, our hashing-based versioning system accelerates knowledge base updates by up to 1.43