Beyond Vector Similarity: Hierarchical Context-Aware Graph RAG vs Standard RAG in Enterprise Code Migration
Not on the map. Why?
Abstract (arXiv)
As enterprises modernize legacy monolithic systems to microservices, Large Language Models (LLMs) are heavily utilized for automated code translation. However, traditional vector-based Retrieval-Augmented Generation (Standard RAG) struggles to capture topological relationships. It fetches isolated chunks that sever inheritance chains, leading to high compilation failure rates. This paper introduces a Hierarchical Context-Resident Graph (HCRG) methodology to resolve these limitations. Our pipeline uses tree-sitter for Abstract Syntax Tree (AST) extraction, maps architectural edges into a Google Cloud Spanner Property Graph, and serializes this structure into a Gemini Context Cache for topological, parent-first code translation. We shift evaluation from naive text-overlap to a custom 7-metric Software Engineering framework. Traditional metrics like CodeBLEU (which scored 91% for both methods) effectively masked Standard RAG's structural failures behind syntactically plausible but broken code. Empirically, Graph RAG decisively mitigates dependency loss: API hallucination rates dropped from 56.4% to 16.2%, Dependency Resolution Quality improved from 34.8% to 65.9%, and Parent-Child Consistency rose from 26.7% to 45.5%. However, Graph RAG introduces specific trade-offs. The dense global context causes defensive over-engineering by the LLM, reducing Cyclomatic Complexity Consistency from 71.6% to 46.7%, and slightly degrades Docstring Preservation (67.0% to 61.0%). Ultimately, while trading code complexity for reduced hallucinations, Graph RAG provides a substantially more viable, architecturally sound path for automated enterprise codebase modernization.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 4 of its 5 references that are in the map. First posted on arXiv 11 Sep 2026.
Builds on
4 of 5 references.
References · 4
- 2024From Local to Global: A Graph RAG Approach to Query-Focused Summarizationcited by 1,453
- 2025GraphRAG-Bench: Challenging Domain-Specific Reasoning for Evaluating Graph Retrieval-Augmented Generationcited by 24
- 2025Towards Practical GraphRAG: Efficient Knowledge Graph Construction and Hybrid Retrieval at Scalecited by 9
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphscited by 4
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2026Do Not Treat Code as Natural Language: Implications for Repository-Level Code Generation and Beyond
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches
- 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generation
- 2025GRACE: Graph-Guided Repository-Aware Code Completion through Hierarchical Code Fusion
- 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat