语境语码变化的结构模型
A Structural Model for Contextual Code Changes
摘要:
我们解决的问题,预测编辑完成的基础上学习的模型,在过去的编辑训练。给定一个部分编辑的代码片段,我们的目标是预测代码片段其余部分的编辑完成。我们把这个任务称为编辑完成任务,并提出了一种新的方法来处理它。主要思想是直接表示结构编辑。这使我们能够对编辑本身的可能性进行建模,而不是学习编辑代码的可能性。我们将编辑操作表示为程序的抽象树(AST)中的路径,从编辑的源到编辑的目标。使用这种表示,我们为编辑完成任务提供了一个强大而轻量级的神经模型。我们进行了全面的评估,比较我们的方法,各种表示和建模方法,由多个强大的模型,如LSTM,Transformers,和神经CRF驱动。我们的实验表明,与最先进的顺序模型相比,我们的模型实现了28%的相对增益,并且比学习生成编辑代码的语法模型高出2倍的准确性,而不是直接对编辑进行建模。我们的代码、数据集和训练模型可在https://github.com/tech-srl/c3po/上公开获取。
英文摘要:
We address the problem of predicting edit completions based on a learned model that was trained on past edits. Given a code snippet that is partially edited, our goal is to predict a completion of the edit for the rest of the snippet. We refer to this task as the EditCompletion task and present a novel approach for tackling it. The main idea is to directly represent structural edits. This allows us to model the likelihood of the edit itself, rather than learning the likelihood of the edited code. We represent an edit operation as a path in the program's Abstract Syntax Tree (AST), originating from the source of the edit to the target of the edit. Using this representation, we present a powerful and lightweight neural model for the EditCompletion task. We conduct a thorough evaluation, comparing our approach to a variety of representation and modeling approaches that are driven by multiple strong models such as LSTMs, Transformers, and neural CRFs. Our experiments show that our model achieves a 28% relative gain over state-of-the-art sequential models and 2x higher accuracy than syntactic models that learn to generate the edited code, as opposed to modeling the edits directly. Our code, dataset, and trained models are publicly available at https://github.com/tech-srl/c3po/ .
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。