mlsanityData to 7 Oct 2026

Building A Coding Assistant via the Retrieval-Augmented Language Model

arXiv 2410.16229 ↗First posted 21 Oct 2024cs.CLcited by 5

On the map: Retrieval-augmented generation → RAG for code

Abstract (arXiv)

Pretrained language models have shown strong effectiveness in code-related tasks, such as code retrieval, code generation, code summarization, and code completion tasks. In this paper, we propose COde assistaNt viA retrieval-augmeNted language model (CONAN), which aims to build a code assistant by mimicking the knowledge-seeking behaviors of humans during coding. Specifically, it consists of a code structure aware retriever (CONAN-R) and a dual-view code representation-based retrieval-augmented generation model (CONAN-G). CONAN-R pretrains CodeT5 using Code-Documentation Alignment and Masked Entity Prediction tasks to make language models code structure-aware and learn effective representations for code snippets and documentation. Then CONAN-G designs a dual-view code representation mechanism for implementing a retrieval-augmented code generation model. CONAN-G regards the code documentation descriptions as prompts, which help language models better understand the code semantics. Our experiments show that CONAN achieves convincing performance on different code generation tasks and significantly outperforms previous retrieval augmented code generation models. Our further analyses show that CONAN learns tailored representations for both code snippets and documentation by aligning code-documentation data pairs and capturing structural semantics by masking and predicting entities in the code data. Additionally, the retrieved code snippets and documentation provide necessary information from both program language and natural language to assist the code generation process. CONAN can also be used as an assistant for Large Language Models (LLMs), providing LLMs with external knowledge in shorter code document lengths to improve their effectiveness on various code tasks. It shows the ability of CONAN to extract necessary information and help filter out the noise from retrieved code documents.

Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 52 of its 78 references that are in the map. First posted on arXiv 21 Oct 2024.

Builds on

52 of 78 references.

Closest ancestors · 4

Same direction, newest first

  1. 2023Retrieval-Augmented Code Generation for Universal Information Extraction6 Nov
  2. 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
  3. 2021Retrieval Augmented Code Generation and Summarization26 Aug
  4. 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNN9 Jun

Other references · 48

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
  4. 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
  5. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
  6. 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
  7. 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
  8. 2021Program Synthesis with Large Language Modelscited by 3,509
  9. 2020Exploring Simple Siamese Representation Learningcited by 2,853
  10. 2017Billion-scale similarity search with GPUscited by 2,477
  11. 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
  12. 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,168
36 more
  1. 2020REALM: Retrieval-Augmented Language Model Pre-Trainingcited by 2,126
  2. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  3. 2020Leveraging Passage Retrieval with Generative Models for Open Domain Question Answeringcited by 1,203
  4. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  5. 2015Effective Approaches to Attention-based Neural Machine Translationcited by 1,024
  6. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  7. 2020Approximate Nearest Neighbor Negative Contrastive Learning for Dense Text Retrievalcited by 846
  8. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  9. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  10. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  11. 2019ERNIE: Enhanced Language Representation with Informative Entitiescited by 525
  12. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
  13. 2021Unified Pre-training for Program Understanding and Generationcited by 361
  14. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
  15. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
  16. 2019Representation Degeneration Problem in Training Natural Language Generation Modelscited by 250
  17. 2021ConSERT: A Contrastive Framework for Self-Supervised Sentence Representation Transfercited by 231
  18. 2020Sparse, Dense, and Attentional Representations for Text Retrievalcited by 213
  19. 2020CLEAR: Contrastive Learning for Sentence Representationcited by 186
  20. 2020CERT: Contrastive Self-supervised Learning for Language Understandingcited by 169
  21. 2021Condenser: a Pre-training Architecture for Dense Retrievalcited by 162
  22. 2020Answering Complex Open-Domain Questions with Multi-Hop Dense Retrievalcited by 160
  23. 2022DocPrompting: Generating Code by Retrieving the Docscited by 151
  24. 2021Simple Entity-Centric Questions Challenge Dense Retrieverscited by 140
  25. 2021COCO-LM: Correcting and Contrasting Text Sequences for Language Model Pretrainingcited by 126
  26. 2018Mapping Language to Code in Programmatic Contextcited by 104
  27. 2022CERT: Continual Pre-Training on Sketches for Library-Oriented Code Generationcited by 87
  28. 2020Coreferential Reasoning Learning for Language Representationcited by 80
  29. 2021Few-Shot Conversational Dense Retrievalcited by 71
  30. 2021DOBF: A Deobfuscation Pre-Training Objective for Programming Languagescited by 68
  31. 2022Universal Vision-Language Dense Retrieval: Learning A Unified Representation Space for Multi-Modal Retrievalcited by 57
  32. 2023SkCoder: A Sketch-based Approach for Automatic Code Generationcited by 40
  33. 2023RepoFusion: Training Code Models to Understand Your Repositorycited by 40
  34. 2023Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured Datacited by 23
  35. 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
  36. 2021More Robust Dense Retrieval with Contrastive Dual Learningcited by 15

Built on by

Cited by year (2026 to 7 Oct)

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

5 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
  2. 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization
  3. 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond
  4. 2026Retrieval-Augmented Generation for Scientific Code Understanding
  5. 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation
  6. 2026Context-Augmented Code Generation Using Programming Knowledge Graphs
  7. 2024Context-Augmented Code Generation Using Programming Knowledge Graphs
  8. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?