HCAG: Hierarchical Abstraction and Retrieval-Augmented Generation on Theoretical Repositories with LLMs
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Existing Retrieval-Augmented Generation (RAG) methods for code struggle to capture the high-level architectural patterns and cross-file dependencies inherent in complex, theory-driven codebases, such as those in algorithmic game theory (AGT), leading to a persistent semantic and structural gap between abstract concepts and executable implementations. To address this challenge, we propose Hierarchical Code/Architecture-guided Agent Generation (HCAG), a framework that reformulates repository-level code generation as a structured, planning-oriented process over hierarchical knowledge. HCAG adopts a two-phase design: an offline hierarchical abstraction phase that recursively parses code repositories and aligned theoretical texts to construct a multi-resolution semantic knowledge base explicitly linking theory, architecture, and implementation; and an online hierarchical retrieval and scaffolded generation phase that performs top-down, level-wise retrieval to guide LLMs in an architecture-then-module generation paradigm. To further improve robustness and consistency, HCAG integrates a multi-agent discussion inspired by cooperative game. We provide a theoretical analysis showing that hierarchical abstraction with adaptive node compression achieves cost-optimality compared to flat and iterative RAG baselines. Extensive experiments on diverse game-theoretic system generation tasks demonstrate that HCAG substantially outperforms representative repository-level methods in code quality, architectural coherence, and requirement pass rate. In addition, HCAG produces a large-scale, aligned theory-implementation dataset that effectively enhances domain-specific LLMs through post-training. Although demonstrated in AGT, HCAG paradigm also offers a general blueprint for mining, reusing, and generating complex systems from structured codebases in other domains.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 24 of its 30 references that are in the map. First posted on arXiv 19 Mar 2026.
Builds on
24 of 30 references.
Closest ancestors · 4
Same direction, newest first
- 2025RTLRepoCoder: Repository-Level RTL Code Completion through the Combination of Fine-Tuning and Retrieval Augmentation11 Apr
- 2024Building A Coding Assistant via the Retrieval-Augmented Language Model21 Oct
- 2024EVOR: Evolving Retrieval for Code Generation19 Feb
- 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNN9 Jun
Other references · 20
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 352
- 2017Deal or No Deal? End-to-End Learning for Negotiation Dialoguescited by 202
- 2018Decoupling Strategy and Generation in Negotiation Dialoguescited by 156
- 2024MemoRAG: Boosting Long Context Processing with Global Memory-Enhanced Retrieval Augmentationcited by 118
- 2024Retrieval Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approachcited by 117
- 2024RAGBench: Explainable Benchmark for Retrieval-Augmented Generation Systemscited by 115
- 2023General Object Foundation Model for Images and Videos at Scalecited by 71
- 2022FiD-Light: Efficient and Effective Retrieval-Augmented Text Generationcited by 63
- 2024Game-theoretic LLM: Agent Workflow for Negotiation Gamescited by 55
- 2023The Consensus Game: Language Model Generation via Equilibrium Searchcited by 35
- 2023ALYMPICS: LLM Agents Meet Game Theory -- Exploring Strategic Decision-Making with AI Agentscited by 33
8 more
- 2024SimRAG: Self-Improving Retrieval-Augmented Generation for Adapting Large Language Models to Specialized Domainscited by 28
- 2022When is Offline Two-Player Zero-Sum Markov Game Solvable?cited by 27
- 2025Retrieval-Augmented Generation: A Comprehensive Survey of Architectures, Enhancements, and Robustness Frontierscited by 26
- 2024TMGBench: A Systematic Game Benchmark for Evaluating Strategic Reasoning Abilities of LLMscited by 21
- 2023Modeling Cross-Cultural Pragmatic Inference with Codenames Duetcited by 20
- 2018Planning, Inference and Pragmatics in Sequential Language Gamescited by 12
- 2023Towards the Scalable Evaluation of Cooperativeness in Language Modelscited by 12
- 2024Context-Augmented Code Generation Using Programming Knowledge Graphscited by 4
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2026Retrieval-Conditioned Topology Selection with Provable Budget Conservation for Multi-Agent Code Generation
- 2025Towards Realistic Project-Level Code Generation via Multi-Agent Collaboration and Semantic Architecture Modeling
- 2025Guided Code Generation with LLMs: A Multi-Agent Framework for Complex Code Tasks
- 2024LLM Agents Improve Semantic Code Search
- 2025GraphCodeAgent: Dual Graph-Guided LLM Agent for Retrieval-Augmented Repo-Level Code Generation
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches
- 2024Self-Organized Agents: A LLM Multi-Agent Framework toward Ultra Large-Scale Code Generation and Optimization
- 2025ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinement