arXiv:2511.08715cs.AI2025-11

用AMR解析和小模型结合,把自然语言变逻辑谜题的可执行代码

Bridging Natural Language and ASP: A Hybrid Approach Using LLMs and AMR Parsing

  • 先用LLM简化语句、提取关键词,再通过AMR图结构化语义
  • 自动生成包含规则、事实和约束的完整ASP程序,准确求解逻辑谜题
  • 比纯大模型方法更轻量可解释,适合非编程者解决复杂逻辑问题

答案集编程(ASP)是一种基于逻辑编程和非单调推理的声明式编程范式,是描述和求解组合问题的强大工具。然而,用户需学习其工作原理和语法,对不熟悉编程的人仍具门槛。本文提出一种新方法,利用大语言模型(LLM)与抽象意义表示(AMR)图相结合,将自由形式的英文自然语言翻译为用于逻辑谜题的ASP程序。系统自动生成完整的ASP规则、事实和约束,以充分表达并求解目标问题。实验采用典型逻辑谜题验证系统能力。不同于当前多数依赖全量LLM的方法,本系统仅让LLM处理简单任务,如简化句子、识别关键词、生成基础事实;随后通过解析简化后的自然语言生成的AMR图,系统性地推导出ASP约束。结果表明,该方法能成功构建完整可执行的ASP程序来求解组合逻辑问题。这一方案为构建轻量级、可解释的自然语言到逻辑编程转换系统迈出了重要一步。

原文摘要 · Abstract (English)

Answer Set Programming (ASP) is a declarative programming paradigm based on logic programming and non-monotonic reasoning. It is a tremendously powerful tool for describing and solving combinatorial problems. Like any other language, ASP requires users to learn how it works and the syntax involved. It is becoming increasingly required for those unfamiliar with programming languages to interact with code. This paper proposes a novel method of translating unconstrained English into ASP programs for logic puzzles using an LLM and Abstract Meaning Representation (AMR) graphs. Everything from ASP rules, facts, and constraints is generated to fully represent and solve the desired problem. Example logic puzzles are used to demonstrate the capabilities of the system. While most current methods rely entirely on an LLM, our system minimizes the role of the LLM only to complete straightforward tasks. The LLM is used to simplify natural language sentences, identify keywords, and generate simple facts. The AMR graphs are then parsed from simplified language and used to generate ASP constraints systematically. The system successfully creates an entire ASP program that solves a combinatorial logic problem. This approach is a significant first step in creating a lighter-weight, explainable system that converts natural language to solve complex logic problems.

自然语言编程ASPAMR逻辑推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。