代码摘要生成论文列表
-
- 1. Recommendations for Datasets for Source Code Summarization
- 2. Abridging Source Code
- 3. Summarizing Source Code Using a Neural Attention Model
- 4. Code Generation as a Dual Task of Code Summarization
- 5. A Transformer-based Approach for Source Code Summarization
- 6. PYMT5: multi-mode translation of natural language and PYTHON code with transformers
- 7. Improved Code Summarization via a Graph Neural Network
- 8. Deep code comment generation
- 9. Summarizing Source Code with Transferred API Knowledge
- 10. A neural model for generating natural language summaries of program subroutines
- 11. Structured Neural Summarization
- 12. CoCoGUM: Contextual Code Summarization with Multi-Relational GNN on UMLs
- 13. Improving Automatic Source Code Summarization via Deep Reinforcement Learning
- 14. Improved Automatic Summarization of Subroutines via Attention to File Context
- 15. Autofolding for source code summarization
- 16. A parallel corpus of Python functions and documentation strings for automated code documentation and code generation
- 17. A Convolutional Attention Network for Extreme Summarization of Source Code
- 18. Automatic Source Code summarization with extended Tree-LSTM
- 19. Commit Message Generation for Source Code Changes
- 20. Automatic Generation of Text Descriptive Comments for Code Blocks
- 21. TranS: A Transformer-based framework for unifying code summarization and code search
- 22. Automatic Code sunmmarization: A systematic literature review
- 23. Reinforcement-Learning-Guided source code summarization using hierarchical attention
- 24. Fret: Functional Reinforced Transformer with BERT for code summarization
- 25. DeepSumm - Deep Code Summarization using Neural Transformer Architecture
1. Recommendations for Datasets for Source Code Summarization
NAACL 2019
A. LeClair, C. McMillan
论文pdf
这篇文章最大的贡献是提供了一个code summarization的数据集(仅包含Java语言的代码和英文的comments)FunCom (A java function and comment parallel corpus)

在论文中,还提出并回答了两个问题:
- What is the effect of splitting by method versus splitting by project?
提出这个问题是因为,一些工作按照method划分,划分成80%的训练集,10%的验证集,10%的测试集。但是这样就存在一个问题,就是一个project中的不同method可能被分到了训练集和测试集中,也就是说训练集和测试集中包含了similar vocabulary 和 code patterns。
这里的按照project划分的意思,应该是一个project中的所有method都划分到一个集合中,比如都在训练集中,或者都在测试集中。但是训练和测试的数据格式是和以method划分时候是一样的,都是(method, comment) pair。 - What is the effect of removing automatically generated Java methods?
提出这个问题是因为,Java中自动生成的代码是非常常见的,可能会出现训练集和测试集中都生成了相似的代码的情况。
文中验证了这两种不同的情况下,一个经典的NMT的表现的区别。下图纵轴是BLEU,可以看出,第一列和第二列回答的是第一个问题,发现通过function划分比通过project划分的BLEU值要大,也就是因为通过function划分时,训练集和测试集会有一些的重叠,导致性能更好。第二列和第三列的比较回答了第二个问题,发现在去掉自动生成的代码时,BLEU值下降。

除了以上两个问题,文中还说明了code 和 natural language之间的区别,比如:code中的词频比较集中,不像是自然语言中的长尾问题那么严重。还有两种语言中的词共现。
其他数据集:
-
ICML 2016, A Convolutional Attention Network for Extreme Summarization of Source Code. 其中的数据集是自己收集的,从github上找到了最受欢迎的11个Java projects。数据集和代码
-
ACL 2016, Summarizing Source Code using a Neural Attention Model. 其中的数据集是从StackOverflow上收集的,其中包含C#和sql的代码,数据集的统计信息如下:
数据集(看着像是每年都在更新的,最新的版本是2020年的) -
ASE 2018, Improving Automatic Source Code Summarization via Deep Reinforcement Learning. 其中用到的数据集是由另一篇文章贡献出来的(A parallel corpus of python functions and documentation strings for automated code documentation and code generation)。其中包含108726个python语言的code-comment pair,vocabulary size of code and comment is 50400 and 31350. 数据集链接
-
TSE 2017, Autofolding for Source Code Summarization. 其中用到的数据集是在github上收集的受欢迎的6个Java projects.
2. Abridging Source Code
OOPSLA 2017, CCF A (软件工程领域)
Binhang Yuan, Vijayarghaven Murali, Christopher Jermaine
Rice University, USA
论文pdf
这篇文章做的是代码的删减,作者认为代码的删减对于读者理解一段代码来说是有作用的,对于一个方法而言,删减不那么重要的部分,留下方法的主要部分,有利于读者快速并且有效的了解这个方法的功能。
文章将source code abridgement任务建模成整数规划的问题,也是一个约束优化问题,需要满足的条件是根据语法和语义特征设计的。
目标函数为:

其中的delta_k表示第k个代码删减后的statement表示,f measures the quality of the alignment,w相当于重要性向量,是随机初始化,并在训练过程中学习的。delta_k^h表示专家标注的删减数据。(训练集中包括70个Java方法)
在评估这个方法的有效性方面,这里用到的不是人为标注的数据进行评估,而是对23个研究生进行了测试。测试过程中,设计了两个任务,第一个任务是search problem,每一个题目会提供一个自然语言的描述,还包括5个候选Java methods,需要测试者选出与自然语言描述最相关的Java method。共有8个题目,包括2个热身题目,也就是任务1共需要准备(6+2) * 5= 40个代码。第二个任务是match problem,每个题目会提供两个自然语言描述,还有两个Java methods,需要测试者将自然语言和Java method进行匹配。共11个题目,包括2个热身题目,也就是任务2共需要准备(9+2) * 2=22个代码。每个任务中的Java method都有三部分组成,一部分是原始的代码,一部分是由一个很简单的方法删除50%代码后的代码,另一部分是由本文提出的整数规划方法删除50%代码后的代码。
任务2的系统截图

最终,得到的实验结果是:




以上结果可以看出,由本文提出的方法删减代码,读者做这些任务的准确率有了提升,并且在花费时间上也有提升。所以说明这个方法删减代码是对于程序员理解代码有用的。
3. Summarizing Source Code Using a Neural Attention Model
ACL 2016
Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, Luke Zettlemoyer
University of Washington
论文pdf
data and code
这篇文章做的是code summary,为了减轻人工写summary的负担,本文提出一个完全数据驱动的code summary生成的模型,叫做CODE-NN。该模型的基本架构是LSTM with attention。本文的贡献点在于:
- 提出了一个数据驱动的模型CODE-NN,在code summarization和code retrieval两个任务上取得了sota的结果。
- 贡献了一个code summary的数据集,该数据集是从StackOverflow上收集的,并经过一系列清洗等处理,最终的数据集规模如下图。

CODE-NN模型部分:

上图是根据代码生成自然语言summary的过程,模型使用的是LSTM,最开始输入LSTM的是NULL,接着根据代码c和当前LSTM输出的隐状态向量计算attention,得到attention之后,形成新的表示向量,softmax得到该时刻应该输出的自然语言的token,再将该token作为下一时刻的输入,重复以上过程,直至输出END。
模型包含两个主要的部分,一个是LSTM学习自然语言token基于上下文的表示,一个是attention。
在实验部分,对于code summary的任务,比较的baseline方法是:
- IR: An information retrieval baseline that outputs the title associated with the code c_j in the training set that is closest to the input code c in terms of token Levenshtein distance.
- MOSES (2007): A popular phrase-based machine translation system.
- SUM-NN (2015): A neural attention-based abstractive summarization model.
评价指标包括:
- METEOR
- BLEU-4
- Human Evaluation
对于code retrieval任务,比较的baseline方法是:
- RET-IR: An information retrieval baseline
评价指标包括:
- MRR
4. Code Generation as a Dual Task of Code Summarization
NIPS 2019
Bolin Wei, Ge Li, Xin Xia, Zhiyi Fu, Zhi Jin
Peking University, Monash University
论文pdf
code
这篇文章最大的创新点在于将code summarization和code generation作为dual task,而不是将他们作为单独的任务,单独训练。作者认为 the attention weights from the two models should be as similar as possible because they both reflect the similarity between the token at one end to the token at the other end.

系列&spm=1001.2101.3001.5002&articleId=112799750&d=1&t=3&u=4e806249a88b48d08f09d8b2983c6014)
1221

被折叠的 条评论
为什么被折叠?



