Deep Code Comment Generation
By Xing Hu, Ge Li, Xin Xia, David Lo, Zhi Jin. 2018
791 citations recorded by the source corpus.
During software maintenance, code comments help developers comprehend programs and reduce additional time spent on reading and navigating source code. Unfortunately, these comments are often mismatched, missing or outdated in the software projects. Developers have to infer the functionality from the source code. This paper proposes a new approach named DeepCom to automatically generate code comments for Java methods. The generated comments aim to help developers understand the functionality of Java methods. DeepCom applies Natural Language Processing (NLP) techniques to learn from a large code corpus and generates comments from learned features. We use a deep neural network that analyzes structural information of Java methods for better comments generation. We conduct experiments on a large-scale Java corpus built from 9,714 open source projects from GitHub. We evaluate the experimental results on a machine translation metric. Experimental results demonstrate that our method DeepCom outperforms the state-of-the-art by a substantial margin.
Subfields: Artificial Intelligence, Information Systems, Natural Language Processing, Code Generation & Program Synthesis, Signal Processing
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
- Mohit Bansal
- Graham Neubig
- Jianfeng Gao
- Luke S. Zettlemoyer
- Zhiyuan Liu
- Maosong Sun
- Percy Liang
- Furu Wei
In Information Systems
- Prem Devanbu
- Miltiadis Allamanis
- Baishakhi Ray
- Uri Alon
- Toufique Ahmed
- Eran Yahav
- Charles Sutton
- Saikat Chakraborty
In Natural Language Processing
In Code Generation & Program Synthesis
- Prem Devanbu
- Toufique Ahmed
- Charles Sutton
- Miltiadis Allamanis
- Baishakhi Ray
- Ge Li
- Hongyu Zhang
- Rafael-Michael Karampatsis
In Signal Processing
- Uri Alon
- Eran Yahav
- Baishakhi Ray
- Saikat Chakraborty
- Omer Levy
- Shaked Brody
- Miltiadis Allamanis
- Prem Devanbu
Citations in the corpus
- Unified Pre-training for Program Understanding and Generation (2021, background): “Code Summarization (MovshovitzAttias and Cohen, 2013; Allamanis et al., 2016; Iyer et al., 2016; Alon et al., 2019a; Hu et al., 2018; Harer et al., 2019; Ahmad et al., 2020), Bug Detection (Ray et al., 2016; Li et al., 2018b; Russell et al., 2018; Zhou et al., 2019; Chakraborty et al., 2020),…”
- Unsupervised Translation of Programming Languages (2020, methodology): “[21] proposed a neural approach, DeepCom, to automatically generate code comments for Java methods.”
- code2seq: Generating Sequences from Structured Representations of Code (2018, methodology): “ic. Training our model on the same dataset as Hu et al., matching LSTM sizes, and using the same script on our predictions yields a BLEU score of 14:53, which is a 62% relative gain over the model of Hu et al. (2018). This shows that our structural approach represents code better than linearizing th”
- Unit Test Case Generation with Transformers (2020, background): “Deep learning techniques have shown the potential of learning from real-world examples, and have been employed in several software engineering tasks, such as code completion [17], automated patch generation [18], [19], comment generation [20], and many others [21].”
- DOBF: A Deobfuscation Pre-Training Objective for Programming Languages (2021, methodology): “Machine learning is frequently used on tasks involving programming languages, including code completion [28, 33, 35, 42], bug detection and code repair [15, 38, 46], code summarization [8, 25], clone detection [2, 47, 48], code search [13, 23] and code translation [14, 41].”
- GraphCodeBERT: Pre-training Code Representations with Data Flow (2020, background): “, 2020), code summarization (Alon et al., 2018; Hu et al., 2018) and so on (Nguyen & Nguyen, 2015; Allamanis et al.”
- Big Code != Big Vocabulary: Open-Vocabulary Models for Source Code (2020, background): “Other applications include program repair [20], learning code changes [82], or generating source code comments [47].”
- Communicative Agents for Software Development (2023, methodology): “The authors’ contributions are delineated as follows: During the project’s formulation, Chen Qian, Xin Cong, and Cheng Yang orchestrated the design of the model architecture.”
- METHODS2TEST: A dataset of focal methods mapped to test cases (2022, background): “Examples of these tasks include automating developers’ activities, such as: bug-fixing [5, 27], fault localization [28], writing comments [13] and documentation [6], code reviews [25], and merge conflict resolution [24].”
- TranS^3: A Transformer-based Framework for Unifying Code Summarization and Code Search (2020, methodology): “According to the recent advances in code summarization [18, 24, 25], the accuracy of the generated code comments appears to be inferior for real-world applicability (around 20% in BLEU-1 with many well-recognized ar X iv :2 00 3.”
- CoaCor: Code Annotation for Code Retrieval with Reinforcement Learning (2019, methodology): “ies can significantly speed up the software development process. Towards that, code retrieval (CR) and code annotation (CA) are two important tasks that have been widely studied in the past few years [1, 13, 19, 21, 58], where the former aims to retrieve relevant code snippets based on a natural lan”
- Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Tasks (2021, methodology): “The proposed summarization techniques fall into two categories: extractive [43]– [46] and abstractive [9], [11], [47]–[49].”
- CODIT: Code Editing With Tree-Based Neural Models (2018, methodology): “We design a Seq2Seq method with DeepCom encoder (Tree2Seq), and Code2Seq encoder.”
- 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, ”
- Multi-task Learning based Pre-trained Language Model for Code Completion (2020, methodology): “stical properties as natural language. Thus, statistical language models have been used for source code modeling [19, 42, 46], benefiting many software engineering tasks, including code summarization [23, 49], code clone detection [51, 52] program repair [15, 47], especially, in code completion [17,”
- CoCoGUM: Contextual Code Summarization with Multi-Relational GNN on UMLs (2020, methodology): “Hu et al. [15] structurally flatten an AST and then pass it on to a standard Seq2Seq model.”
- Code Generation as a Dual Task of Code Summarization (2019, methodology): “We conduct our experiments on Java and Python projects collected from GitHub used by previous work [Hu et al., 2018a,b, Wan et al., 2018].”
- Where should I comment my code? A dataset and model for predicting locations that need comments (2020, background): “Representative recent work translates code to comments via deep learning for method header comments [6].”
- Modeling Vocabulary for Big Code Machine Learning (2019, methodology): “Hu et al. [36] propose to use NLP and deep neural networks to automatically generate code comments.”