Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning
摘要
Despite their impressive performance, large language models (LMs) still struggle with reliably generating complex output structures when not finetuned to follow the required output format exactly. To address this issue, grammarconstrained decoding (GCD) can be used to control the generation of LMs, guaranteeing that the output follows a given structure. Most existing GCD methods are, however, limited to specific tasks, such as parsing or code generation. In this work, we demonstrate that formal grammars can describe the output space for a much wider range of tasks and argue that GCD can serve as a unified framework for structured NLP tasks in general. For increased flexibility, we introduce input-dependent grammars, which allow the grammar to depend on the input and thus enable the generation of different output structures for different inputs. We then empirically demonstrate the power and flexibility of GCD-enhanced LMs on (1) information extraction, (2) entity disambiguation, and (3) constituency parsing. Our results indicate that grammar-constrained LMs substantially outperform unconstrained LMs or even beat task-specific finetuned models. Grammar constraints thus hold great promise for harnessing off-the-shelf LMs for a wide range of structured NLP tasks, especially where training data is scarce or finetuning is expensive. Code and data: https://github.com/epfl-dlab/GCD .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 45 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Grammar-Aligned Decoding 引用了 Synchromesh: Reliable Code Generation from Pre-trained Language Models
- Grammar-Aligned Decoding 引用了 Grammar Prompting for Domain-Specific Language Generation with Large Language Models
- Learning to Generate Structured Output with Schema Reinforcement Learning 引用了 Synchromesh: Reliable Code Generation from Pre-trained Language Models
- Grammar Prompting for Domain-Specific Language Generation with Large Language Models 引用了 Synchromesh: Reliable Code Generation from Pre-trained Language Models
- Synthetic Programming Elicitation for Text-to-Code in Very Low-Resource Programming and Formal Languages 引用了 Grammar Prompting for Domain-Specific Language Generation with Large Language Models
引用它的顶会 Paper45
- Guiding LLMs The Right Way: Fast, Non-Invasive Constrained GenerationLuca Beurer-Kellner, Marc Fischer, Martin T. VechevICML 2024 · 93 次引用
- Grammar-Aligned DecodingKanghee Park, Jiayu Wang, Taylor Berg-Kirkpatrick, Nadia Polikarpova 等NeurIPS 2024 · 73 次引用
- An Autoregressive Text-to-Graph Framework for Joint Entity and Relation ExtractionUrchade Zaratiana, Nadi Tomeh, Pierre Holat, Thierry CharnoisAAAI 2024 · 39 次引用
- Learning to Generate Structured Output with Schema Reinforcement LearningYaxi Lu, Haolun Li, Xin Cong, Zhong Zhang 等ACL 2025 · 21 次引用
- Synthetic Programming Elicitation for Text-to-Code in Very Low-Resource Programming and Formal LanguagesFederico Mora, Justin Wong, Haley Lepe, Sahil Bhatia 等NeurIPS 2024 · 21 次引用
它引用的 Paper10
- LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu 等ICLR 2022 · 18,833 次引用
- Scalable Zero-shot Entity Linking with Dense Entity RetrievalLedell Wu, Fabio Petroni, Martin Josifoski, Sebastian Riedel 等EMNLP 2020 · 336 次引用
- REBEL: Relation Extraction By End-to-end Language generationPere-Lluís Huguet Cabot, Roberto NavigliEMNLP Findings 2021 · 262 次引用
- Synchromesh: Reliable Code Generation from Pre-trained Language ModelsGabriel Poesia, Alex Polozov, Vu Le, Ashish Tiwari 等ICLR 2022 · 200 次引用
- Grammar Prompting for Domain-Specific Language Generation with Large Language ModelsBailin Wang, Zi Wang, Xuezhi Wang, Yuan Cao 等NeurIPS 2023 · 138 次引用
相关 Paper
- Flexible and Efficient Grammar-Constrained DecodingKanghee Park, Timothy Zhou, Loris D'AntoniICML 2025
- Constrained Decoding of Diffusion LLMs with Context-Free GrammarsNiels Mündler, Jasper Dekoninck, Martin VechevICLR 2026 · 18 次引用
- GRAMMAR-LLM: Grammar-Constrained Natural Language GenerationGabriele Tuccio, Luana Bulla, Maria Madonia, Aldo Gangemi 等ACL Findings 2025 · 5 次引用
- Bridging the Gap: Aligning Language Model Generation with Structured Information Extraction via Controllable State TransitionHao Li, Yubing Ren, Yanan Cao, Yingjie Li 等WWW 2025
- Efficient Grammar-Constrained Decoding via Parser Stack ClassificationYongmin Li, Yihong Dong, Jia Li, Ge LiISSTA 2026
