Grammar-Aligned Decoding
Kanghee Park, Jiayu Wang, Taylor Berg-Kirkpatrick, Nadia Polikarpova, Loris D'Antoni

TL;DR
This paper introduces Grammar-Aligned Decoding (GAD), an adaptive sampling method that ensures outputs are both grammatical and probabilistically aligned with the LLM's distribution, improving structured output quality.
Contribution
The paper proposes the ASA p algorithm for grammar-aligned decoding, addressing distribution distortion in constrained decoding methods and ensuring outputs match the LLM's likelihoods under grammatical constraints.
Findings
ASAp often produces higher likelihood outputs than existing methods.
ASAp guarantees grammatical outputs while aligning with the LLM's distribution.
Evaluation on code and NLP tasks shows improved output quality.
Abstract
Large Language Models (LLMs) struggle with reliably generating highly structured outputs, such as program code, mathematical formulas, or well-formed markup. Constrained decoding approaches mitigate this problem by greedily restricting what tokens an LLM can output at each step to guarantee that the output matches a given constraint. Specifically, in grammar-constrained decoding (GCD), the LLM's output must follow a given grammar. In this paper, we demonstrate that GCD techniques (and in general constrained decoding techniques) can distort the LLM's distribution, leading to outputs that are grammatical but appear with likelihoods that are not proportional to the ones given by the LLM, and so ultimately are low-quality. We call the problem of aligning sampling with a grammar constraint, grammar-aligned decoding (GAD), and propose adaptive sampling with approximate expected futures…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
Taxonomy
TopicsNatural Language Processing Techniques
