DEAR: A Novel Deep Learning-based Approach for Automated Program Repair

Yi Li, Shaohua Wang, Tien N. Nguyen
5/4/2022
cs.SE

Official code: AutomatedProgramRepair-2021/dear-auto-fix (30 stars, Python, last commit 2021-09-16).

Abstract

The existing deep learning (DL)-based automated program repair (APR) models are limited in fixing general software defects. % We present {\tool}, a DL-based approach that supports fixing for the general bugs that require dependent changes at once to one or multiple consecutive statements in one or multiple hunks of code. % We first design a novel fault localization (FL) technique for multi-hunk, multi-statement fixes that combines traditional spectrum-based (SB) FL with deep learning and data-flow analysis. It takes the buggy statements returned by the SBFL model, detects the buggy hunks to be fixed at once, and expands a buggy statement $s$ in a hunk to include other suspicious statements around $s$.

Show full abstract

We design a two-tier, tree-based LSTM model that incorporates cycle training and uses a divide-and-conquer strategy to learn proper code transformations for fixing multiple statements in the suitable fixing context consisting of surrounding subtrees. We conducted several experiments to evaluate {\tool} on three datasets: Defects4J (395 bugs), BigFix (+26k bugs), and CPatMiner (+44k bugs). On Defects4J dataset, {\tool} outperforms the baselines from 42\%--683\% in terms of the number of auto-fixed bugs with only the top-1 patches. On BigFix dataset, it fixes 31--145 more bugs than existing DL-based APR models with the top-1 patches. On CPatMiner dataset, among 667 fixed bugs, there are 169 (25.3\%) multi-hunk/multi-statement bugs. {\tool} fixes 71 and 164 more bugs, including 52 and 61 more multi-hunk/multi-statement bugs, than the state-of-the-art, DL-based APR models.

View on arXivView PDF

Code Implementations(1)

3013Python, ShellSep 1, 20215 years ago

Similar Papers

Cite this paper

@article{li2022dear,
  title  = {DEAR: A Novel Deep Learning-based Approach for Automated Program Repair},
  author = {Yi Li and Shaohua Wang and Tien N. Nguyen},
  year   = {2022},
  eprint = {2205.01859},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.01859}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2205.01859.svg)](https://codeofpaper.com/paper/2205.01859)

Discussion