CODIT:使用基于树的神经模型进行代码编辑
CODIT: Code Editing with Tree-Based Neural Models
摘要:
开发人员编辑日常代码的方式往往是重复的,通常使用现有的代码元素。许多研究人员试图通过从应用于有限范围的特定更改模板中学习来自动化重复的代码更改。深度神经网络的进步和大量开源进化数据的可用性为自动从野外学习这些模板提供了可能。然而,基于深度神经网络的代码更改和代码建模一般会引入一些需要研究界特别关注的特定问题。例如,与自然语言相比,源代码词汇表可以大得多。此外,代码中好的变化不会破坏其语法结构。因此,部署最先进的神经网络模型而不使方法适应源代码域产生次优结果。为此,我们提出了一种新的基于树的神经网络系统来模拟源代码的变化,并从野外学习代码变化模式。具体来说,我们提出了一个基于树的神经机器翻译模型来学习代码变化的概率分布。我们实现了我们的模型与变化的建议引擎,CODIT,训练模型与超过24k的现实世界的变化,并评估它的5k补丁。我们的评估表明,有效的CODIT学习和建议补丁。CODIT还可以从bug修复补丁中学习特定的bug修复模式,并可以修复Defects4J中80个bug中的25个bug。
英文摘要:
The way developers edit day-to-day code tends to be repetitive, often using existing code elements. Many researchers have tried to automate repetitive code changes by learning from specific change templates which are applied to limited scope. The advancement of deep neural networks and the availability of vast open-source evolutionary data opens up the possibility of automatically learning those templates from the wild. However, deep neural network based modeling for code changes and code in general introduces some specific problems that needs specific attention from research community. For instance, compared to natural language, source code vocabulary can be significantly larger. Further, good changes in code do not break its syntactic structure. Thus, deploying state-of-the-art neural network models without adapting the methods to the source code domain yields sub-optimal results. To this end, we propose a novel tree-based neural network system to model source code changes and learn code change patterns from the wild. Specifically, we propose a tree-based neural machine translation model to learn the probability distribution of changes in code. We realize our model with a change suggestion engine, CODIT, and train the model with more than 24k real-world changes and evaluate it on 5k patches. Our evaluation shows the effectiveness of CODITin learning and suggesting patches. CODIT can also learn specific bug fix pattern from bug fixing patches and can fix 25 bugs out of 80 bugs in Defects4J.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。