arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2108.06645cs.SEcs.LGcs.PL
收藏

编辑Source Code的多模态学习

On Multi-Modal Learning of Editing Source Code

Columbia University(哥伦比亚大学)

Saikat Chakraborty, Baishakhi Ray

摘要:

近年来,神经机器翻译器(NMT)在自动编辑源代码方面显示出了希望。典型的基于NMT的代码编辑器只考虑需要更改的代码作为输入,并建议开发人员从修补代码的排名列表中进行选择-其中正确的代码可能并不总是位于列表的顶部。虽然基于NMT的代码编辑系统生成了一系列看似合理的补丁,但正确的补丁取决于开发人员的需求,并且通常取决于应用补丁的上下文。因此,如果开发人员提供一些提示,使用自然语言,或提供补丁上下文,NMT模型可以从中受益。作为概念的证明,在这项研究中,我们利用三种形式的信息:编辑位置,编辑代码上下文,提交消息(作为开发人员的自然语言的提示代理)自动生成NMT模型的编辑。为此,我们构建了MODIT,一个基于多模态NMT的代码编辑引擎。通过深入的调查和分析,我们表明,开发人员的提示作为一种输入方式可以缩小搜索空间的补丁,并优于国家的最先进的模型生成正确的补丁代码的前1位。

英文摘要:

In recent years, Neural Machine Translator (NMT) has shown promise in automatically editing source code. Typical NMT based code editor only considers the code that needs to be changed as input and suggests developers with a ranked list of patched code to choose from - where the correct one may not always be at the top of the list. While NMT based code editing systems generate a broad spectrum of plausible patches, the correct one depends on the developers' requirement and often on the context where the patch is applied. Thus, if developers provide some hints, using natural language, or providing patch context, NMT models can benefit from them. As a proof of concept, in this research, we leverage three modalities of information: edit location, edit code context, commit messages (as a proxy of developers' hint in natural language) to automatically generate edits with NMT models. To that end, we build MODIT, a multi-modal NMT based code editing engine. With in-depth investigation and analysis, we show that developers' hint as an input modality can narrow the search space for patches and outperform state-of-the-art models to generate correctly patched code in top-1 position.

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

↑