arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.04688cs.CLcs.AIcs.FL

ToolGate: 以合同为基础并经过验证的工具执行用于LLMs

ToolGate: Contract-Grounded and Verified Tool Execution for LLMs

Zhejiang University(浙江大学);Southeast University(东南大学);Massachusetts Institute of Technology(麻省理工学院)

Yanming Liu, Xinyue Peng, Jiannan Cao, Xinyi Wang, Songhang Deng, Jintao Chen, Jianwei Yin, Xuhong Zhang

AI总结:

ToolGate通过形式化合同和验证机制,确保LLM调用工具时逻辑安全和状态演变的可验证性,提升系统可靠性与可调试性。

摘要:

大型语言模型(LLMs)结合外部工具在复杂推理任务中展现出了显著的能力。然而,现有框架严重依赖自然语言推理来决定何时调用工具以及是否应提交其结果,缺乏对逻辑安全性和可验证性的正式保证。我们提出了ToolGate,一种向前执行框架,它提供逻辑安全保证和可验证的状态演变。ToolGate维护一个显式的符号状态空间作为类型键值映射,代表受信任的世界信息在整个推理过程中。每个工具被形式化为一种Hoare风格的合同,包括前条件和后条件,其中前条件通过检查当前状态是否满足所需条件来阻止工具调用,而后条件通过运行时验证确定工具的结果是否可以提交以更新状态。我们的方法保证符号状态仅通过经过验证的工具执行演变,防止无效或幻觉的结果破坏世界表示。实验验证显示,ToolGate显著提高了增强LLM系统的可靠性和可验证性,同时在复杂多步推理任务上保持了竞争性的性能。这项工作为构建更可信赖和可调试的AI系统奠定了基础,这些系统整合了语言模型与外部工具。

英文摘要:

Large Language Models (LLMs) augmented with external tools have demonstrated remarkable capabilities in complex reasoning tasks. However, existing frameworks rely heavily on natural language reasoning to determine when tools can be invoked and whether their results should be committed, lacking formal guarantees for logical safety and verifiability. We present \textbf{ToolGate}, a forward execution framework that provides logical safety guarantees and verifiable state evolution for LLM tool calling. ToolGate maintains an explicit symbolic state space as a typed key-value mapping representing trusted world information throughout the reasoning process. Each tool is formalized as a Hoare-style contract consisting of a precondition and a postcondition, where the precondition gates tool invocation by checking whether the current state satisfies the required conditions, and the postcondition determines whether the tool's result can be committed to update the state through runtime verification. Our approach guarantees that the symbolic state evolves only through verified tool executions, preventing invalid or hallucinated results from corrupting the world representation. Experimental validation demonstrates that ToolGate significantly improves the reliability and verifiability of tool-augmented LLM systems while maintaining competitive performance on complex multi-step reasoning tasks. This work establishes a foundation for building more trustworthy and debuggable AI systems that integrate language models with external tools.

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

↑