arXiv:2504.08725cs.SEcs.AI2025-04ACL被引 35

用多智能体协作生成更完整准确的代码文档

DocAgent: A Multi-Agent System for Automated Code Documentation Generation

  • 分角色智能体协同:读取、搜索、撰写、验证、调度分工明确
  • 综合评估框架下,文档完整度、有用性、真实性均显著优于基线
  • 适合复杂私有代码库,提升AI辅助开发可靠性

高质量代码文档对软件开发至关重要,尤其在人工智能时代。然而,利用大语言模型(LLMs)自动生成功能文档仍具挑战,现有方法常产生不完整、无用或事实错误的内容。我们提出DocAgent,一种基于拓扑结构处理顺序的多智能体协作系统,通过专门设计的阅读者、搜索者、撰写者、验证者与调度者等智能体协同生成文档。我们还构建了涵盖完整性、实用性与真实性的多维度评估框架。全面实验表明,DocAgent在各项指标上均显著优于现有基线方法。消融研究证实拓扑处理顺序的关键作用。该系统为复杂及专有代码仓库提供了可靠的自动化文档生成方案。

原文摘要 · Abstract (English)

High-quality code documentation is crucial for software development especially in the era of AI. However, generating it automatically using Large Language Models (LLMs) remains challenging, as existing approaches often produce incomplete, unhelpful, or factually incorrect outputs. We introduce DocAgent, a novel multi-agent collaborative system using topological code processing for incremental context building. Specialized agents (Reader, Searcher, Writer, Verifier, Orchestrator) then collaboratively generate documentation. We also propose a multi-faceted evaluation framework assessing Completeness, Helpfulness, and Truthfulness. Comprehensive experiments show DocAgent significantly outperforms baselines consistently. Our ablation study confirms the vital role of the topological processing order. DocAgent offers a robust approach for reliable code documentation generation in complex and proprietary repositories.

代码生成多智能体文档生成

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