Retrieve and Refine: Exemplar-based Neural Comment Generation
Not on the map. Why?
Abstract (arXiv)
Code comment generation is a crucial task in the field of automatic software development. Most previous neural comment generation systems used an encoder-decoder neural network and encoded only information from source code as input. Software reuse is common in software development. However, this feature has not been introduced to existing systems. Inspired by the traditional IR-based approaches, we propose to use the existing comments of similar source code as exemplars to guide the comment generation process. Based on an open source search engine, we first retrieve a similar code and treat its comment as an exemplar. Then we applied a seq2seq neural network to conduct an exemplar-based comment generation. We evaluate our approach on a large-scale Java corpus, and experimental results demonstrate that our model significantly outperforms the state-of-the-art methods.
Key facts. Cited by 36 papers in the map (data through 7 Oct 2026). First posted on arXiv 23 Oct 2019.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 6; 2022: 10; 2023: 10; 2024: 5; 2025: 4; 2026: 1.
36 papers.
Sort:
By area:
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 352
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 117
- 2021On the Evaluation of Neural Code Summarizationcited by 47
- 2021Multilingual training for Software Engineeringcited by 43
- 2023Automatic Code Summarization via ChatGPT: How Far Are We?cited by 34
- 2021Code Structure Guided Transformer for Source Code Summarizationcited by 29
- 2022RACE: Retrieval-Augmented Commit Message Generationcited by 27
- 2023AceCoder: Utilizing Existing Code to Enhance Code Generationcited by 25
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2023EditSum: A Retrieve-and-Edit Framework for Source Code Summarizationcited by 18
- 2022An Extractive-and-Abstractive Framework for Source Code Summarizationcited by 15
- 2022Source Code Summarization with Structural Relative Position Guided Transformercited by 14
24 more
- 2022M2TS: Multi-Scale Multi-Modal Approach Based on Transformer for Source Code Summarizationcited by 14
- 2021API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentationscited by 10
- 2022BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERTcited by 9
- 2023A Prompt Learning Framework for Source Code Summarizationcited by 9
- 2023Expository Text Generation: Imitate, Retrieve, Paraphrasecited by 8
- 2024Keeping Deep Learning Models in Check: A History-Based Approach to Mitigate Overfittingcited by 6
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarizationcited by 6
- 2025Retrieval-Augmented Code Review Comment Generationcited by 6
- 2021Improving Stack Overflow question title generation with copying enhanced CodeBERT model and bi-modal informationcited by 5
- 2022GypSum: Learning Hybrid Representations for Code Summarizationcited by 5
- 2023Abstract Syntax Tree for Programming Language Understanding and Representation: How Far Are We?cited by 5
- 2022A Survey of Deep Learning Models for Structural Code Understandingcited by 4
- 2022Automatic Comment Generation via Multi-Pass Deliberationcited by 3
- 2023Revisiting File Context for Source Code Summarizationcited by 3
- 2024The Role of Transformer Models in Advancing Blockchain Technology: A Systematic Surveycited by 3
- 2023APIContext2Com: Code Comment Generation by Incorporating Pre-Defined API Documentationcited by 2
- 2024MESIA: Understanding and Leveraging Supplementary Nature of Method-level Comments for Automatic Comment Generationcited by 2
- 2022LAMNER: Code Comment Generation Using Character Language Model and Named Entity Recognitioncited by 1
- 2021Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automationcited by 0
- 2023Text Fact Transfercited by 0
- 2025AI-Mediated Code Comment Improvementcited by 0
- 2025Issue Retrieval and Verification Enhanced Supplementary Code Comment Generationcited by 0
- 2025LibRec: Benchmarking Retrieval-Augmented LLMs for Library Migration Recommendationscited by 0
- 2026Prompt-Driven Code Summarization: A Systematic Literature Reviewcited by 0
- 2026Prompt-Driven Code Summarization: A Systematic Literature Review16 Apr 2026
- 2025LibRec: Benchmarking Retrieval-Augmented LLMs for Library Migration Recommendations13 Aug 2025
- 2025Issue Retrieval and Verification Enhanced Supplementary Code Comment Generation17 Jun 2025
- 2025Retrieval-Augmented Code Review Comment Generation13 Jun 2025
- 2025AI-Mediated Code Comment Improvement13 May 2025
- 2024The Role of Transformer Models in Advancing Blockchain Technology: A Systematic Survey2 Sep 2024
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarization1 Jul 2024
- 2024MESIA: Understanding and Leveraging Supplementary Nature of Method-level Comments for Automatic Comment Generation26 Mar 2024
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Survey29 Feb 2024
- 2024Keeping Deep Learning Models in Check: A History-Based Approach to Mitigate Overfitting18 Jan 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
- 2023A Prompt Learning Framework for Source Code Summarization26 Dec 2023
24 more
- 2023Abstract Syntax Tree for Programming Language Understanding and Representation: How Far Are We?1 Dec 2023
- 2023Text Fact Transfer23 Oct 2023
- 2023Revisiting File Context for Source Code Summarization5 Sep 2023
- 2023EditSum: A Retrieve-and-Edit Framework for Source Code Summarization26 Aug 2023
- 2023Automatic Code Summarization via ChatGPT: How Far Are We?22 May 2023
- 2023Expository Text Generation: Imitate, Retrieve, Paraphrase5 May 2023
- 2023AceCoder: Utilizing Existing Code to Enhance Code Generation31 Mar 2023
- 2023APIContext2Com: Code Comment Generation by Incorporating Pre-Defined API Documentation3 Mar 2023
- 2022Automatic Comment Generation via Multi-Pass Deliberation14 Sep 2022
- 2022BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERT27 Jun 2022
- 2022An Extractive-and-Abstractive Framework for Source Code Summarization15 Jun 2022
- 2022A Survey of Deep Learning Models for Structural Code Understanding3 May 2022
- 2022GypSum: Learning Hybrid Representations for Code Summarization26 Apr 2022
- 2022LAMNER: Code Comment Generation Using Character Language Model and Named Entity Recognition5 Apr 2022
- 2022M2TS: Multi-Scale Multi-Modal Approach Based on Transformer for Source Code Summarization18 Mar 2022
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar 2022
- 2022RACE: Retrieval-Augmented Commit Message Generation5 Mar 2022
- 2022Source Code Summarization with Structural Relative Position Guided Transformer14 Feb 2022
- 2021Multilingual training for Software Engineering3 Dec 2021
- 2021Borrowing from Similar Code: A Deep Learning NLP-Based Approach for Log Statement Automation2 Dec 2021
- 2021Improving Stack Overflow question title generation with copying enhanced CodeBERT model and bi-modal information27 Sep 2021
- 2021On the Evaluation of Neural Code Summarization15 Jul 2021
- 2021Code Structure Guided Transformer for Source Code Summarization19 Apr 2021
- 2021API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentations19 Mar 2021
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 352
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 117
- 2022RACE: Retrieval-Augmented Commit Message Generationcited by 27
- 2022BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERTcited by 9
- 2025Retrieval-Augmented Code Review Comment Generationcited by 6
- 2025Issue Retrieval and Verification Enhanced Supplementary Code Comment Generationcited by 0
- 2025LibRec: Benchmarking Retrieval-Augmented LLMs for Library Migration Recommendationscited by 0
- 2025LibRec: Benchmarking Retrieval-Augmented LLMs for Library Migration Recommendations13 Aug 2025
- 2025Issue Retrieval and Verification Enhanced Supplementary Code Comment Generation17 Jun 2025
- 2025Retrieval-Augmented Code Review Comment Generation13 Jun 2025
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Survey29 Feb 2024
- 2022BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERT27 Jun 2022
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar 2022
- 2022RACE: Retrieval-Augmented Commit Message Generation5 Mar 2022
- 2021On the Evaluation of Neural Code Summarizationcited by 47
- 2021Multilingual training for Software Engineeringcited by 43
- 2023Automatic Code Summarization via ChatGPT: How Far Are We?cited by 34
- 2021Code Structure Guided Transformer for Source Code Summarizationcited by 29
- 2023AceCoder: Utilizing Existing Code to Enhance Code Generationcited by 25
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2023EditSum: A Retrieve-and-Edit Framework for Source Code Summarizationcited by 18
- 2022An Extractive-and-Abstractive Framework for Source Code Summarizationcited by 15
- 2022Source Code Summarization with Structural Relative Position Guided Transformercited by 14
- 2022M2TS: Multi-Scale Multi-Modal Approach Based on Transformer for Source Code Summarizationcited by 14
- 2021API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentationscited by 10
- 2023A Prompt Learning Framework for Source Code Summarizationcited by 9
12 most cited of 29 All 29 (JSON)
- 2026Prompt-Driven Code Summarization: A Systematic Literature Review16 Apr 2026
- 2025AI-Mediated Code Comment Improvement13 May 2025
- 2024The Role of Transformer Models in Advancing Blockchain Technology: A Systematic Survey2 Sep 2024
- 2024ESALE: Enhancing Code-Summary Alignment Learning for Source Code Summarization1 Jul 2024
- 2024MESIA: Understanding and Leveraging Supplementary Nature of Method-level Comments for Automatic Comment Generation26 Mar 2024
- 2024Keeping Deep Learning Models in Check: A History-Based Approach to Mitigate Overfitting18 Jan 2024
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkit30 Dec 2023
- 2023A Prompt Learning Framework for Source Code Summarization26 Dec 2023
- 2023Abstract Syntax Tree for Programming Language Understanding and Representation: How Far Are We?1 Dec 2023
- 2023Text Fact Transfer23 Oct 2023
- 2023Revisiting File Context for Source Code Summarization5 Sep 2023
- 2023EditSum: A Retrieve-and-Edit Framework for Source Code Summarization26 Aug 2023
12 newest of 29 All 29 (JSON)