跳到正文
arXiv (AI + Vision + Imaging)· Hantao Hua, Jiming Su, Yonggang Che, Feng Zhu·· 1 天前AI 评分17

GramDelta:面向运行时语法演化的增量约束解码框架

From Grammar Deltas to Token Masks: Incremental Constrained Decoding under Runtime Grammar Evolution

AI 导读

GramDelta 是面向运行时语法演化的增量约束解码框架,通过维护已提交前缀的解析状态、仅传播新增语法规则引发的变更,避免前缀重放。它将更新后的解析状态经无编译的因子化投影映射为精确的下一 token 掩码,省去每次更新重新编译掩码缓存。在四组模型配置上,持续语法演化下首次语法更新延迟中位数降低 10.7–11.5 倍,相对最强重建基线,额外 TPOT 开销减少 53.1–81.9%。

正文 · 原文

arXiv:2611.32807v1 Announce Type: new Abstract: Grammar-constrained decoding enables large language models to generate outputs that satisfy formal constraints, but in code and domain-specific language generation, the relevant constraints are not always fully available before decoding and may emerge progressively from new declarations, inferred type information, or runtime analysis feedback. Existing structured-decoding engines efficiently handle fixed, predeclared, or previously seen constraint structures; however, when a first-seen grammar update changes the parser state induced by an already committed prefix, the straightforward solution reconstructs the constraint state under the updated grammar, repeating parsing work already performed over the prefix. We introduce GramDelta, an incremental framework for constrained decoding with append-only runtime grammar updates. GramDelta maintains parse state over the committed prefix and propagates only changes induced by newly added grammar rules through historical dependencies, avoiding prefix replay. It then maps the updated parse state to exact next-token masks via compilation-free factorized projection over shared historical charts, avoiding per-update mask-cache recompilation. GramDelta therefore preserves the result of full reconstruction while making update cost sensitive to the actual impact of a grammar change. Experiments across four model configurations show that GramDelta adds negligible overhead without updates; under sustained runtime grammar evolution, it reduces median first-seen grammar-update latency by 10.7--11.5x and reduces the additional TPOT overhead over unconstrained decoding by 53.1--81.9% relative to the strongest reconstruction baseline. These results enable efficient constrained decoding when constraints progressively emerge and evolve with the generated prefix.

来源:arXiv (AI + Vision + Imaging) · arxiv.org