arXiv:2507.03254cs.AI2025-07被引 7

用伪代码结构化多智能体推理,提升规划效率与可解释性。

CodeAgents: A Token-Efficient Framework for Codified Multi-Agent Reasoning in LLMs

  • 将任务、计划、反馈等组件转化为带控制结构的模块化伪代码
  • 在多个基准上提升3-36个百分点,虚拟家庭任务达56%新高
  • 显著降低55%-87%输入/41%-70%输出令牌消耗,适合高效部署

有效提示设计对提升大语言模型驱动智能体的规划能力至关重要。然而,现有结构化提示策略通常局限于单智能体、仅规划场景,且仅以任务准确率评估性能,忽视了多智能体环境中令牌效率、模块化和可扩展性等关键因素。为此,我们提出CodeAgents,一种将多智能体推理编码化的提示框架,实现结构化、低令牌消耗的多智能体系统规划。在CodeAgents中,所有智能体交互组件——任务、计划、反馈、系统角色及外部工具调用——均被编码为包含循环、条件判断、布尔逻辑和类型变量的模块化伪代码。该设计将松散连接的智能体计划转化为连贯、可解释、可验证的多智能体推理程序。我们在GAIA、HotpotQA和VirtualHome三个多样化基准上,使用多种代表性LLM进行评估。结果表明,规划性能持续提升,绝对增益达3-36个百分点,优于自然语言提示基线。在VirtualHome上,方法达到56%的新状态最优成功率。此外,该方法将输入和输出令牌使用量分别减少55%-87%和41%-70%,凸显了在可扩展多智能体系统开发中采用令牌感知评估指标的重要性。代码与资源已公开:https://anonymous.4open.science/r/CodifyingAgent-5A86

原文摘要 · Abstract (English)

Effective prompt design is essential for improving the planning capabilities of large language model (LLM)-driven agents. However, existing structured prompting strategies are typically limited to single-agent, plan-only settings, and often evaluate performance solely based on task accuracy - overlooking critical factors such as token efficiency, modularity, and scalability in multi-agent environments. To address these limitations, we introduce CodeAgents, a prompting framework that codifies multi-agent reasoning and enables structured, token-efficient planning in multi-agent systems. In CodeAgents, all components of agent interaction - Task, Plan, Feedback, system roles, and external tool invocations - are codified into modular pseudocode enriched with control structures (e.g., loops, conditionals), boolean logic, and typed variables. This design transforms loosely connected agent plans into cohesive, interpretable, and verifiable multi-agent reasoning programs. We evaluate the proposed framework across three diverse benchmarks - GAIA, HotpotQA, and VirtualHome - using a range of representative LLMs. Results show consistent improvements in planning performance, with absolute gains of 3-36 percentage points over natural language prompting baselines. On VirtualHome, our method achieves a new state-of-the-art success rate of 56%. In addition, our approach reduces input and output token usage by 55-87% and 41-70%, respectively, underscoring the importance of token-aware evaluation metrics in the development of scalable multi-agent LLM systems. The code and resources are available at: https://anonymous.4open.science/r/CodifyingAgent-5A86

多智能体提示工程代码生成效率优化

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