Summarizing Source Code using a Neural Attention Model
By Srini Iyer, Ioannis Konstas, Alvin Cheung, Luke S. Zettlemoyer. 2016
787 citations recorded by the source corpus.
High quality source code is often paired with high level summaries of the computation it performs, for example in code documentation or in descriptions posted in online forums. Such summaries are extremely useful for applications such as code search but are expensive to manually author, hence only done for a small fraction of all code that is produced. In this paper, we present the first completely datadriven approach for generating high level summaries of source code. Our model, CODE-NN , uses Long Short Term Memory (LSTM) networks with attention to produce sentences that describe C# code snippets and SQL queries. CODE-NN is trained on a new corpus that is automatically collected from StackOverflow, which we release. Experiments demonstrate strong performance on two tasks: (1) code summarization, where we establish the first end-to-end learning results and outperform strong baselines, and (2) code retrieval, where our learned model improves the state of the art on a recently introduced C# benchmark by a large margin.
Subfields: Artificial Intelligence, Information Systems, Natural Language 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
- Luke S. Zettlemoyer
- Graham Neubig
- Jianfeng Gao
- Percy Liang
- Caiming Xiong
- Yejin Choi
- Hannaneh Hajishirzi
In Information Systems
- Miltiadis Allamanis
- Prem Devanbu
- Charles Sutton
- Uri Alon
- Baishakhi Ray
- Eran Yahav
- Ge Li
- Toufique Ahmed
In Natural Language Processing
- Graham Neubig
- Mohit Bansal
- Luke S. Zettlemoyer
- Percy Liang
- Caiming Xiong
- Richard Socher
- Jianfeng Gao
- Yejin Choi
Citations in the corpus
- A Survey of Machine Learning for Big Code and Naturalness (2017, background): “[96] design a neural attention model that summarizes code as text.”
- DART: Open-Domain Structured Data Record to Text Generation (2020, background): “…(Oâ ˘A ´Z-Donnell et al., 2000; Banik et al., 2013; Gardent et al., 2017a,b; Novikova et al., 2017b; Wang et al., 2018; Yu et al., 2019), code comment (Iyer et al., 2016), dialogue response generation (Wen et al., 2015, 2016), and commonsense reasoning (Lin et al., 2019; Rajani et al., 2020).”
- 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),…”
- CodeBERT: A Pre-Trained Model for Programming and Natural Languages (2020, methodology): “We conduct experiments on the dataset of CodeNN (Iyer et al., 2016)9, which consists of 66,015 pairs of questions and answers automatically collected from StackOverflow.”
- LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Code (2024, methodology): “…other tasks and scenarios like type prediction (Mir et al., 2022; Wei et al., 2023a; Malik et al., 2019), code summarization (LeClair et al., 2019; Iyer et al., 2016; Barone and Sennrich, 2017; Hasan et al., 2021; Alon et al., 2018), code security (Liguori et al., 2022; Pearce et al., 2022; Tony…”
- code2seq: Generating Sequences from Structured Representations of Code (2018, methodology): “On both tasks, our CODE 2 SEQ model outperforms models that were explicitly designed for code, such as the model of Allamanis et al. (2016) and CodeNN (Iyer et al., 2016), as well as state-of-the-art NMT models (Luong et al., 2015; Vaswani et al., 2017).”
- Learning to Ask: Neural Question Generation for Reading Comprehension (2017, methodology): “…inspired by the recent success in neural machine translation (Sutskever et al., 2014; Bahdanau et al., 2015), summarization (Rush et al., 2015; Iyer et al., 2016), and image caption generation (Xu et al., 2015), we tackle question generation using a conditional neural language model with a…”
- code2vec: learning distributed representations of code (2018, background): “Several works have investigated the properties of source code as bimodal: it is at the same time executable for machines, and readable for humans [Allamanis et al. 2015a, 2016, 2015b; Iyer et al. 2016; Murali et al. 2017; Zilberstein and Yahav 2016].”
- NL2Bash: A Corpus and Semantic Parser for Natural Language Interface to the Linux Operating System (2018, background): “Extracting good alignments from them is very challenging (Quirk et al., 2015; Iyer et al., 2016; Yao et al., 2018).”
- Big Code != Big Vocabulary: Open-Vocabulary Models for Source Code (2020, neutral): “code, such as models to suggest readable names [3], summarizing source code [5, 49], predicting bugs [70], detecting code clones [87], comment generation [47], and variable de-obfuscation [10].”
- CoaCor: Code Annotation for Code Retrieval with Reinforcement Learning (2019, methodology): “by combining their scores from both the QC-based as well as QN-based CR models, which utilize both the programming content as well as the NL annotation of a code snippet. Onawidelyusedbenchmarkdataset[21]andarecentlycollected large-scale dataset [63], we show that the automatically generated annotat”
- Patching as Translation: the Data and the Metaphor (2020, background): “. More recently, this includes a range of applications of the seq2seq architecture in modeling source code. Existing work has exploited their potential in several SE tasks, such as code summarization [16], code migration [10] and program repair [5, 6, 22, 30]. The prevalent approach is to treat sour”
- Recent advances in document summarization (2017, background): “scripts [64], entity descriptions in knowledge graphs [27], and source codes descriptions [80].”
- Code Generation as a Dual Task of Code Summarization (2019, methodology): “CODE-NN [Iyer et al., 2016] uses token embeddings to encode source code and uses an LSTM to decode.”