arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2002.10198cs.IRcs.CLcs.SE
收藏

利用代码生成通过双重学习改进代码检索和摘要

Leveraging Code Generation to Improve Code Retrieval and Summarization via Dual Learning

National Engineering Research Center for Software Engineering, Peking University(北京大学软件工程国家工程研究中心);School of Software and Microelectronics, Peking University(北京大学软件与微电子学院);University of Texas at San Antonio(德克萨斯大学圣安东尼奥分校)

Wei Ye, Rui Xie, Jinglei Zhang, Tianxiang Hu, Xiaoyin Wang, Shikun Zhang

摘要:

代码摘要在给定源代码片段的情况下生成简短的自然语言描述,而代码检索在给定自然语言查询的情况下获取相关源代码。由于这两个任务的目的是建立自然语言和程序设计语言之间的联系,最近的研究已经结合这两个任务,以提高其性能。然而,研究人员还没有能够有效地利用这两个任务之间的内在联系,因为他们训练这些任务在一个单独的或管道的方式,这意味着他们的表现不能很好地平衡。在本文中,我们提出了一个新的端到端的模型,这两个任务,通过引入一个额外的代码生成任务。更具体地说,我们明确地利用代码摘要和代码生成与双重学习之间的概率相关性,并利用两个编码器的代码摘要和代码生成训练的代码检索任务,通过多任务学习。我们已经在现有的SQL和Python数据集上进行了广泛的实验,结果表明,我们的模型可以显着提高代码检索任务的结果超过最先进的模型,以及实现竞争力的性能方面的BLEU得分的代码摘要任务。

英文摘要:

Code summarization generates brief natural language description given a source code snippet, while code retrieval fetches relevant source code given a natural language query. Since both tasks aim to model the association between natural language and programming language, recent studies have combined these two tasks to improve their performance. However, researchers have yet been able to effectively leverage the intrinsic connection between the two tasks as they train these tasks in a separate or pipeline manner, which means their performance can not be well balanced. In this paper, we propose a novel end-to-end model for the two tasks by introducing an additional code generation task. More specifically, we explicitly exploit the probabilistic correlation between code summarization and code generation with dual learning, and utilize the two encoders for code summarization and code generation to train the code retrieval task via multi-task learning. We have carried out extensive experiments on an existing dataset of SQL and Python, and results show that our model can significantly improve the results of the code retrieval task over the-state-of-art models, as well as achieve competitive performance in terms of BLEU score for the code summarization task.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑