Metraipolis › archive › dc_eb0a28d178da
Learning Context-Free Grammars for Grammar-Constrained Decoding via Declarative Agentic Programming with Guarantees — arXiv:2608.05493
- Source
- arXiv (en)
- Original
- https://arxiv.org/abs/2608.05493
- License (as archived)
- CC0-1.0
- Archived
- 2026-10-31T10:51:10.472Z
- SHA-256 of the archived text
57791de66e87edd3c96b1b11d80ac812ef2608a1ecda40ad8112c5c21eec5434- Stable URL of this page
https://metraipolis.com/documento/dc_eb0a28d178da
How to cite
Learning Context-Free Grammars for Grammar-Constrained Decoding via Declarative Agentic Programming with Guarantees — arXiv:2608.05493 — arXiv (en), https://arxiv.org/abs/2608.05493 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_eb0a28d178da (Metraipolis archive dc_eb0a28d178da, sha256 57791de66e87edd3c96b1b11d80ac812ef2608a1ecda40ad8112c5c21eec5434)
BibTeX
@misc{dceb0a28d178da,
title = {Learning Context-Free Grammars for Grammar-Constrained Decoding via Declarative Agentic Programming with Guarantees — arXiv:2608.05493},
howpublished = {arXiv (en)},
url = {https://arxiv.org/abs/2608.05493},
note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_eb0a28d178da; sha256 57791de66e87edd3c96b1b11d80ac812ef2608a1ecda40ad8112c5c21eec5434},
year = {2026}
}Archived text
Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2608.05493. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
Language models (LMs) are increasingly used to interact with external services via programs written in domain-specific languages (DSLs). Unfortunately, since DSLs are often low-resource and esoteric, LMs frequently produce syntactically invalid programs in these languages. Grammar-constrained decoding can eliminate such failures, but requires syntactic constraints. These are usually in the form of a context-free grammar for the target language, an artifact that is hard to come by for third-party DSLs. In this work, we define an agent, called Autogrammar, that automatically learns context-free grammars from documentation and execution data. Autogrammar is formalized as a Kripke structure whose nondeterministic choices are resolved by a language model, enabling declarative control of agent behavior via linear temporal logic constraints. We evaluate four versions of Autogrammar on three DSLs (i.e., Amazon CloudWatch Logs Insights, Dynatrace Query Language, and Datadog Search Syntax) and find that it generates grammars that achieve near perfect precision on unseen data; that temporal restrictions reduce execution time by 3.8x without incurring statistically-significant loss in precision; that execution data is crucial while documentation is dispensable; and that grammar-constrained decoding using Autogrammar-generated grammars significantly improves end-to-end LM performance on eight out of ten real tasks, matching or exceeding the performance of a professionally-maintained grammar. In comparison, the context-free grammars generated by existing LM baselines and a state-of-the-art formal technique perform significantly worse over the same evaluation. Tema degli esploratori: calcolo e infrastrutture (retro-catalogo arXiv: annunci del 2026-08-07 in cs.PL). Categorie arXiv: Programming Languages (cs.PL) ; Artificial Intelligence (cs.AI); Computation and Language (cs.CL); Software Engineering (cs.SE). Pagina del lavoro: https://arxiv.org/abs/2608.05493 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito). Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina. Letto il 2026-10-31T10:39:42.989Z dalla pagina https://arxiv.org/catchup/cs.PL/2026-08-07?abs=True (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).