On Multi-Modal Learning of Editing Source Code

On Multi-Modal Learning of Editing Source Code
复制标题

DOI:
10.1109/ase51524.2021.9678559
复制
发表时间:
2021-08
期刊:
2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE)
影响因子:
--
通讯作者:
Saikat Chakraborty;Baishakhi Ray
Saikat Chakraborty;Baishakhi Ray
中科院分区:
其他
文献类型:
--
作者:
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.