Grammar-Constrained Decoding Makes Large Language Models Better Logical Parsers

Large Language Models (LLMs) have shown capabilities in various natural language processing tasks, yet they often struggle with logical reasoning, particularly when dealing with complex natural language statements.To address this challenge, approaches that combine LLMs with symbolic reasoners have been proposed, where the LLM translates the natural language statements into symbolic representations, which are then verified by an external symbolic solver.However, ensuring syntactic correctness in these translations remains a significant challenge.To address this, we propose to constrain the outputs of the LLMs using Grammar Constrained Decoding (GCD), showing that it consistently improves both syntactic correctness and accuracy in logical parsing tasks.Our findings demonstrate that grammar constraints can complement in-context examples, especially beneficial for resourceconstrained applications using smaller models.However, we observe that while GCD ensures syntactic validity, semantic errors not captured by Context-Free Grammars continue to pose challenges.Additionally, our results reveal a trade-off for larger models where unconstrained generation occasionally outperforms constrained decoding, aligning with recent theoretical work on bias introduced by constrained decoding.Our code and data is publicly available at:

Authors

Institutions

Publication Details

Published
2025-01-01
DOI
https://doi.org/10.18653/v1/2025.acl-industry.34
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-Constrained Decoding Makes Large Language Models Better Logical Parsers

Mike Holenderski, Tanır Özçelebi, Federico Raspanti
Natural Language Processing Techniques
article

Grammar-Constrained Decoding Makes Large Language Models Better Logical Parsers

Mike Holenderski, Tanır Özçelebi, Federico Raspanti
article en

Abstract

Large Language Models (LLMs) have shown capabilities in various natural language processing tasks, yet they often struggle with logical reasoning, particularly when dealing with complex natural language statements.To address this challenge, approaches that combine LLMs with symbolic reasoners have been proposed, where the LLM translates the natural language statements into symbolic representations, which are then verified by an external symbolic solver.However, ensuring syntactic correctness in these translations remains a significant challenge.To address this, we propose to constrain the outputs of the LLMs using Grammar Constrained Decoding (GCD), showing that it consistently improves both syntactic correctness and accuracy in logical parsing tasks.Our findings demonstrate that grammar constraints can complement in-context examples, especially beneficial for resourceconstrained applications using smaller models.However, we observe that while GCD ensures syntactic validity, semantic errors not captured by Context-Free Grammars continue to pose challenges.Additionally, our results reveal a trade-off for larger models where unconstrained generation occasionally outperforms constrained decoding, aligning with recent theoretical work on bias introduced by constrained decoding.Our code and data is publicly available at:

Eindhoven University of Technology (NL)
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.