EUVIMEDEUVIMED entdecken
Open Access · CC BY-NC-ND 4.0

In Line with Context: Repository-Level Code Generation via Context Inlining

Chao Hu, Wenhao Zeng, Yuling Shi, Beijun Shen, Xiaodong Gu

Proceedings of the ACM on Software Engineering · 30.06.2026 · 3 (FSE) · 1469-1491

DOI: 10.1145/3797094 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Proceedings of the ACM on Software Engineering, online erschienen am 30.06.2026. Verfasst von Chao Hu und 4 weiteren Autor:innen. Die Arbeit wurde bisher 5-mal zitiert (Crossref) und nennt 68 Literaturangaben. Der Volltext ist frei zugänglich (Open Access, CC BY-NC-ND 4.0). Gefördert von: the National Key Research and Development Program of China, the National Natural Science Foundation of Shanghai.

AbstractBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Repository-level code generation has attracted growing attention in recent years. Unlike function-level code generation, it requires the model to understand the entire repository and reason over complex dependencies across functions, classes, and modules. However, existing approaches such as retrieval-augmented generation (RAG) or context-based function selection often fall short; they primarily rely on surface-level similarity and struggle to capture the rich dependencies that govern repository-level semantics. In this paper, we introduce InlineCoder, a novel framework for repository-level code generation. InlineCoder enhances the understanding of repository context by inlining the unfinished function into its call graph, thereby reframing the challenge of repository understanding into a simpler function-level coding task. Given a function signature, InlineCoder first generates a draft completion (termed an "anchor"), which approximates downstream dependencies and enables perplexity-based confidence estimation. This anchor drives a bidirectional inlining process: (1) Upstream Inlining, which embeds the anchor into its callers to capture diverse usage scenarios; and (2) Downstream Retrieval, which integrates the anchor's callees into the prompt to provide precise dependency context. The enriched context, combining draft completion with upstream and downstream perspectives, equips the LLM with a comprehensive repository view. Extensive experiments on the DevEval and RepoExec benchmarks demonstrate that InlineCoder substantially outperforms a wide range of state-of-the-art baselines, achieving average relative gains of 29.73% in EM, 20.82% in ES, and 49.34% in BLEU on RepoExec compared to the strongest baseline. These results highlight its effectiveness in repository context understanding as well as its generalization across domains.

Förderung

  • the National Key Research and Development Program of China
  • the National Natural Science Foundation of Shanghai

Zitieren

APA

Hu, C., Zeng, W., Shi, Y., Shen, B., & Gu, X. (2026). In Line with Context: Repository-Level Code Generation via Context Inlining. Proceedings of the ACM on Software Engineering, 3(FSE), 1469-1491. https://doi.org/10.1145/3797094

Vancouver

Hu C, Zeng W, Shi Y, Shen B, Gu X. In Line with Context: Repository-Level Code Generation via Context Inlining. Proceedings of the ACM on Software Engineering. 2026;3(FSE):1469-1491. doi:10.1145/3797094

BibTeX
@article{Hu2026,
  author = {Hu, Chao and Zeng, Wenhao and Shi, Yuling and Shen, Beijun and Gu, Xiaodong},
  title = {In Line with Context: Repository-Level Code Generation via Context Inlining},
  journal = {Proceedings of the ACM on Software Engineering},
  year = {2026},
  volume = {3},
  number = {FSE},
  pages = {1469--1491},
  doi = {10.1145/3797094}
}
Kostenlos starten →