arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2511.03404cs.SE
收藏

通过多智能体协作与语义架构建模实现现实的项目级代码生成

Towards Realistic Project-Level Code Generation via Multi-Agent Collaboration and Semantic Architecture Modeling

Beihang University(北京航空航天大学);Software IDE Innovation Lab, Huawei Central Software Institute(软件IDE创新实验室,华为中央软件研究所)

Qianhui Zhao, Li Zhang, Fang Liu, Junhang Cheng, Chengru Wu, Junchen Ai, Qiaoyuanhe Meng, Lichen Zhang, Xiaoli Lian, Shubin Song, Yuanping Guo

AI总结:

针对项目级代码生成中数据集不切实际和语义鸿沟等问题,提出多智能体框架ProjectGen与语义软件架构树(SSAT),在DevBench和CodeProjectEval数据集上分别实现57%和约十倍的性能提升。

摘要:

近年来,大型语言模型(LLMs)在自动化代码生成方面取得了显著进展。在现实世界的软件工程中,对快速迭代和持续交付日益增长的需求凸显了项目级代码生成的重要性,即期望LLMs直接根据复杂的用户需求生成完整的软件项目。尽管现有研究已进行了初步探索,但仍面临关键局限性:包括不切实际的数据集和无法反映现实世界复杂性的不可靠评估指标;人类编写的需求与机器可解释结构之间的语义鸿沟;以及在生成过程中管理分层依赖和维持质量的困难。为了解决这些局限性,我们首先引入了CodeProjectEval,这是一个项目级代码生成数据集,基于18个真实世界的代码库构建,平均每个任务包含12.7个文件和2,388.6行代码,并辅以文档和可执行测试用例用于自动评估。我们进一步提出了ProjectGen,这是一个多智能体框架,将项目分解为架构设计、骨架生成和代码填充阶段,并具有迭代细化和基于记忆的上下文管理。在该框架内,我们引入了语义软件架构树(SSAT),这是一种结构化且语义丰富的表示方法,有效地弥合了用户需求与源代码实现之间的差距。实验表明,ProjectGen实现了最先进的性能,在小规模项目级代码生成数据集DevBench上通过了52/124个测试用例,比基线方法提高了57%,在CodeProjectEval上通过了310个测试用例,与基线相比提升了约十倍。

英文摘要:

In recent years, Large Language Models (LLMs) have achieved remarkable progress in automated code generation. In real-world software engineering, the growing demand for rapid iteration and continuous delivery underscores the importance of project-level code generation, where LLMs are expected to generate complete software projects directly from complex user requirements. Although existing studies have made initial explorations, they still face key limitations, including unrealistic datasets and unreliable evaluation metrics that fail to reflect real-world complexity, the semantic gap between human-written requirements and machine-interpretable structures, and difficulties in managing hierarchical dependencies and maintaining quality throughout the generation process. To address these limitations, we first introduce CodeProjectEval, a project-level code generation dataset built from 18 real-world repositories with 12.7 files and 2,388.6 lines of code per task on average, supplemented with documentation and executable test cases for automatic evaluation. We further propose ProjectGen, a multi-agent framework that decomposes projects into architecture design, skeleton generation, and code filling stages with iterative refinement and memory-based context management. Within this framework, we introduce the Semantic Software Architecture Tree (SSAT), a structured and semantically rich representation that effectively bridges user requirements and source code implementation. Experiments show that ProjectGen achieves state-of-the-art performance, passing 52/124 test cases on the small-scale project-level code generation dataset DevBench, a 57% improvement over the baseline approaches, and 310 test cases on CodeProjectEval, representing an improvement of roughly tenfold compared to the baselines.

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

↑