This work investigates generative mathematical programming through the lens of Algebraic Modelling Languages (AMLs) and compiler-guided model synthesis. By leveraging PyOPL, an OPL-like AML compiler that provides detailed syntax diagnostics, we introduce SyntAGM, an end-to-end system that translates natural language problem descriptions into PyOPL models via a generate--compile--assess--revise loop. SyntAGM is grammar-aware thanks to in-context exposure to the PyOPL BNF grammar, and benefits from few-shot retrieval of literate PyOPL model exemplars. To obtain a valid PyOPL model that matches the problem description, SyntAGM mobilises compiler feedback and an LLM-based alignment judge. In a comparative study against established prompting baselines SyntAGM achieves competitive accuracy with superior token, cost, and latency profiles.
翻译:本研究从代数建模语言和编译器引导的模型合成视角探讨生成式数学编程。通过利用PyOPL(一种提供详细语法诊断的类OPL代数建模语言编译器),我们提出了SyntAGM系统——一个通过生成-编译-评估-修正循环将自然语言问题描述转换为PyOPL模型的端到端框架。SyntAGM通过上下文学习PyOPL的巴科斯-诺尔范式语法实现语法感知,并受益于少量文本化PyOPL模型范例的检索机制。为获得符合问题描述的有效PyOPL模型,SyntAGM整合了编译器反馈与基于大语言模型的对齐评估器。在与现有提示基准的对比实验中,SyntAGM在保持竞争力的准确率同时,展现出更优的令牌效率、计算成本与延迟性能。