一句话:将编译与测试执行结果引入损失函数进行反向传播,改进基于NMT的自动程序修复,提高补丁可编译性与修复成功率。
神经机器翻译(NMT)架构在自动程序修复上已有进展,但现有方法仅以字符和词元上的纯语法损失函数优化网络权重,未利用程序特有信息,因而常生成不可编译的低质量补丁。本文提出 RewardRepair,其核心创新在于把程序编译结果与测试执行信息构造成损失函数,对神经网络进行反向传播优化,从而奖励那些能够编译且不过拟合的补丁。作者在四个基准上开展实验,结果显示使用编译与测试执行结果来优化神经修复模型是可行且有效的:RewardRepair 正确修复了 207 个缺陷,其中 121 个为此前文献中从未修复过的缺陷;同时其生成可编译补丁的比例最高达 45.3%,优于当前最优方法的 39%。
Neural machine translation (NMT) architectures have achieved promising results for automatic program repair. Yet, they have the limitation of generating low-quality patches (e.g., not compilable patches). This is because the existing works only optimize a purely syntactic loss function based on characters and tokens without incorporating program-specific information during neural network weight optimization. In this paper, we propose a novel program repair model called RewardRepair. The core novelty of RewardRepair is to improve NMT-based program repair with a loss function based on program compilation and test execution information, rewarding the network to produce patches that compile and that do not overfit. We conduct several experiments to evaluate RewardRepair showing that it is feasible and effective to use compilation and test execution results to optimize the underlying neural repair model. RewardRepair correctly repairs 207 bugs over four benchmarks. we report on repair success for 121 bugs that are fixed for the first time in the literature. Also, RewardRepair produces up to 45.3% of compilable patches, an improvement over the 39% by the state-of-the-art.