用Prolog实现确定性逻辑推理,解决大模型在安全领域易幻觉的问题。
Euclid-MCP: A Model Context Protocol Server for Deterministic Logical Reasoning via Prolog
- 通过中间表示将逻辑规则转为Prolog可执行形式
- 在真实安全合规场景中实现零幻觉、低延迟的精确推理
- 适合需要可靠推理的AI助手与智能体系统
大型语言模型在自然语言理解与生成方面表现优异,但在多步逻辑推理上仍不可靠,尤其在安全关键或合规敏感领域。现有神经符号方法虽结合神经模型与符号引擎,但多数集成方式定制化严重,缺乏标准化工具接口。本文提出Euclid-MCP,一个开源MCP服务器,基于SWI-Prolog实现确定性逻辑推理。其引入Euclid-IR,一种与引擎无关的赫恩子句中间表示,具备人类可读、大模型易生成、可编译为Prolog或其他后端的优点。该服务器提供紧凑的工具接口,支持‘翻译-执行-检查-修复’循环,使大模型客户端可委托推理任务,同时保留对证明轨迹与推导日志的完全访问权。我们在真实的IT安全与合规用例中评估了Euclid-MCP。结果表明,尽管大模型在小知识库上足够有效,但在大规模问题上会系统性产生幻觉;而Euclid-MCP能提供精确答案,且延迟更低、输出更紧凑。我们主张语义RAG本质上不适用于规则强制,而Euclid-MCP可作为大模型助手与智能体系统的稳定共享推理底座。
原文摘要 · Abstract (English)
Large Language Models (LLMs) excel at natural language understanding and generation but remain unreliable for multi-step logical reasoning, especially in safety-critical or compliance-sensitive domains. Recent neuro-symbolic approaches address this gap by coupling neural models with external symbolic engines, yet most integrations are bespoke and lack a standardized interface for tool-augmented agents. This paper presents Euclid-MCP, an open-source MCP server that provides deterministic logical reasoning via SWI-Prolog. Euclid-MCP introduces Euclid-IR, an engine-agnostic intermediate representation for Horn-clause logic that is human-readable, easy for LLMs to generate, and straightforward to compile into Prolog or alternative backends. The server exposes a compact tool interface that supports a translate-run-inspect-repair loop, enabling LLM clients to delegate inference while retaining full access to proof traces and derivation logs. We evaluate Euclid-MCP on a realistic IT security and compliance use case. Results show that while LLMs alone are sufficient on small knowledge bases, they hallucinate systematically on larger problems, whereas Euclid-MCP delivers exact answers with lower latency and more compact outputs. We argue that semantic RAG is fundamentally unsuited for rule enforcement, and that Euclid-MCP can serve as a stable, shared reasoning substrate for both RAG-based assistants and agentic systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。