Toward Executable Repository-Level Code Generation via Environment Alignment

📅 2026-04-04
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the challenge that existing large language models often generate multi-file code repositories that fail to install or execute in real environments due to unsatisfied dependencies or incorrect internal references. The authors formulate repository-level code generation as an environment alignment problem and propose EnvGraph, a framework that jointly models external dependencies and internal references through a two-layer environmental representation. EnvGraph incorporates execution-evidence-driven attribution analysis and dynamically refines generation targets within an iterative alignment loop. This approach is the first to formally cast repository executability as an environment alignment task, enabling end-to-end generation of executable repositories. Experiments demonstrate that EnvGraph significantly outperforms current methods across multiple repository-scale benchmarks, improving functional correctness by 5.72–5.87 percentage points and non-functional quality by 4.58–8.66 percentage points.
📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

repository-level code generation
executable validation
environment alignment
dependency satisfaction
reference resolution
Innovation

Methods, ideas, or system contributions that make the work stand out.

environment alignment
repository-level code generation
executable validation
dependency satisfaction
reference resolution
🔎 Similar Papers
No similar papers found.