Grammar-Aware Literate Generative Mathematical Programming with Compiler-in-the-Loop

📅 2026-01-25
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work proposes SyntAGM, a system designed to address the challenges of frequent syntactic errors and poor semantic alignment in the automatic translation from natural language to Algebraic Modeling Languages (AMLs). SyntAGM introduces a closed-loop pipeline—comprising generation, compilation, evaluation, and revision—that uniquely integrates compiler diagnostic feedback and BNF grammar-aware mechanisms into the large language model (LLM) generation process. By operating under strict syntactic constraints, the system efficiently synthesizes PyOPL models that are both structurally correct and semantically aligned with the input specifications. The approach leverages BNF-informed contextual prompting, few-shot retrieval, and an LLM-driven alignment discriminator to significantly enhance generation quality. Experimental results demonstrate that SyntAGM achieves high accuracy while substantially reducing token consumption, inference cost, and latency.

Technology Category

Application Category

📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

mathematical programming
natural language to code
Algebraic Modelling Languages
grammar-aware generation
compiler feedback
Innovation

Methods, ideas, or system contributions that make the work stand out.

Grammar-Aware Generation
Compiler-in-the-Loop
Algebraic Modelling Language
Generate-Compile-Assess-Revise
Literate Mathematical Programming
🔎 Similar Papers
No similar papers found.