mlsanityData to 7 Oct 2026

Guiding Large Language Models to Generate Computer-Parsable Content

arXiv 2404.05499 ↗First posted 8 Apr 2024cs.SE cs.AIcited by 4

Not on the map. Why?

Abstract (arXiv)

We propose a method to guide Large Language Models (LLMs) in generating structured content adhering to specific conventions without fine-tuning. By utilizing coroutine-based content generation constraints through a pre-agreed context-free grammar (CFG), LLMs are directed during decoding to produce formal language compliant outputs. This enhances stability and consistency in generating target data structures, types, or instructions, reducing application development complexities. Experimentally, error rates of GPT-2 and Gemma exceed 95% for DSLs longer than 36 and 282 tokens, respectively. We introduce YieldLang, a coroutine-based DSL generation framework, and evaluate it with LLMs on various tasks including JSON and Mermaid flowchart generation. Compared to benchmarks, our approach improves accuracy by 1.09 to 11.6 times, with LLMs requiring only about 16.5% of the samples to generate JSON effectively. This enhances usability of LLM-generated content for computer programs.

Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Builds on 11 of its 48 references that are in the map. First posted on arXiv 8 Apr 2024.

Builds on

11 of 48 references.

References · 11

  1. 2017Attention Is All You Needcited by 59,932
  2. 2023GPT-4 Technical Reportcited by 18,132
  3. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  4. 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,355
  5. 2024Gemma: Open Models Based on Gemini Research and Technologycited by 889
  6. 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 402
  7. 2023Grammar-Constrained Decoding for Structured NLP Tasks without Finetuningcited by 186
  8. 2023Mitigating the Alignment Tax of RLHFcited by 181
  9. 2023Grammar Prompting for Domain-Specific Language Generation with Large Language Modelscited by 58
  10. 2023Cost-Effective Hyperparameter Optimization for Large Language Model Generation Inferencecited by 40
  11. 2022Q# as a Quantum Algorithmic Languagecited by 1

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 2; 2025: 0; 2026: 2.

4 papers.