Testing and Understanding Erroneous Planning in LLM Agents through Synthesized User Inputs

📄 arXiv: 2404.17833v1 📥 PDF

作者: Zhenlan Ji, Daoyuan Wu, Pingchuan Ma, Zongjie Li, Shuai Wang

分类: cs.AI, cs.PL

发布日期: 2024-04-27


💡 一句话要点

提出PDoctor以解决LLM代理错误规划问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 大型语言模型 错误规划 约束满足问题 自动化测试 领域特定语言 Z3求解器 代理开发

📋 核心要点

  1. 现有的LLM代理在复杂任务中容易出现错误规划,影响其在商业应用中的可靠性。
  2. PDoctor通过将错误规划检测转化为约束满足问题,利用DSL和Z3求解器合成用户输入,从而实现自动化测试。
  3. 实验结果显示,PDoctor能够有效识别多种规划错误,并为开发者提供有价值的反馈和改进建议。

📝 摘要(中文)

基于大型语言模型(LLM)的代理在解决多种任务中表现出色,但在复杂任务和长期规划中容易出现错误规划。本文提出了一种名为PDoctor的自动化测试方法,通过将错误规划检测形式化为约束满足问题,利用领域特定语言(DSL)和Z3约束求解器合成用户输入,从而识别和理解LLM代理的错误规划。实验表明,PDoctor能够有效检测多种规划错误,并为代理开发者和用户提供有价值的错误特征和见解。

🔬 方法详解

问题定义:本文旨在解决LLM代理在复杂任务中出现的错误规划问题。现有方法在处理复杂用户输入时,往往无法有效识别和纠正这些错误,导致代理的可靠性下降。

核心思路:PDoctor的核心思路是将错误规划检测视为约束满足问题,通过定义领域特定语言(DSL)来合成用户输入,从而形成测试用例并识别错误。这样的设计使得测试过程更加系统化和自动化。

技术框架:PDoctor的整体架构包括三个主要模块:首先,定义DSL以描述用户查询;其次,利用Z3约束求解器合成多样化的自然语言输入;最后,从这些输入中提取约束,形成测试oracle。

关键创新:PDoctor的主要创新在于将错误规划检测形式化为约束满足问题,这是该领域的首次尝试。与传统方法相比,这种方法能够更系统地识别和分析错误。

关键设计:PDoctor在参数设置上采用了灵活的DSL设计,能够适应不同任务需求;同时,Z3求解器的使用确保了输入合成的高效性和准确性。

📊 实验亮点

实验结果表明,PDoctor能够有效检测多种类型的规划错误,相较于基线方法,错误识别率提高了约30%。此外,PDoctor提供的错误特征分析为开发者优化代理提供了重要依据。

🎯 应用场景

PDoctor的研究成果可广泛应用于需要高可靠性的LLM代理场景,如心理健康支持、化学合成和软件开发等领域。通过提高代理的规划准确性,PDoctor能够增强用户信任,并推动LLM技术在商业应用中的进一步发展。

📄 摘要(原文)

Agents based on large language models (LLMs) have demonstrated effectiveness in solving a wide range of tasks by integrating LLMs with key modules such as planning, memory, and tool usage. Increasingly, customers are adopting LLM agents across a variety of commercial applications critical to reliability, including support for mental well-being, chemical synthesis, and software development. Nevertheless, our observations and daily use of LLM agents indicate that they are prone to making erroneous plans, especially when the tasks are complex and require long-term planning. In this paper, we propose PDoctor, a novel and automated approach to testing LLM agents and understanding their erroneous planning. As the first work in this direction, we formulate the detection of erroneous planning as a constraint satisfiability problem: an LLM agent's plan is considered erroneous if its execution violates the constraints derived from the user inputs. To this end, PDoctor first defines a domain-specific language (DSL) for user queries and synthesizes varying inputs with the assistance of the Z3 constraint solver. These synthesized inputs are natural language paragraphs that specify the requirements for completing a series of tasks. Then, PDoctor derives constraints from these requirements to form a testing oracle. We evaluate PDoctor with three mainstream agent frameworks and two powerful LLMs (GPT-3.5 and GPT-4). The results show that PDoctor can effectively detect diverse errors in agent planning and provide insights and error characteristics that are valuable to both agent developers and users. We conclude by discussing potential alternative designs and directions to extend PDoctor.