arXiv:2602.02084cs.CLcs.SE2026-02

用统一图结构打通代码生成与理解的闭环,提升复杂项目定位精度。

Closing the Loop: Universal Repository Representation with RPG-Encoder

  • 将代码与语义特征融合为动态演化图结构,实现高保真表示。
  • 在SWE-bench上达到93.7% Acc@5,较最优基线提升超10%。
  • 适用于需要精准理解或生成大型代码库的开发者工具研发。

当前代码库智能体因表示碎片化而存在推理断层,现有方法依赖孤立的API文档或依赖图,缺乏语义深度。本文认为代码理解和生成是统一循环中的逆过程:生成将意图扩展为实现,理解则将实现压缩回意图。为此提出RPG-Encoder框架,将静态生成蓝图Repository Planning Graph(RPG)转化为统一、高保真的表示。该框架通过三机制闭合推理闭环:(1)将原始代码编码为融合语义特征与依赖关系的RPG;(2)增量式演化拓扑结构,使维护成本与库规模解耦,开销降低95.7%;(3)作为结构感知导航的统一接口。实验显示,RPG-Encoder在SWE-bench Verified上实现93.7% Acc@5,优于最佳基线超10%;在SWE-bench Live Lite上同样显著领先。同时在RepoCraft上实现98.5%重构覆盖率,验证其对原始代码库的高保真映射能力,成功闭合意图与实现之间的循环。

原文摘要 · Abstract (English)

Current repository agents encounter a reasoning disconnect due to fragmented representations, as existing methods rely on isolated API documentation or dependency graphs that lack semantic depth. We consider repository comprehension and generation to be inverse processes within a unified cycle: generation expands intent into implementation, while comprehension compresses implementation back into intent. To address this, we propose RPG-Encoder, a framework that generalizes the Repository Planning Graph (RPG) from a static generative blueprint into a unified, high-fidelity representation. RPG-Encoder closes the reasoning loop through three mechanisms: (1) Encoding raw code into the RPG that combines lifted semantic features with code dependencies; (2) Evolving the topology incrementally to decouple maintenance costs from repository scale, reducing overhead by 95.7%; and (3) Operating as a unified interface for structure-aware navigation. In evaluations, RPG-Encoder establishes state-of-the-art localization performance on SWE-bench Verified with 93.7% Acc@5 and exceeds the best baseline by over 10% in localization accuracy on SWE-bench Live Lite. These results highlight our superior fine-grained precision in complex codebases. Furthermore, it achieves 98.5% reconstruction coverage on RepoCraft, confirming RPG's high-fidelity capacity to mirror the original codebase and closing the loop between intent and implementation.

代码理解图神经网络开发智能体

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。