2025-02-18 · 专家 · 自然语言处理 · 机器学习

CRANE: Reasoning with constrained LLM generation

本文提出了CRANE算法,通过在受限解码中增加推理步骤,有效地平衡了语法正确性和推理能力,显著提高了符号推理任务的准确性。

更新于 2025-02-18。作者:Debangshu Banerjee、Tarun Suresh、Shubham Ugare、Sasa Misailovic、Gagandeep Singh。

中文摘要

代码生成、符号数学推理以及其他任务要求LLM(大型语言模型)产生在语法和语义上都正确的输出。受约束的LLM生成是一个有希望的途径,用以强制遵守正式的语法,但先前的研究通过实证观察到,严格实施形式约束往往会降低LLM的推理能力。在这项工作中,我们首先提供了一个理论解释,说明了为什么将LLM的输出限制在非常严格的语法中,只允许语法上有效的最终答案,会降低模型的推理能力。其次,我们证明,通过在输出语法中添加精心设计的额外规则,总是可以保留LLM的推理能力,同时确保其输出的语法和语义正确性。基于这些理论洞察,我们提出了一个推理增强的受约束解码算法CRANE,该算法有效地平衡了受约束生成与无约束生成的灵活性。在多个开源LLM和基准测试上的实验表明,CRANE在受约束解码策略和标准无约束解码方面都显著优于现有技术,在具有挑战性的符号推理基准GSM-symbolic和FOLIO上,相对于基线实现了高达10个百分点的准确率提升。

英文摘要

Code generation, symbolic math reasoning, and other tasks require LLMs to produce outputs that are both syntactically and semantically correct. Constrained LLM generation is a promising direction to enforce adherence to formal grammar, but prior works have empirically observed that strict enforcement of formal constraints often diminishes the reasoning capabilities of LLMs. In this work, we first provide a theoretical explanation for why constraining LLM outputs to very restrictive grammars that only allow syntactically valid final answers reduces the reasoning capabilities of the model. Second, we demonstrate that by augmenting the output grammar with carefully designed additional rules, it is always possible to preserve the reasoning capabilities of the LLM while ensuring syntactic and semantic correctness in its outputs. Building on these theoretical insights, we propose a reasoning-augmented constrained decoding algorithm, CRANE, which effectively balances the correctness of constrained generation with the flexibility of unconstrained generation. Experiments on multiple open-source LLMs and benchmarks show that CRANE significantly outperforms both state-of-the-art constrained decoding strategies and standard unconstrained decoding, showing up to 10% points accuracy improvement over baselines on challenging symbolic reasoning benchmarks GSM-symbolic and FOLIO.

解读

一句话总结

本文提出了CRANE算法,通过在受限解码中增加推理步骤,有效地平衡了语法正确性和推理能力,显著提高了符号推理任务的准确性。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源