Closing the Loop: Universal Repository Representation with RPG-Encoder

📅 2026-04-11
📈 Citations: 0
✨ Influential: 0
📄 PDF
🤖 AI Summary
Existing code repository agents struggle to bridge the semantic gap between comprehension and generation due to their reliance on fragmented representations, such as isolated API documentation or static dependency graphs. This work proposes RPG-Encoder, a novel framework that generalizes the Repository Planning Graph from a static blueprint into a dynamic, unified representation. By jointly encoding raw source code, incrementally evolving topology, and structure-aware navigation signals, RPG-Encoder enables closed-loop collaboration between understanding and generation. The approach substantially enhances semantic fidelity and maintenance efficiency, achieving 93.7% Acc@5 on SWE-bench Verified, surpassing baseline methods by over 10% in Live Lite localization accuracy, and attaining a 98.5% coverage rate on RepoCraft refactoring tasks.

Technology Category

Natural Language Processing: Code Generation / Program Synthesis from Natural LanguagePlanning, Routing, and Scheduling: Replanning and Plan RepairKnowledge Representation and Reasoning: Logic Programming

Application Category

Search and Retrieval-Augmented AI: Agentic searchGraph Algorithms and Modeling for the Web: Foundation models and LLMs for Web-related graphsSemantics and Knowledge: Methods to enhance, augment, integrate or synergize semantic models such as knowledge graphs and LLMs
📝 Abstract
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.
Problem

Research questions and friction points this paper is trying to address.

repository representation
reasoning disconnect
semantic depth
code comprehension
code generation
Innovation

Methods, ideas, or system contributions that make the work stand out.

RPG-Encoder
Repository Planning Graph
code comprehension
structure-aware navigation
high-fidelity representation
🔎 Similar Papers