Detecting and fixing bugs are two of the most important yet frustrating parts of the software development cycle. Existing bug detection tools are based mainly on static analyzers, which rely on mathematical logic and symbolic reasoning about the program execution to detect common types of bugs. Fixing bugs is typically left out to the developer. In this work we introduce DeepDebug: a data-driven program repair approach which learns to detect and fix bugs in Java methods mined from real-world GitHub repositories. We frame bug-patching as a sequence-to-sequence learning task consisting of two steps: (i) denoising pretraining, and (ii) supervised finetuning on the target translation task. We show that pretraining on source code programs improves the number of patches found by 33% as compared to supervised training from scratch, while domain-adaptive pretraining from natural language to code further improves the accuracy by another 32%. We refine the standard accuracy evaluation metric into non-deletion and deletion-only fixes, and show that our best model generates 75% more non-deletion fixes than the previous state of the art. In contrast to prior work, we attain our best results when generating raw code, as opposed to working with abstracted code that tends to only benefit smaller capacity models. Finally, we observe a subtle improvement from adding syntax embeddings along with the standard positional embeddings, as well as with adding an auxiliary task to predict each token's syntactic class. Despite focusing on Java, our approach is language agnostic, requiring only a general-purpose parser such as tree-sitter.
翻译:检测和修正错误是软件开发周期中两个最重要但最令人沮丧的部分。 现有的错误检测工具主要以静态分析器为基础, 这些分析器依赖于数学逻辑和对程序执行的象征性推理, 以探测常见的错误类型。 修复错误通常留给开发者。 在此工作中, 我们引入 Deep Debug: 一种数据驱动的程序修复方法, 学习探测和修正从现实世界 GitHub 库中提取的 Java 方法中的错误。 我们将错误检测作为从序列到序列的学习任务, 由两个步骤组成:( 一) 去除预训练前, 以及 (二) 监督对目标翻译任务进行微调。 我们显示, 源代码程序前培训会增加33%的补丁数, 而从抓开始监督培训, 而从自然语言到代码的域适应前训练, 进一步提高了另外32%的准确度。 我们将标准准确度评价指标改进为非删除和删除的补丁方法, 并显示我们最好的模型产生75 % 非删除的缩缩缩缩缩缩缩, 也就是我们最后的校正的校正的校正的校正的校正结果, 。 对比我们最后的校正的校正的校正的校正的校正的校正的校正的校正的校正, 我们的校正的校正的校正的校正的校正。