Scholay

学术搜索 · AI 审稿 · LaTeX 协作

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

作者:Association for Computational Linguistics 2026, Raihan Sultan Pasha Basuki, Yutong Cheng, Peng Gao, Rizky Kusnaryanto · 发表于:Underline Science Inc. · 年份:2026 · DOI:10.48448/0tfw-4g31 · 研究领域:Computer science、Natural language processing、Programming language、Artificial intelligence

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 has adopted a structured reasoning paradigm that parses first-order logic (FOL) rules from natural language and delegates inference to automated solvers. With the rise of large language models (LLMs), methods such as GCD and CODE4LOGIC leverage their reasoning and code generation capabilities to enhance logic parsing. However, these approaches suffer from (1) fragile syntax control, due to weak enforcement of global grammar consistency, and (2) low semantic faithfulness, as they lack fine-grained clause-level semantic understanding. To address these challenges, we propose NL2Logic, a framework that uses the Abstract Syntax Tree (AST) as an intermediate reasoning layer to translate natural language into logic expressions with both semantic fidelity and syntactic precision. It consists of a recursive LLM-based semantic parser that constructs a precise AST capturing clause-level semantics, and an AST-guided generator that deterministically compiles the parsed logic into solver-ready code through a two-pass algorithm. On the FOLIO and LogicNLI benchmarks, NL2Logic attains 99% syntactic accuracy and improves semantic correctness by 30% over state-of-the-art baselines, establishing a promising pathway for verifiable natural language reasoning.