arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2604.03622cs.SEcs.AI
收藏

面向环境对齐的仓库级代码生成

Toward Executable Repository-Level Code Generation via Environment Alignment

Ruwei Pan, Junlei Shen, Linhao Wu, Yueheng Zhu, Zixiong Yang, Yakun Zhang, Lu Zhang, Hongyu Zhang

AI总结:

本文提出EnvGraph框架,通过环境对齐问题解决仓库级代码生成中的可执行性挑战,实验显示其在功能正确性和非功能质量上均优于现有方法。

摘要:

大型语言模型(LLMs)在代码生成方面表现出色,但现有方法在仓库级代码生成中仍面临可执行性验证的挑战。本文提出EnvGraph框架,将仓库可执行性视为环境对齐问题,联合建模外部依赖满足和内部引用解析,通过双层环境表示和执行证据进行属性归因,引导仓库生成。实验表明EnvGraph在仓库级代码生成任务中表现最佳,尤其在功能正确性和非功能质量上显著优于现有方法。

英文摘要:

Large language models (LLMs) have achieved strong performance on code generation, but existing methods still struggle with repository-level code generation under executable validation. Under this evaluation setting, success is determined not by the plausibility of isolated code fragments, but by whether a generated multi-file repository can be successfully installed, have its dependencies and internal references resolved, be launched, and be validated in a real execution environment. To address this challenge, we propose EnvGraph, a framework for repository-level code generation that formulates repository executability as an environment alignment problem. EnvGraph jointly models two coupled conditions for successful repository execution, namely external dependency satisfaction and repository-internal reference resolution. It maintains a dual-layer environment representation, uses execution evidence to perform execution-evidence-based attribution, and guides repository generation through a unified targeted revision mechanism within an iterative alignment loop. We evaluate EnvGraph on repository-level code generation with three representative backbone LLMs and compare it against representative environment-aware and repository-level baselines. Experimental results show that EnvGraph consistently achieves the best performance on these repository-level benchmarks. In particular, it outperforms the strongest non-EnvGraph baseline by an absolute margin of 5.72--5.87 percentage points in Functional Correctness and 4.58--8.66 percentage points in Non-Functional Quality.

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

↑