ProjAgent boosts repo-level code gen with procedural similarity retrieval
New system achieves 41% Pass@1 by retrieving procedural logic, not just surface code.
ProjAgent, developed by QiHong Chen, Aaron Imani, and Iftekhar Ahmed, tackles repository-level code generation by introducing a novel retrieval signal: procedural similarity. Unlike traditional methods that rely on lexical, structural, or semantic similarity, ProjAgent identifies repository functions that implement similar procedural logic even when identifiers or application domains differ. The system first decomposes a target function into intermediate reasoning steps, then employs an agentic workflow to retrieve repository functions exhibiting analogous procedural behavior at each step. This procedural context is integrated with conventional semantic retrieval to build a richer context for code generation. Additionally, ProjAgent incorporates a conservative static-analysis feedback loop that iteratively repairs generated code using compiler and static-analysis feedback, ensuring correctness and adherence to project conventions.
Evaluated on the REPOCOD benchmark, ProjAgent achieves a Pass@1 score of 41.14%, surpassing existing retrieval-based baselines. This result demonstrates that procedural similarity is an effective and previously unexplored dimension for retrieval-augmented code generation. The system's ability to understand and replicate similar procedural patterns across different parts of a repository significantly improves its code generation accuracy, particularly for complex cross-file dependencies. ProjAgent represents a significant step forward in AI-assisted software engineering, enabling developers to generate more contextually appropriate code for large-scale projects.
- ProjAgent introduces procedural similarity retrieval, a novel dimension beyond lexical, structural, or semantic similarity.
- It decomposes target functions into reasoning steps and uses an agentic workflow to retrieve similar procedural context.
- Achieves 41.14% Pass@1 on the REPOCOD benchmark, outperforming existing retrieval-based code generation methods.
Why It Matters
ProjAgent enables AI to generate accurate code in large repositories by understanding procedural logic, not just surface patterns.