Skip to main content
QUICK REVIEW

[Paper Review] DEAR: A Novel Deep Learning-based Approach for Automated Program Repair

Yi Li, Shaohua Wang|arXiv (Cornell University)|May 4, 2022
Software Testing and Debugging TechniquesComputer Science11 citations
TL;DR

DEAR proposes a novel deep learning-based approach for automated program repair that addresses multi-hunk, multi-statement bugs by combining spectrum-based fault localization with BERT fine-tuning and data-flow analysis to identify dependent code changes. It uses a two-tier tree-based LSTM with cycle training and attention to generate accurate, context-aware fixes, outperforming state-of-the-art DL-based APR models by fixing 42% to 683% more bugs on Defects4J and significantly more multi-hunk/multi-statement bugs on BigFix and CPatMiner.

ABSTRACT

The existing deep learning (DL)-based automated program repair (APR) models are limited in fixing general software defects. % We present { ool}, 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$. 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 { ool} on three datasets: Defects4J (395 bugs), BigFix (+26k bugs), and CPatMiner (+44k bugs). On Defects4J dataset, { ool} 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. { ool} 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.

Motivation & Objective

  • Address the limitation of existing deep learning-based automated program repair (APR) tools that fix only single statements, not dependent changes across multiple statements or hunks.
  • Improve fault localization accuracy for multi-hunk, multi-statement bugs by combining spectrum-based fault localization (SBFL) with deep learning and data-flow analysis.
  • Develop a compositional, divide-and-conquer strategy to learn and generate complex code transformations across multiple AST subtrees.
  • Enhance a two-layer tree-based LSTM with attention and cycle training to improve learning of structural code changes in multi-statement fixes.
  • Enable end-to-end repair of general software defects requiring coordinated changes across multiple code hunks, which current DL-based APR models cannot handle effectively.

Proposed method

  • Integrate spectrum-based fault localization (SBFL) with fine-tuned BERT to identify suspicious statements and determine which code hunks require joint repair.
  • Design an expansion algorithm that uses an RNN to classify statements as buggy and applies data-flow analysis to extend the buggy region to include dependent, consecutive statements.
  • Use AST-based differencing to extract fine-grained, subtree-level mappings between buggy and fixed code, enabling accurate alignment and transformation learning.
  • Implement a two-tier, tree-based LSTM model that processes AST subtrees hierarchically, applying a divide-and-conquer strategy to learn individual subtree transformations.
  • Orchestrate the LSTM with an attention mechanism and cycle training to improve generalization and robustness in learning complex, multi-statement code changes.
  • Apply post-processing with semantic checkers and language-agnostic representations to ensure fix validity and support extensibility to other languages.

Experimental results

Research questions

  • RQ1Can a hybrid fault localization technique combining SBFL, deep learning, and data-flow analysis effectively identify multi-hunk, multi-statement bugs that require coordinated fixes?
  • RQ2Can a tree-based, two-tier LSTM model with attention and cycle training learn and generate accurate, context-aware code transformations for multiple dependent statements across different hunks?
  • RQ3To what extent does DEAR outperform existing deep learning-based APR models in fixing general software defects, especially multi-hunk/multi-statement bugs?
  • RQ4How effective is DEAR in handling complex, real-world bugs from large-scale industrial datasets such as BigFix and CPatMiner compared to state-of-the-art baselines?
  • RQ5What is the impact of compositional, subtree-level transformation learning on the accuracy and generalization of automated program repair models?

Key findings

  • On the Defects4J dataset, DEAR fixed between 42% and 683% more bugs than existing DL-based APR baselines when considering only the top-1 generated patches.
  • On the BigFix dataset, DEAR fixed 31 to 145 more bugs than the next best DL-based APR model using top-1 patches.
  • On the CPatMiner dataset, DEAR fixed 169 more total bugs and 52 more multi-hunk/multi-statement bugs than the state-of-the-art DL-based APR model.
  • Among 667 total fixed bugs in CPatMiner, DEAR successfully repaired 169 (25.3%) that involved multiple hunks and multiple statements, outperforming baselines by 61 more such complex bugs.
  • The integration of data-flow analysis and BERT fine-tuning in fault localization significantly improved the identification of buggy hunks requiring joint repair, reducing false positives.
  • The cycle training and attention-enhanced two-tier LSTM architecture improved the model’s ability to learn complex, hierarchical code transformations, especially in multi-statement repair scenarios.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.