mlsanityData to 14 Oct 2026

Context-Augmented Code Generation Using Programming Knowledge Graphs

arXiv 2410.18251 ↗First posted 9 Oct 2024cs.SE cs.AI cs.IRcited by 4

Not on the map. Why?

Abstract (arXiv)

Large Language Models (LLMs) and Code-LLMs (CLLMs) have significantly improved code generation, but, they frequently face difficulties when dealing with challenging and complex problems. Retrieval-Augmented Generation (RAG) addresses this issue by retrieving and integrating external knowledge at the inference time. However, retrieval models often fail to find most relevant context, and generation models, with limited context capacity, can hallucinate when given irrelevant data. We present a novel framework that leverages a Programming Knowledge Graph (PKG) to semantically represent and retrieve code. This approach enables fine-grained code retrieval by focusing on the most relevant segments while reducing irrelevant context through a tree-pruning technique. PKG is coupled with a re-ranking mechanism to reduce even more hallucinations by selectively integrating non-RAG solutions. We propose two retrieval approaches-block-wise and function-wise-based on the PKG, optimizing context granularity. Evaluations on the HumanEval and MBPP benchmarks show our method improves pass@1 accuracy by up to 20%, and outperforms state-of-the-art models by up to 34% on MBPP. Our contributions include PKG-based retrieval, tree pruning to enhance retrieval precision, a re-ranking method for robust solution selection and a Fill-in-the-Middle (FIM) enhancer module for automatic code augmentation with relevant comments and docstrings.

Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 28 of its 52 references that are in the map. First posted on arXiv 9 Oct 2024.

Builds on

28 of 52 references.

References · 28

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2021Program Synthesis with Large Language Modelscited by 3,637
  5. 2023Retrieval-Augmented Generation for Large Language Models: A Surveycited by 2,212
  6. 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,141
  7. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  8. 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,998
  9. 2022Competition-Level Code Generation with AlphaCodecited by 1,462
  10. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  11. 2022When Not to Trust Language Models: Investigating Effectiveness of Parametric and Non-Parametric Memoriescited by 1,128
  12. 2022Atlas: Few-shot Learning with Retrieval Augmented Language Modelscited by 952
16 more
  1. 2023StarCoder: may the source be with you!cited by 799
  2. 2023In-Context Retrieval-Augmented Language Modelscited by 702
  3. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
  4. 2023Active Retrieval Augmented Generationcited by 516
  5. 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
  6. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
  7. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 333
  8. 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
  9. 2024HippoRAG: Neurobiologically Inspired Long-Term Memory for Large Language Modelscited by 281
  10. 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
  11. 2021Retrieval Augmented Code Generation and Summarizationcited by 149
  12. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?cited by 91
  13. 2024RepoGraph: Enhancing AI Software Engineering with Repository-level Code Graphcited by 91
  14. 2024Reliable, Adaptable, and Attributable Language Models with Retrievalcited by 73
  15. 2024CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databasescited by 65
  16. 2024EVOR: Evolving Retrieval for Code Generationcited by 22

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 3; 2026: 1.

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026Context-Augmented Code Generation Using Programming Knowledge Graphs
  2. 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generation
  3. 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
  4. 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
  5. 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model
  6. 2025SpareCodeSearch: Searching for Code Context When You Have No Spare GPU
  7. 2024CodeGRAG: Bridging the Gap between Natural Language and Programming Language via Graphical Retrieval Augmented Generation
  8. 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization