arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.01926cs.CL
收藏

通过可处理提议缓解局部约束解码中的偏差

Mitigating Bias in Locally Constrained Decoding via Tractable Proposals

Stanford University(斯坦福大学);University of California, Berkeley(加州大学伯克利分校);Massachusetts Institute of Technology(麻省理工学院)

Meihua Dang, Linxin Song, Honghua Zhang, Jieyu Zhao, Guy Van den Broeck, Stefano Ermon

AI总结:

针对局部约束解码中因短视掩码导致的采样偏差,提出基于张量化有限自动机的全局约束解码提议和概率全局约束解码提议,结合序贯蒙特卡洛方法实现无偏采样,在函数调用、关键词生成和SQL生成任务中显著减少所需粒子数并加速收敛。

摘要:

大型语言模型的生成结果往往不符合期望的约束,如JSON模式。现有的局部约束解码(LCD)方法通过短视地掩蔽下一个词元来强制约束,导致采样偏差和性能下降。最近的工作使用序贯蒙特卡洛(SMC)方法来缓解此类偏差,但设计有效的提议分布或势函数仍然是一个关键挑战。在这项工作中,我们提出了一种通用方法来构建从 $p_{\mathrm{lm}}( \cdot \mid \mathrm{constraint})$ 进行SMC采样的提议和势函数。首先,我们证明了以有限自动机形式指定的约束可以张量化以在GPU上高效执行,我们利用这一点构建了全局约束解码(GCD)提议。此外,利用张量化有限自动机与隐马尔可夫模型共享相同电路结构的事实,我们通过电路乘法得到概率全局约束解码(P-GCD)提议,该提议编码了目标分布的逻辑和概率信息。我们在函数调用、基于关键词的生成和SQL生成任务上评估了(P-)GCD。实验表明,在相同的SMC采样设置下,与LCD提议相比,(P-)GCD以显著更少的粒子更快地收敛到目标分布。

英文摘要:

Generations from large language models often fail to conform to desired constraints such as JSON schema. Existing locally constrained decoding (LCD) approaches enforce constraints by myopically masking out next tokens, resulting in biased sampling and degradation in performance. Recent work uses sequential Monte Carlo (SMC) methods to mitigate such biases, but designing effective proposal distributions or potential functions remains a key challenge. In this work, we propose a generic approach to construct proposals and potentials for SMC sampling from $p_{\mathrm{lm}}( \cdot \mid \mathrm{constraint})$. First, we show that constraints specified as finite automata can be tensorized for efficient execution on GPUs, which we use to construct globally constrained decoding (GCD) proposals. In addition, leveraging the fact that tensorized finite automata share the same circuit structure as hidden Markov models, we circuit-multiply them to obtain the probabilistic GCD (P-GCD) proposals encoding both logical and probabilistic information about the target distributions. We evaluate (P-)GCD on the tasks of function calling, keyword-based generation, and SQL generation. Experiments show that under the same SMC sampling setup, compared to LCD proposals, (P-)GCD converges faster to the target distribution with significantly fewer particles.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑