收录解读
扩散语言模型允许并行填充不同位置,传统从左到右的语法约束难以直接适配,动态构造解析状态又会引入高昂开销。
DConstrain 编译上下文参数化的状态转移,把约束复用与在线解码分离,并为任意位置填充提供可行性检查。
两个模型家族的 BFCL 实验验证了约束生成与工具调用表现;与 DINGO-Opt 共同成功样本相比,端到端加速为 6.65–46.26 倍,不能外推到所有 schema。
该接口为扩散式结构化生成提供实质方法进展。JSONSchemaBench 覆盖尚不完整,最坏状态复杂度仍高,适用范围需要显式限定。
原始摘要
Diffusion language models (DLMs) decode multiple tokens in parallel, so individually valid tokens can be incompatible together under a schema. Exact joint inference over a grammar graph enforces compatibility, but it requires token-labeled successors across many hypothetical parser configurations. Encoding stacks and field histories in compiled states can cause exponential growth, which forces prior exact decoders to fix property orders and exclude valid outputs. We present DConstrain, which compiles schemas into context-parameterized transition programs. Cold compilation specializes token consumption to local grammar states while retaining context-dependent stack operations, environment guards, and caller-dependent deferred parsing symbolically. Tracking field histories as runtime values supports arbitrary property order without enumerating field subsets offline. At runtime, warm compilation binds reached configurations to these programs to construct exact successors, overlapping with the model forward pass because graph construction requires no model scores. Furthermore, token-effect grouping merges tokens with identical compiled effects before runtime contexts are bound, so groups are reused across stacks and environments even when concrete successors differ. Objective-specific score aggregation and token restoration provably preserve both the Viterbi optimum and the token-labeled path distribution of ungrouped inference. Across three benchmarks and two DLM families, DConstrain compiles 100% of BFCL schemas under arbitrary property orders, whereas an optimized finite-state baseline compiles only 71.30-85.81%. Under arbitrary property order, it reduces BFCL end-to-end decoding latency by 6.65-46.26 times with 100% schema validity and raises DiffusionGemma's BFCL accuracy from 37.27% under fixed order to 81.56%.