paper-with-me

홈 › Papers

Grammar Prompting for Domain-Specific Language Generation with Large Language Models

2023-05-30 · NeurIPS 2023 11 · Bailin Wang, Zi Wang, Xuezhi Wang, Yuan Cao, Rif A. Saurous, Yoon Kim

Large language models (LLMs) can learn to perform a wide range of natural language tasks from just a handful of in-context examples. However, for generating strings from highly structured languages (e.g., semantic parsing to complex domain-specific languages), it is challenging for the LLM to generalize from just a few exemplars. We propose \emph{grammar prompting}, a simple approach to enable LLMs to use external knowledge and domain-specific constraints, expressed through a grammar in Backus--Naur Form (BNF), during in-context learning. Grammar prompting augments each demonstration example with a specialized grammar that is minimally sufficient for generating the particular output example, where the specialized grammar is a subset of the full DSL grammar. For inference, the LLM first predicts a BNF grammar given a test input, and then generates the output according to the rules of the grammar. Experiments demonstrate that grammar prompting can enable LLMs to perform competitively on a diverse set of DSL generation tasks, including semantic parsing (SMCalFlow, Overnight, GeoQuery), PDDL planning, and SMILES-based molecule generation.

📄 PDF Abstract BibTeX arXiv:2305.19234

Code (2)

berlino/grammar-prompting 공식 구현 pytorch
parkervg/blendsql

Tasks

In-Context LearningSemantic ParsingText Generation

Methods 이 논문이 사용한 방법론

Test 설명 없음

Similar Papers 제목 키워드 기반

Grammar Control in Dialogue Response Generation for Language Learning Chatbots

2025-02-11 · Dominik Glandorf, Peng Cui, Detmar Meurers, Mrinmaya Sachan

Chatbots based on large language models offer cheap conversation practice opportunities for language learners. However, they are hard to control for linguistic forms that correspond to learners' current needs, such as gr…

ChatbotLanguage AcquisitionResponse Generation

RuC: HDL-Agnostic Rule Completion Benchmark Generation

2026-04-30 · Arnau Ayguadé Domingo, Miquel Alberti-Binimelis, Cristian Gutierrez-Gomez, Emanuele Parisi 외 arxiv

Large Language Models (LLMs) have rapidly improved in performance across code-related tasks, making their integration into Register Transfer Level (RTL) development increasingly attractive. Mimicking the behavior of inli…

Code Completion

MURMUR: Modular Multi-Step Reasoning for Semi-Structured Data-to-Text Generation

2022-12-16 · Swarnadeep Saha, Xinyan Velocity Yu, Mohit Bansal, Ramakanth Pasunuru 외

Prompting large language models has enabled significant recent progress in multi-step reasoning over text. However, when applied to text generation from semi-structured data (e.g., graphs or tables), these methods typica…

Data-to-Text GenerationHallucinationText Generationvalid

Leveraging LLMs for Grammar Adaptation: A Study on Metamodel-Grammar Co-Evolution

2026-05-20 · Weixing Zhang, Bowen Jiang, Rahul Sharma, Regina Hebig 외 arxiv

In model-driven engineering, metamodel evolution leads to the need to adapt corresponding grammars to maintain consistency, which typically requires tedious manual work. Existing rule-based methods can achieve partial au…

An implementation of a Latvian resource grammar in Grammatical Framework

2012-05-01 · LREC 2012 5 · P{\=e}teris Paikens, Normunds Gr{\=u}z{\=\i}tis

This paper describes an open-source Latvian resource grammar implemented in Grammatical Framework (GF), a programming language for multilingual grammar applications. GF differentiates between concrete grammars and abstra…

Machine TranslationSemantic ParsingText GenerationTranslation