mlsanityData to 14 Oct 2026

HyGenar: An LLM-Driven Hybrid Genetic Algorithm for Few-Shot Grammar Generation

arXiv 2505.16978 ↗First posted 22 May 2025cs.AI cs.PLcited by 2

Not on the map. Why?

Abstract (arXiv)

Grammar plays a critical role in natural language processing and text/code generation by enabling the definition of syntax, the creation of parsers, and guiding structured outputs. Although large language models (LLMs) demonstrate impressive capabilities across domains, their ability to infer and generate grammars has not yet been thoroughly explored. In this paper, we aim to study and improve the ability of LLMs for few-shot grammar generation, where grammars are inferred from sets of a small number of positive and negative examples and generated in Backus-Naur Form. To explore this, we introduced a novel dataset comprising 540 structured grammar generation challenges, devised 6 metrics, and evaluated 8 various LLMs against it. Our findings reveal that existing LLMs perform sub-optimally in grammar generation. To address this, we propose an LLM-driven hybrid genetic algorithm, namely HyGenar, to optimize grammar generation. HyGenar achieves substantial improvements in both the syntactic and semantic correctness of generated grammars across LLMs.

Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 9 of its 34 references that are in the map. First posted on arXiv 22 May 2025.

Builds on

9 of 34 references.

References · 9

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
  3. 2023Teaching Large Language Models to Self-Debugcited by 988
  4. 2024A Survey on Large Language Models for Code Generationcited by 658
  5. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  6. 2024Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generationcited by 101
  7. 2017Inducing Regular Grammars Using Recurrent Neural Networkscited by 2
  8. 2022Grammars for Free: Toward Grammar Inference for Ad Hoc Parserscited by 2
  9. 2023Genetic Algorithms for Searching a Matrix of Metagrammars for Synthesiscited by 1

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 2.

2 papers.