一句话:提出代码感知的 NMT 程序修复技术,通过代码预训练、子词切分与代码感知搜索修复更多真实缺陷。
自动程序修复对提升软件可靠性至关重要,已有基于神经机器翻译(NMT)的方法虽具潜力,但存在两个主要局限:搜索空间常常不包含正确修复,且搜索策略忽略严格代码语法等软件知识,导致其性能不及最好的模板式方法。为此,作者提出 CURE,包含三点创新:一是在大规模软件代码库上预训练编程语言模型,使模型在修复任务前学到接近开发者的源码风格;二是设计代码感知搜索策略,优先搜索可编译的补丁以及与缺陷代码长度接近的补丁,从而找到更多正确修复;三是采用子词切分技术,缩小搜索空间同时保留更多正确修复。在两个广泛使用的基准上评估,CURE 正确修复 57 个 Defects4J 缺陷和 26 个 QuixBugs 缺陷,在两个基准上均优于所有现有自动程序修复技术。
Automatic program repair (APR) is crucial to improve software reliability. Recently, neural machine translation (NMT) techniques have been used to automatically fix software bugs. While promising, these approaches have two major limitations. Their search space often does not contain the correct fix, and their search strategy ignores software knowledge such as strict code syntax. Due to these limitations, existing NMT-based techniques underperform the best template-based approaches. We propose CURE, a new NMT-based APR technique with three major novelties. First, CURE pre-trains a programming language (PL) model on a large software codebase to learn developer-like source code before the APR task. Second, CURE designs a new code-aware search strategy that finds more correct fixes by focusing on searching for compilable patches and patches that are close in length to the buggy code. Finally, CURE uses a subword tokenization technique to generate a smaller search space that contains more correct fixes. Our evaluation on two widely-used benchmarks shows that CURE correctly fixes 57 Defects4J bugs and 26 QuixBugs bugs, outperforming all existing APR techniques on both benchmarks.