Context-Augmented Code Generation Using Programming Knowledge Graphs
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) excel at code generation but struggle with complex problems. Retrieval-Augmented Generation (RAG) mitigates this issue by integrating external knowledge, yet retrieval models often miss relevant context, and generation models hallucinate with irrelevant data. We propose Programming Knowledge Graph (PKG) for semantic representation and fine-grained retrieval of code and text. Our approach enhances retrieval precision through tree pruning and mitigates hallucinations via a re-ranking mechanism that integrates non-RAG solutions. Structuring external data into finer-grained nodes improves retrieval granularity. Evaluations on HumanEval and MBPP show up to 20% pass@1 accuracy gains and a 34% improvement over baselines on MBPP. Our findings demonstrate that our proposed PKG approach along with re-ranker effectively address complex problems while maintaining minimal negative impact on solutions that are already correct without RAG. The replication package is published at https://github.com/iamshahd/ProgrammingKnowledgeGraph
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 38 of its 52 references that are in the map. First posted on arXiv 28 Jan 2026.
Builds on
38 of 52 references.
References · 38
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023Retrieval-Augmented Generation for Large Language Models: A Surveycited by 2,212
- 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,141
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,998
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2022When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memoriescited by 1,128
- 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 952
26 more
- 2023StarCoder: may the source be with you!cited by 799
- 2023In-Context Retrieval-Augmented Language Modelscited by 702
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2023Active Retrieval Augmented Generationcited by 516
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 333
- 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
- 2024HippoRAG: Neurobiologically Inspired Long-Term Memory for Large Language Modelscited by 281
- 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
- 2021Retrieval Augmented Code Generation and Summarizationcited by 149
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?cited by 91
- 2024RepoGraph: Enhancing AI Software Engineering with Repository-level Code Graphcited by 91
- 2024Reliable, Adaptable, and Attributable Language Models with Retrievalcited by 73
- 2024CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databasescited by 65
- 2025Enhancing repository-level software repair via repository-aware knowledge graphscited by 27
- 2025Provence: efficient and robust context pruning for retrieval-augmented generationcited by 25
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 23
- 2024EVOR: Evolving Retrieval for Code Generationcited by 22
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyondcited by 22
- 2025cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Treecited by 17
- 2025Prometheus: Towards Long-Horizon Codebase Navigation for Repository-Level Problem Solvingcited by 13
- 2025Pragmatic Reasoning improves LLM Code Generationcited by 7
- 2025CoDocBench: A Dataset for Code-Documentation Alignment in Software Maintenancecited by 5
- 2025SemRAG: Semantic Knowledge-Augmented RAG for Improved Question-Answeringcited by 4
- 2025Iterative Self-Training for Code Generation via Reinforced Re-Rankingcited by 3
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
- 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generation
- 2024CodeGRAG: Bridging the Gap between Natural Language and Programming Language via Graphical Retrieval Augmented Generation
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphs
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval