Toward Executable Repository-Level Code Generation via Environment Alignment

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Pan, Ruwei, Shen, Junlei, Wu, Linhao, Zhu, Yueheng, Yang, Zixiong, Zhang, Yakun, Zhang, Lu, Zhang, Hongyu
Formato: Preprint
Publicado: 2026
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866917383887650816
author Pan, Ruwei
Shen, Junlei
Wu, Linhao
Zhu, Yueheng
Yang, Zixiong
Zhang, Yakun
Zhang, Lu
Zhang, Hongyu
author_facet Pan, Ruwei
Shen, Junlei
Wu, Linhao
Zhu, Yueheng
Yang, Zixiong
Zhang, Yakun
Zhang, Lu
Zhang, Hongyu
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2604_03622
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Toward Executable Repository-Level Code Generation via Environment Alignment
Pan, Ruwei
Shen, Junlei
Wu, Linhao
Zhu, Yueheng
Yang, Zixiong
Zhang, Yakun
Zhang, Lu
Zhang, Hongyu
Software Engineering
Artificial Intelligence
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.
title Toward Executable Repository-Level Code Generation via Environment Alignment
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2604.03622