Explainable Automated Program Repair Using XAI
Explainable Automated Program Repair Using XAI
Techniques
1. Proposed Work:
The XAIR framework is a novel system designed to address the growing need for more
transparent and interpretable Automated Program Repair (APR) systems. Traditionally, APR
tools use machine learning or program synthesis techniques to automatically generate patches
for software bugs. However, many of these systems suffer from a black-box nature, meaning
developers often don’t understand how or why a particular patch was generated, which limits
trust in the tool.
2. Conceptualization:
This conceptual framework addresses the primary barrier to APR adoption—trust—by ensuring
that developers can see both the fix and the reasoning behind it, making the system a
valuable tool in real-world software engineering.
3. Proof of Concept:
XAIR’s proof of concept was demonstrated through experiments on the Defects4J dataset,
which is a benchmark dataset commonly used to evaluate automated program repair systems.
Defects4J contains real-world bugs from open-source Java projects such as Apache Commons,
JFreeChart, and Google Guava. XAIR was tested on this dataset to assess its effectiveness in
generating patches and providing explanations. The results provided strong evidence
supporting XAIR’s capabilities:
● Improved Patch Accuracy: The deep learning model used in XAIR will outperform
other state-of-the-art APR systems in terms of generating correct patches. By leveraging
additional contextual information (such as bug reports and code features), XAIR
improved the likelihood of generating accurate repairs.
● Developer Trust and Adoption: A key part of the proof of concept was a developer
study, where developers reviewed the generated patches along with their explanations.
Developers were asked to rate their confidence in the patches and their willingness to
accept them. The study found that trust in the patches was significantly higher when
explanations were provided, validating the need for explainability in APR systems.
This experimental validation shows that XAIR not only improves the quality of automated repairs
but also addresses the critical issue of trust, paving the way for wider adoption of APR systems
in practice.
4. Workflow:
The XAIR workflow integrates patch generation and explainability into a cohesive system that
operates as follows:
1. Bug Detection:
○ The workflow begins by detecting bugs in a given program using static and
dynamic analysis techniques. This process identifies which parts of the code are
faulty, based on failed test cases in a test suite.
2. Context Extraction:
○ After detecting the bugs, XAIR extracts relevant contextual information around
each bug. This context includes variables, control flow structures, and execution
traces related to the bug, which are essential for generating accurate patches.
3. Patch Generation:
○ Using the extracted context, XAIR's deep learning sequence-to-sequence
model generates candidate patches for the bugs. The model is trained to predict
the fixed code based on the patterns it has learned from a large dataset of buggy
and fixed code pairs.
4. Patch Validation:
○ Once the patches are generated, they are validated by running them against the
program's test suite. Only patches that pass all the tests are considered valid.
This ensures that the generated patches do not introduce new bugs while fixing
the existing ones.
5. Local and Global Explanation Generation:
○ After the patches are validated, XAIR generates local explanations to describe
why each patch was made. These explanations are specific to the individual bug.
○ In addition, global explanations are generated to provide a high-level overview
of all bug fixes and how they impact the entire codebase. This two-level
explanation system helps developers understand both individual and cumulative
effects of the fixes.
6. Update Global Model:
○ The system then updates its global model with both the generated patches and
their explanations. This allows XAIR to learn from each repair and refine its patch
generation process for future bugs.
7. Developer Review:
○ Finally, the generated patches, along with their explanations, are presented to the
developers. The explanations allow developers to review the patches confidently,
knowing why a particular change was made and how it resolves the bug.