Automated Program Repair (APR) improves software reliability by generating patches for a buggy program automatically. Recent APR techniques leverage deep learning (DL) to build models to learn to generate patches from existing patches and code corpora. While promising, DL-based APR techniques suffer from the abundant syntactically or semantically incorrect patches in the patch space. These patches often disobey the syntactic and semantic domain knowledge of source code and thus cannot be the correct patches to fix a bug. We propose a DL-based APR approach KNOD, which incorporates domain knowledge to guide patch generation in a direct and comprehensive way. KNOD has two major novelties, including (1) a novel three-stage tree decoder, which directly generates Abstract Syntax Trees of patched code according to the inherent tree structure, and (2) a novel domain-rule distillation, which leverages syntactic and semantic rules and teacher-student distributions to explicitly inject the domain knowledge into the decoding procedure during both the training and inference phases. We evaluate KNOD on three widely-used benchmarks. KNOD fixes 72 bugs on the Defects4J v1.2, 25 bugs on the QuixBugs, and 50 bugs on the additional Defects4J v2.0 benchmarks, outperforming all existing APR tools.


翻译:自动程序修复(APR)通过自动生成补丁修复程序中存在的故障自动来提高软件可靠性。最近的 APR 技术利用深度学习(DL)构建模型,从现有的补丁和代码库中学习生成补丁。尽管有前途,DL-Based 的 APR 技术仍受制于补丁空间中大量的语法或语义不正确的补丁。这些补丁往往违反了源代码的语法和语义领域知识,因此不能成为修复 bug 的正确补丁。我们提出了一种 DL-Based 的 APR 方法 KNOD,它将领域知识直接而全面地引导到补丁生成中。KNOD 有两个主要的创新点,包括(1)一种新颖的三级树解码器,根据内在的树结构直接生成已修补代码的抽象语法树,以及(2)一种新颖的领域规则提取技术,利用语法和语义规则和教师 - 学生分布,将领域知识显式注入到训练和推理过程中的解码过程中。我们在三个广泛使用的基准测试上评估了 KNOD。KNOD 修复了 Defects4Jv1.2 上的 72 个 bug,QuixBugs 上的 25 个 bug,以及其他 Defects4Jv2.0 基准测试上的 50 个 bug,优于所有现有的 APR 工具。

0
下载
关闭预览

相关内容

领域知识:特定行业,方向的专业知识。
百篇论文纵览大型语言模型最新研究进展
专知会员服务
69+阅读 · 2023年3月31日
【CVPR2021】基于反事实推断的视觉问答框架
专知会员服务
26+阅读 · 2021年3月4日
【MIT】硬负样本的对比学习
专知会员服务
39+阅读 · 2020年10月14日
最新BERT相关论文清单,BERT-related Papers
专知会员服务
52+阅读 · 2019年9月29日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
逆强化学习-学习人先验的动机
CreateAMind
15+阅读 · 2019年1月18日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
vae 相关论文 表示学习 1
CreateAMind
12+阅读 · 2018年9月6日
【论文】图上的表示学习综述
机器学习研究会
12+阅读 · 2017年9月24日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
1+阅读 · 2008年12月31日
Arxiv
19+阅读 · 2021年6月15日
VIP会员
相关基金
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
1+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员