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

NL2LOGIC: 基于抽象语法树的自然语言到一阶逻辑翻译框架

NL2LOGIC: AST-Guided Translation of Natural Language into First-Order Logic with Large Language Models

Virginia Tech(弗吉尼亚理工大学);Universitas Ary Ginanjar(阿里·金纳jar大学)

Rizky Ramadhana Putra, Raihan Sultan Pasha Basuki, Yutong Cheng, Peng Gao

AI总结:

NL2LOGIC通过引入抽象语法树,结合递归大语言模型和生成器,实现了高准确性的自然语言到一阶逻辑转换,提升了逻辑求解的准确性和可执行性。

摘要:

自动化推理在法律和治理领域至关重要,因为在文档中验证声明与事实之间的关系需要准确性和可解释性。最近的研究采用结构化推理流程,将自然语言转换为一阶逻辑并委托给自动求解器进行推理。随着大语言模型的兴起,如GCD和CODE4LOGIC等方法利用其推理和代码生成能力来改进逻辑解析。然而,这些方法由于对全局语法约束的弱执行导致语法控制脆弱,且由于对子句级语义理解不足导致语义忠实度低。我们提出NL2LOGIC,一种将自然语言转换为一阶逻辑的框架,引入了抽象语法树作为中间表示。NL2LOGIC结合了递归大型语言模型的语义解析器和基于抽象语法树的生成器,能够确定性地生成求解器准备的逻辑代码。在FOLIO、LogicNLI和ProofWriter基准测试中,NL2LOGIC实现了99%的语法准确性,并在状态-of-the-art基线上将语义正确性提高了30%。此外,将NL2LOGIC集成到Logic-LM中,使其可执行性接近完美,并将下游推理准确性提高了31%,相比Logic-LM原来的少样本无约束翻译模块。

英文摘要:

Automated reasoning is critical in domains such as law and governance, where verifying claims against facts in documents requires both accuracy and interpretability. Recent work adopts structured reasoning pipelines that translate natural language into first-order logic and delegate inference to automated solvers. With the rise of large language models, approaches such as GCD and CODE4LOGIC leverage their reasoning and code generation capabilities to improve logic parsing. However, these methods suffer from fragile syntax control due to weak enforcement of global grammar constraints and low semantic faithfulness caused by insufficient clause-level semantic understanding. We propose NL2LOGIC, a first-order logic translation framework that introduces an abstract syntax tree as an intermediate representation. NL2LOGIC combines a recursive large language model based semantic parser with an abstract syntax tree guided generator that deterministically produces solver-ready logic code. Experiments on the FOLIO, LogicNLI, and ProofWriter benchmarks show that NL2LOGIC achieves 99 percent syntactic accuracy and improves semantic correctness by up to 30 percent over state-of-the-art baselines. Furthermore, integrating NL2LOGIC into Logic-LM yields near-perfect executability and improves downstream reasoning accuracy by 31 percent compared to Logic-LM's original few-shot unconstrained translation module.

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

↑