CodeGRAG: Bridging the Gap between Natural Language and Programming Language via Graphical Retrieval Augmented Generation
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Utilizing large language models to generate codes has shown promising meaning in software development revolution. Despite the intelligence shown by the large language models, their specificity in code generation can still be improved due to the syntactic gap and mismatched vocabulary existing between natural language and programming languages. In this paper, we propose CodeGRAG, a Graphical Retrieval Augmented Code Generation framework that bridges the gap between NL and PL to enhance the performance of LLMs. CodeGRAG builds the graphical view of code blocks based on the control flow and data flow of them to better interpret the programming domain knowledge, which can facilitate natural language based LLMs for better understanding of code syntax and serve as a bridge among different programming languages. To take the extracted structural knowledge into the foundation models, we propose 1) a hard meta-graph prompt template to transform the challenging syntax graph into informative graphical view for tuning-free models and 2) a soft prompting technique that injects the domain knowledge of programming languages into model parameters via finetuning the models with the soft signals encoded by GNN expert model. Specifically, two constraints are designed to improve the alignment and structure expressiveness, contributing to the informativeness of the single-token-sized external <GraphEmb> for enhanced code generation. CodeGRAG significantly improves the code generation ability of LLMs and can even offer performance gain for cross-lingual code generation. Implementation is available at https://anonymous.4open.science/r/Code-5970/ .
Key facts. Cited by 4 papers in the map (data through 13 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 26 of its 40 references that are in the map. First posted on arXiv 3 May 2024.
Builds on
26 of 40 references.
Closest ancestors · 2
Same direction, newest first
- 2024EVOR: Evolving Retrieval for Code Generation19 Feb
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
Other references · 24
- 2023GPT-4 Technical Reportcited by 18,278
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,072
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,979
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,317
- 2022Robust Speech Recognition via Large-Scale Weak Supervisioncited by 4,004
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,379
- 2023Code Llama: Open Foundation Models for Codecited by 2,130
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,304
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 905
- 2021Measuring Coding Challenge Competence With APPScited by 891
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
12 more
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 360
- 2018code2vec: Learning Distributed Representations of Codecited by 250
- 2017Learning to Represent Programs with Graphscited by 220
- 2023The BigScience ROOTS Corpus: A 1.6TB Composite Multilingual Datasetcited by 148
- 2023PanGu-Coder2: Boosting Large Language Models for Code with Ranking Feedbackcited by 69
- 2018Neural Code Comprehension: A Learnable Representation of Code Semanticscited by 59
- 2019When Deep Learning Met Code Searchcited by 46
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 41
- 2018Automated software vulnerability detection with machine learningcited by 34
- 2021An Empirical Study on the Usage of BERT Models for Code Completioncited by 22
- 2021Multimodal Representation for Neural Code Searchcited by 11
- 2022Multi-View Graph Representation for Programming Language Processing: An Investigation into Algorithm Detectioncited by 6
Built on by
Citing papers per year: 2024: 1; 2025: 2; 2026: 1.
4 papers.
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2024Selective Prompt Anchoring for Code Generationcited by 16
- 2025HDLxGraph: Bridging Large Language Models and HDL Repositories via HDL Graph Databasescited by 1
- 2026A Methodology for Investigating AI Patterns Prevalence in Software Repositoriescited by 0
- 2026A Methodology for Investigating AI Patterns Prevalence in Software Repositories1 Jul 2026
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025HDLxGraph: Bridging Large Language Models and HDL Repositories via HDL Graph Databases21 May 2025
- 2024Selective Prompt Anchoring for Code Generation17 Aug 2024
Similar, not cited
Close in wording, no citation either way
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
- 2026CodeMMR: Bridging Natural Language, Code, and Image for Unified Retrieval
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generation
- 2025GraphCodeAgent: Dual Graph-Guided LLM Agent for Retrieval-Augmented Repo-Level Code Generation
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?