Search papers, labs, and topics across Lattice.
This paper introduces ProjAgent, a novel system for repository-level code generation that leverages procedural similarity as a retrieval signal to enhance the generation of target functions while considering complex cross-file dependencies and project-specific conventions. By decomposing target functions into intermediate reasoning steps and employing an agentic workflow, ProjAgent retrieves functions with similar procedural behavior, integrating this context with conventional semantic retrieval methods. Evaluated on the REPOCOD benchmark, ProjAgent achieves a Pass@1 score of 41.14%, significantly outperforming existing retrieval-based approaches, highlighting the importance of procedural similarity in code generation tasks.
Procedural similarity can dramatically enhance repository-level code generation, achieving a 41.14% Pass@1 score that outstrips traditional methods.
Repository-level code generation requires implementing target functions while accounting for complex cross-file dependencies and project-specific conventions. Existing retrieval methods predominantly rely on lexical, structural, or semantic similarity, often overlooking repository functions that implement similar procedural logic despite differing in identifiers or application domains. We propose ProjAgent, a repository-level code generation system that introduces procedural similarity as an explicit retrieval signal. ProjAgent decomposes the target function into intermediate reasoning steps and employs an agentic workflow to retrieve repository functions that exhibit similar procedural behavior at each step. The retrieved procedural context is integrated with conventional semantic retrieval to construct a richer repository context for code generation. ProjAgent further incorporates a conservative static-analysis feedback loop that iteratively repairs generated code using compiler and static-analysis feedback. Evaluated on REPOCOD, ProjAgent achieves 41.14% Pass@1, outperforming existing retrieval-based baselines. These results demonstrate that procedural similarity is an effective and previously unexplored retrieval dimension for repository-level code generation.