Characterizing Developer Use of Automatically Generated Patches

José Pablo Cambronero, Jiasi Shen, Jürgen Cito, Elena L. Glassman, Martin C. RinardVL/HCC 2019

Abstract

Automatic Patch Generation (APG) has the potential to revolutionize software maintenance, yet the human-in-the-loop aspect remains poorly understood. This paper presents a controlled user study with 12 developers to evaluate how they interact with automatically generated patches. Results indicate that providing candidate patches does not improve debugging speed or accuracy. Developers spent nearly 80% of their time understanding the original defect rather than evaluating solutions. Furthermore, participants showed a significant bias against structural changes and struggled to distinguish correct fixes from plausible but incorrect ones due to a lack of contextual tooling.

Introduction

As Automated Patch Generation (APG) tools mature, they increasingly produce "plausible" fixes—patches that pass all existing test cases but may still be logically incorrect. Consequently, human developers must vet these candidates. While algorithmic progress in patch generation is rapid, there is a critical lack of data on how developers actually use these tools. Do they accelerate the debugging process, or do they introduce a new cognitive burden of "patch inspection"? This study aims to bridge this gap by observing developer behavior in a realistic debugging scenario.

Methodology

The researchers conducted a controlled study involving 12 participants, primarily PhD students with extensive C/C++ experience. Participants were tasked with fixing two real-world bugs: libtiff-d13be-ccadf (an error-checking bug) and php-309892-309910 (a logic bug in substr_compare). These bugs were selected because they require a deep understanding of program semantics rather than simple crash fixes.

The study employed two groups:

  • Control Group: Provided with the bug's location and asked to fix it manually.
  • Experimental Group: Provided with the bug's location and five automatically generated patches. All five patches passed the test suite, but only one was logically correct.
Candidate patches for libtiff and php bugs.

The researchers recorded nine hours of screen activity, instrumented the environment to log events, and used "emergent coding" to qualitatively analyze developer behaviors and decision-making processes.

Key Insights and Results

The Understanding Gap

A primary finding was that the bottleneck in debugging is not writing the fix, but understanding the problem. Developers spent only 21% of their time examining the provided patches. The remaining 79% was dedicated to building a mental model of the buggy source code, reading documentation, and analyzing test cases. This suggests that current APG tools address the smaller portion of the developer's workload.

Bias and Variable Hunting

Participants exhibited a strong preference for "small" changes. They were skeptical of patches that removed entire code branches, even when that was the correct solution. Instead, they favored incremental "predicate" changes. Additionally, developers spent significant time (7.5%) "variable hunting"—searching for where variables used in patches were defined or modified elsewhere in the codebase.

The Challenge of Patch Comparison

Without specialized tools, developers resorted to ad-hoc methods for comparing candidate patches. This often involved manual side-by-side placement or rapid tab-switching, leading to "diff-fatigue."

Manual side-by-side patch comparison in the IDE.

Performance Outcomes

Contrary to expectations, the experimental group did not produce more correct fixes or work faster than the control group. In fact, when subjects chose a provided patch, they "overwhelmingly picked the wrong patch." In longer sessions, half of the experimental subjects eventually abandoned the provided patches entirely to write their own fixes from scratch.

Discussion and Future Work

The study highlights that current APG systems fail to provide the necessary context for effective human evaluation. To be truly useful, future tools should move beyond providing raw code and instead offer:

  • Variable Instrumentation: Visualizing the flow and values of variables within a patch.
  • Trace Summaries: Explaining how a patch alters the program's execution path.
  • Invariant Explanations: Describing the semantic properties that change (or remain stable) when a patch is applied.

While limited by a small sample size and the use of unfamiliar codebases, this research underscores the need for "patch-centric" IDEs that support the developer's cognitive process during debugging.

Summary updated

BibTeX
@inproceedings{cambronero2019characterizing,
  author = {José Pablo Cambronero and Jiasi Shen and Jürgen Cito and Elena L. Glassman and Martin C. Rinard},
  title = {{Characterizing Developer Use of Automatically Generated Patches}},
  booktitle = {VL/HCC},
  year = {2019},
  doi = {10.1109/vlhcc.2019.8818884},
}
Figure