arXiv Machine Learning

Stay Within Your Bounds: Distance-Guided Decoding for Guaranteed Context-Free Grammar Compliance

The paper introduces a distance‑guided decoding framework that guarantees context‑free grammar compliance for large language models. By precomputing bounded pushdown summaries with reachability labels and upper‑bound distances to acceptance, the decoder performs horizon‑aware pruning and beam search during generation. Experiments on JSON, SQL, and Linear Temporal Logic demonstrate consistent syntactic validity and improved completion quality compared to existing baselines.

arXiv AI
Oct 2

Accelerating Constrained Decoding with Token Space Compression

The paper introduces CFGzip, an offline token space compression technique that reduces the search space for context-free grammar (CFG) decoding engines. By compressing the token vocabulary, CFGzip achieves up to 75‑fold latency reductions during batched inference, bringing overhead on the hardest grammars down to roughly 1.2–2×. This enables scalable constrained decoding for complex CFGs that were previously impractical due to high computational costs.

By Michael Sullivan, Alexander Koller
arXiv AI
Nov 2

Specification-Guided Generation for Large Language Models

The paper introduces a specification-guided decoding framework that blends large language model generation with symbolic reasoning to enforce formal specifications during output generation. It offers a forward-only variant that guarantees compliance by construction and a backtracking variant that revises earlier choices when later constraints become unsatisfiable. The approach is model-agnostic, requires no retraining, and improves compliance on configuration and constraint-solving benchmarks while reducing repeated inference compared to rejection sampling.

By Alessandro Previti, Konstantinos Vandikas, Mario Alviano, Mats Carlsson, Albin Larsson Forsberg, Alexandros Nikou, Athanasios Karapantelakis, Aneta Vulgarakis
arXiv AI
Jul 15

GRID: Grammar-Railed Decoding for Enterprise SQL Generation

arXiv:2607. 11951v1 Announce Type: new Abstract: Large language models can write SQL, but enterprise deployment demands more than plausible text: outputs must be syntactically valid, must respect per-role and per-schema policy, must carry provable (not best-effort) guarantees, must not slow down as generations grow, and must leave a compliance-grade record of every decision.

By Mohsen Arjmandi
arXiv AI
Jul 22

Decode-Time Grammars: Constrained LLM Generation over a Refinement Order of Grammar Fragments

arXiv:2607. 18357v1 Announce Type: cross Abstract: Large language models now write a growing share of the world's code, increasingly inside agents and serving systems that compile, execute, or dispatch generated code without line-by-line review.

By Shuoming Zhang, Ruiyuan Xu, Haofeng Li, Qiuchu Yu, Yangyu Zhang, Chunwei Xia, Xiaobing Feng, Chenxi Wang, Huimin Cui, Jiacheng Zhao