GRAMMAR-LLM: Grammar-Constrained Natural Language Generation

Large Language Models have achieved impressive performance across various natural language generation tasks.However, their lack of a reliable control mechanism limits their effectiveness in applications that require strict adherence to predefined taxonomies, syntactic structures, or domain-specific rules.Existing approaches, such as fine-tuning and prompting, remain insufficient to ensure compliance with these requirements, particularly in lowresource scenarios and structured text generation tasks.To address these limitations, we introduce GRAMMAR-LLM, a novel framework that integrates formal grammatical constraints into the LLM decoding process.GRAMMAR-LLM enforces syntactic correctness in linear time while maintaining expressiveness in grammar rule definition.To achieve this, we define a class of grammars, called LL(prefix), -which we show to be equivalent to LL(1) -specifically designed for their use with LLMs.These grammars are expressive enough to support common tasks such as hierarchical classification, vocabulary restriction, and structured parsing.We formally prove that LL(prefix) grammars can be transformed into LL(1) grammars in linear time, ensuring efficient processing via deterministic pushdown automata.We evaluate GRAMMAR-LLM across diverse NLP tasks, including hierarchical classification, sign language translation, and semantic parsing.Our experiments, conducted on models such as LLaMA 3 (for classification and translation) and AMRBART (for parsing), demonstrate that GRAMMAR-LLM consistently improves task performance across zero-shot, few-shot, and fine-tuned settings 1 .

Authors

Publication Details

Published
2025-01-01
DOI
https://doi.org/10.18653/v1/2025.findings-acl.177
Primary Topic
Natural Language Processing Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

GRAMMAR-LLM: Grammar-Constrained Natural Language Generation

Misael Mongiovı̀, Aldo Gangemi, Luana Bulla, Maria Madonia et al.
Natural Language Processing Techniques
article

GRAMMAR-LLM: Grammar-Constrained Natural Language Generation

Misael Mongiovı̀, Aldo Gangemi, Luana Bulla, Maria Madonia, Gabriele Tuccio
article en

Abstract

Large Language Models have achieved impressive performance across various natural language generation tasks.However, their lack of a reliable control mechanism limits their effectiveness in applications that require strict adherence to predefined taxonomies, syntactic structures, or domain-specific rules.Existing approaches, such as fine-tuning and prompting, remain insufficient to ensure compliance with these requirements, particularly in lowresource scenarios and structured text generation tasks.To address these limitations, we introduce GRAMMAR-LLM, a novel framework that integrates formal grammatical constraints into the LLM decoding process.GRAMMAR-LLM enforces syntactic correctness in linear time while maintaining expressiveness in grammar rule definition.To achieve this, we define a class of grammars, called LL(prefix), -which we show to be equivalent to LL(1) -specifically designed for their use with LLMs.These grammars are expressive enough to support common tasks such as hierarchical classification, vocabulary restriction, and structured parsing.We formally prove that LL(prefix) grammars can be transformed into LL(1) grammars in linear time, ensuring efficient processing via deterministic pushdown automata.We evaluate GRAMMAR-LLM across diverse NLP tasks, including hierarchical classification, sign language translation, and semantic parsing.Our experiments, conducted on models such as LLaMA 3 (for classification and translation) and AMRBART (for parsing), demonstrate that GRAMMAR-LLM consistently improves task performance across zero-shot, few-shot, and fine-tuned settings 1 .

Quality Education
Openalex Percentile: Top 90%
Natural Language Processing Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

GRAMMAR-LLM: Grammar-Constrained Natural Language Generation — Misael Mongiovı̀, Aldo Gangemi, et al. · (2025) | TGRS Research Map | TGRS