GypSum:学习混合表示法进行代码摘要
GypSum: Learning Hybrid Representations for Code Summarization
摘要:
近年来,基于深度学习的代码摘要得到了广泛的研究。当前用于代码摘要的深度学习模型通常遵循神经机器翻译的原理,并采用编码器-解码器框架,其中编码器从源代码学习语义表示,解码器将学习的表示转换为描述代码片段功能的人类可读文本。尽管它们实现了新的最先进的性能,但我们注意到,当前的模型通常生成不太流畅的摘要,或者无法捕获核心功能,因为它们通常专注于单一类型的代码表示。因此,我们提出了GypSum,这是一种新的深度学习模型,它使用图形注意力神经网络和预训练的编程和自然语言模型来学习混合表示。我们引入特定的边缘相关的控制流的代码片段到抽象语法树的图形构造,并设计了两个编码器,分别从图形和令牌序列的源代码,学习。我们修改了Transformer的解码器中的编码器-解码器子层,以融合表示,并提出了一个双拷贝机制,以促进摘要生成。实验结果表明GypSum的性能优于现有的代码摘要模型。
英文摘要:
Code summarization with deep learning has been widely studied in recent years. Current deep learning models for code summarization generally follow the principle in neural machine translation and adopt the encoder-decoder framework, where the encoder learns the semantic representations from source code and the decoder transforms the learnt representations into human-readable text that describes the functionality of code snippets. Despite they achieve the new state-of-the-art performance, we notice that current models often either generate less fluent summaries, or fail to capture the core functionality, since they usually focus on a single type of code representations. As such we propose GypSum, a new deep learning model that learns hybrid representations using graph attention neural networks and a pre-trained programming and natural language model. We introduce particular edges related to the control flow of a code snippet into the abstract syntax tree for graph construction, and design two encoders to learn from the graph and the token sequence of source code, respectively. We modify the encoder-decoder sublayer in the Transformer's decoder to fuse the representations and propose a dual-copy mechanism to facilitate summary generation. Experimental results demonstrate the superior performance of GypSum over existing code summarization models.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。