一句话:提出 KNOD,用三段式树解码器与领域规则蒸馏将语法语义知识注入补丁生成,修复缺陷数超越现有 APR 工具。
基于深度学习的自动程序修复(APR)虽能从历史补丁与代码语料中学习生成补丁,但补丁空间中存在大量语法或语义错误的候选,违背源码的语法语义领域知识,因而无法真正修复缺陷。本文提出 KNOD,以直接且全面的方式将领域知识融入补丁生成:其一为新颖的三段式树解码器,依据代码固有的树结构直接生成修复后代码的抽象语法树;其二为新颖的领域规则蒸馏,利用语法与语义规则以及教师—学生分布,在训练与推理两个阶段将领域知识显式注入解码过程。作者在三个广泛使用的基准上评估 KNOD:在 Defects4J v1.2 上修复 72 个缺陷,在 QuixBugs 上修复 25 个,在额外的 Defects4J v2.0 上修复 50 个,性能优于所有已有 APR 工具。
Automated Program Repair (APR) improves soft-ware 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 in-corporates 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.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2302-01857,
title = {KNOD: Domain Knowledge Distilled Tree Decoder for Automated Program Repair},
author = {Nan Jiang and Thibaud Lutellier and Yiling Lou and Lin Tan and Dan Goldwasser and Xiangyu Zhang},
booktitle = {ICSE},
year = {2023},
doi = {10.1109/icse48619.2023.00111}
}