arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1710.11054cs.AIcs.PLcs.SE
收藏

基于神经符号转换网络的语义代码修复

Semantic Code Repair using Neuro-Symbolic Transformation Networks

Google(谷歌);Google DeepMind(谷歌DeepMind);Microsoft Research(微软研究院)

Jacob Devlin, Jonathan Uesato, Rishabh Singh, Pushmeet Kohli

摘要:

我们研究语义代码修复的问题,它可以被广泛地定义为自动修复源代码中的非语法错误。过去语义代码修复中的大多数工作都假设可以访问单元测试,可以根据这些测试来验证候选修复。相比之下,这里的目标是开发一个强大的统计模型,以准确地预测错误位置和确切的修复,而无需访问有关程序预期正确行为的信息。实现这样一个目标需要一个健壮的上下文修复模型,我们训练一个大的语料库的真实世界的源代码,已与合成注入的错误。我们的框架采用了两个阶段的方法,首先是一个大的修复候选人生成的规则为基础的处理器,然后这些候选人进行了评分的统计模型,使用一种新的神经网络架构,我们称之为共享,专业化,竞争。具体来说,该架构(1)使用RNN在抽象语法树上生成源代码的共享编码,(2)使用专用网络模块对每个候选修复进行评分,以及(3)然后将这些评分标准化在一起,以便它们可以在可比的概率空间中相互竞争。我们在从GitHub收集的真实世界测试集上评估我们的模型,其中包含四种常见的bug。我们的模型能够预测准确的正确修复41%的时间与一个单一的猜测,相比之下,13%的准确率为注意序列到序列模型。

英文摘要:

We study the problem of semantic code repair, which can be broadly defined as automatically fixing non-syntactic bugs in source code. The majority of past work in semantic code repair assumed access to unit tests against which candidate repairs could be validated. In contrast, the goal here is to develop a strong statistical model to accurately predict both bug locations and exact fixes without access to information about the intended correct behavior of the program. Achieving such a goal requires a robust contextual repair model, which we train on a large corpus of real-world source code that has been augmented with synthetically injected bugs. Our framework adopts a two-stage approach where first a large set of repair candidates are generated by rule-based processors, and then these candidates are scored by a statistical model using a novel neural network architecture which we refer to as Share, Specialize, and Compete. Specifically, the architecture (1) generates a shared encoding of the source code using an RNN over the abstract syntax tree, (2) scores each candidate repair using specialized network modules, and (3) then normalizes these scores together so they can compete against one another in comparable probability space. We evaluate our model on a real-world test set gathered from GitHub containing four common categories of bugs. Our model is able to predict the exact correct repair 41\% of the time with a single guess, compared to 13\% accuracy for an attentional sequence-to-sequence model.

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

↑