Program Repair: Automated vs. Manual

Quanjun Zhang, Yuan Zhao, Weisong Sun, Chunrong Fang, Ziyuan Wang, Lingming ZhangarXiv 2022 · DOI

Introduction

Software debugging is a significant economic burden, often accounting for more than 50% of total development costs. Automated Program Repair (APR) has emerged as a promising solution to this problem by automatically generating patches for buggy code. However, most APR research focuses on tool performance in isolation, neglecting the reality that a human developer is almost always in the loop. This study investigates the critical gap between automated tools and human developers, exploring whether APR suggestions act as helpful aids or dangerous distractions.

Methodology

The researchers conducted a large-scale human study involving 20 participants, including graduate students and developers with industry experience. The experiment comprised 160 manual repair tasks, comparing unaided manual repair against three state-of-the-art APR tools representing different technical paradigms:

  1. PraPR: A template-based tool operating at the bytecode level.
  2. SimFix: A heuristic-based tool that searches for similar code snippets as "donors" for fixes.
  3. ACS: A constraint-based tool focused on synthesizing precise conditions for conditional statements.

Participants were divided into groups receiving varying levels of assistance: no aid, buggy location information only, or full repair reports from one of the three APR tools. The study measured repairability (success rate), correctness (accuracy of the fix), and efficiency (time taken).

Experimental workflow for comparing manual and automated program repair.

Datasets

The study utilized Defects4J, the industry-standard benchmark for Java vulnerabilities. The authors selected eight real-world bugs from four major projects (Chart, Time, Lang, and Math) to ensure a diverse spread of bug types, including conditional statement errors, incorrect method calls, and assignment mistakes.

Key Insights and Ideas

The "Misguidance" Trap

The most striking finding was the negative impact of incorrect tool suggestions. When APR tools provided a "plausible but incorrect" patch—one that passes the test suite but fails to address the underlying logic—human correctness plummeted to 23%. In contrast, humans given only the bug's location maintained a correctness rate of over 70%.

Speed vs. Precision

APR tools operate on a "spray and pray" model, generating hundreds of candidates in seconds to find one that passes tests. Conversely, humans spend significant time on code comprehension, typically fixing the bug in just one or two attempts. While tools are faster, they lack the deep understanding humans bring to the task.

The Value of Execution Feedback

Interestingly, 70% of participants expressed a desire to see the tool's log reports even when the tool failed to find a fix. These logs, which show suspicious lines and failed attempts, provide valuable debugging hints that developers find useful for manual repair.

Comparative Performance

As shown in the table below, humans (unaided) successfully fixed 6 out of 8 bugs. While no single APR tool fixed more than 3 bugs individually, the tools were found to be complementary; a combination of all three tools could address 7 out of 8 bugs.

Repair success rates across different programs for humans and APR tools.
  • Correctness: Manual patches achieved a correctness ratio of over 90%. In contrast, only about 25% of the "plausible" patches generated by the APR tools were actually correct.
  • Efficiency: APR tools were significantly faster, taking between 54 and 656 seconds on average. Humans averaged approximately 18 minutes (1072 seconds) per bug.
  • The Assist: While APR reports increased the total number of bugs fixed by humans, they negatively impacted the correctness of those fixes as developers often blindly trusted the tool's output.

Conclusion and Future Work

The study highlights that the future of APR lies not just in better algorithms, but in improved human-tool interface design. The authors suggest that tools should normalize patches into human-readable formats, provide confidence scoring to warn users of risky patches, and integrate directly into IDEs to provide refined debugging hints rather than just final answers.

Summary updated

BibTeX
@misc{zhang2022program,
  author = {Quanjun Zhang and Yuan Zhao and Weisong Sun and Chunrong Fang and Ziyuan Wang and Lingming Zhang},
  title = {{Program Repair: Automated vs. Manual}},
  year = {2022},
  eprint = {2203.05166},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2203.05166},
}
Figure