Retrieval-based Neural Source Code Summarization
By Jian Zhang, Xu Wang, Hongyu Zhang, Hailong Sun, Xudong Liu. International Conference on Software Engineering, 2020
299 citations recorded by the source corpus.
Source code summarization aims to automatically generate concise summaries of source code in natural language texts, in order to help developers better understand and maintain source code. Traditional work generates a source code summary by utilizing information retrieval techniques, which select terms from original source code or adapt summaries of similar code snippets. Recent studies adopt Neural Machine Translation techniques and generate summaries from code snippets using encoder-decoder neural networks. The neural-based approaches prefer the high-frequency words in the corpus and have trouble with the low-frequency ones. In this paper, we propose a retrieval-based neural source code summarization approach where we enhance the neural model with the most similar code snippets retrieved from the training set. Our approach can take advantages of both neural and retrieval-based techniques. Specifically, we first train an attentional encoder-decoder model based on the code snippets and the summaries in the training set; Second, given one input code snippet for testing, we retrieve its two most similar code snippets in the training set from the aspects of syntax and semantics, respectively; Third, we encode the input and two retrieved code snippets, and predict the summary by fusing them during decoding. We conduct extensive experiments to evaluate our approach and the experimental results show that our proposed approach can improve the state-of-the-art methods.
Subfields: Artificial Intelligence, Information Systems
View Paper: https://www.semanticscholar.org/paper/bd47bb8cdd749a3356149da6155d2dcd7458779f
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Prem Devanbu
- Toufique Ahmed
- Wasi Uddin Ahmad
- Baishakhi Ray
- Saikat Chakraborty
- Shi Han
- Lun Du
- Dongmei Zhang
In Information Systems
Citations in the corpus
- A Transformer-based Approach for Source Code Summarization (2020, background): “Among other noteworthy works, API usage information (Hu et al., 2018b), reinforcement learning (Wan et al., 2018), dual learning (Wei et al., 2019), retrieval-based techniques (Zhang et al., 2020) are leveraged to further enhance the code summarization models.”
- Large Language Models for Software Engineering: A Systematic Literature Review (2023, background): “Using LLMs to address these SE tasks has shown a wealth of potential breakthroughs [26, 30, 137, 253, 264, 300, 301, 329].”
- Multilingual training for Software Engineering (2021, background): “Comment synthesis is now an active research area, including many projects such as CodeNN [30], DeepCom [26], Astattgru [40], CodeBERT [18], Rencos [74], SecNN [42], PLBART [1], CoTexT [54], ProphetNet-X [55], NCS [2], Code2seq [7], Re2Com [71], and many more [19, 24, 25, 27, 28, 38, 39, 41, 49, 50, ”
- CoCoGUM: Contextual Code Summarization with Multi-Relational GNN on UMLs (2020, methodology): “Similar to previous work [7, 8, 39], we evaluate the performance of our proposed model based on four widely-used metrics including BLEU [40], METEOR [41], ROUGE-L [42] and CIDER [43].”
- Retrieval-Augmented Generation for AI-Generated Content: A Survey (2024, unknown): “For code-to-text conversion task, Rencos [121] generates multiple summary candidates in parallel from the retrieved code.”
- Retrieval And Structuring Augmented Generation with Large Language Models (2025, unknown): “These methods are especially popular in code retrieval [74], often integrated with abstract syntax trees of code snippets [200, 287].”