Skip to main content
QUICK REVIEW

[Paper Review] A Syntax-Guided Edit Decoder for Neural Program Repair

Qihao Zhu, Zeyu Sun|arXiv (Cornell University)|Jun 15, 2021
Software Engineering ResearchComputer Science11 citations
TL;DR

This paper proposes a syntax-guided edit decoder, named \techname, for neural program repair that generates edits rather than full code sequences, ensuring syntactic correctness through a provider/decider architecture and supporting project-specific identifiers via placeholder generation. It achieves state-of-the-art performance, repairing 51 bugs on Defects4J v1.2—21.4% more than the prior SOTA—making it the first deep learning-based APR approach to outperform traditional methods on this benchmark.

ABSTRACT

Automated Program Repair (APR) helps improve the efficiency of software development and maintenance. Recent APR techniques use deep learning, particularly the encoder-decoder architecture, to generate patches. Though existing DL-based APR approaches have proposed different encoder architectures, the decoder remains to be the standard one, which generates a sequence of tokens one by one to replace the faulty statement. This decoder has multiple limitations: 1) allowing to generate syntactically incorrect programs, 2) inefficiently representing small edits, and 3) not being able to generate project-specific identifiers. In this paper, we propose Recoder, a syntax-guided edit decoder with placeholder generation. Recoder is novel in multiple aspects: 1) Recoder generates edits rather than modified code, allowing efficient representation of small edits; 2) Recoder is syntax-guided, with the novel provider/decider architecture to ensure the syntactic correctness of the patched program and accurate generation; 3) Recoder generates placeholders that could be instantiated as project-specific identifiers later. We conduct experiments to evaluate Recoder on 395 bugs from Defects4J v1.2 and 420 additional bugs from Defects4J v2.0. Our results show that Recoder repairs 53 bugs on Defects4J v1.2, which achieves 21.4% improvement over the previous state-of-the-art approach for single-hunk bugs (TBar). Importantly, to our knowledge, Recoder is the first DL-based APR approach that has outperformed the traditional APR approaches on this dataset. Furthermore, Recoder also repairs 19 bugs on the additional bugs from Defects4J v2.0, which is 137.5% more than TBar (8 bugs) and 850% more than SimFix (2 bugs). This result suggests that Recoder has better generalizability than existing APR approaches.

Motivation & Objective

  • To address the limitations of standard sequence-to-sequence decoders in deep learning-based program repair, which generate syntactically invalid programs and inefficiently represent small edits.
  • To improve the efficiency and correctness of neural program repair by modeling patches as edits rather than full code sequences.
  • To enable generation of project-specific identifiers through placeholder instantiation, enhancing contextual relevance.
  • To achieve superior generalization and performance over existing deep learning-based and traditional APR approaches.
  • To demonstrate that a redesigned decoder architecture can close the performance gap between deep learning-based and traditional APR techniques.

Proposed method

  • The proposed \techname decoder generates edits—such as token replacements, insertions, or deletions—instead of full code sequences, enabling efficient representation of small changes.
  • It employs a provider/decider architecture: the provider generates candidate edits, and the decider validates them against the syntax of the target language using a context-free grammar.
  • The model introduces placeholder tokens that are later instantiated with project-specific identifiers during post-processing, improving contextual accuracy.
  • The decoder is trained end-to-end using a sequence-to-sequence framework with a syntax-aware loss function to prioritize syntactically valid outputs.
  • The encoder processes the faulty statement and surrounding context, producing a latent representation that guides the edit decoder.
  • The approach integrates a copy mechanism to preserve unchanged code fragments and reduce generation complexity.
Figure 1. The Patch for Closure-14 in Defects4J
Figure 1. The Patch for Closure-14 in Defects4J

Experimental results

Research questions

  • RQ1Can a syntax-guided edit decoder improve the syntactic correctness and efficiency of neural program repair compared to standard sequence-to-sequence decoders?
  • RQ2Can the use of edit-based representation outperform full-code sequence generation in terms of repair effectiveness and generalization?
  • RQ3Can placeholder generation enable better integration of project-specific identifiers in learned patches?
  • RQ4Does \techname outperform both deep learning-based and traditional APR approaches on standard benchmarks?
  • RQ5Can a redesigned decoder architecture close the performance gap between deep learning-based and traditional APR systems?

Key findings

  • \techname repairs 51 bugs on Defects4J v1.2, representing a 21.4% improvement (9 additional bugs) over the prior SOTA approach, TBar, for single-hunk bugs.
  • On additional Defects4J v2.0 bugs, \techname repairs 19 bugs—137.5% more than TBar and 850% more than SimFix—demonstrating strong generalization.
  • It achieves 775% improvement over baselines on IntroClassJava and 30.8% improvement on QuixBugs, indicating broad effectiveness across diverse benchmarks.
  • To the authors' knowledge, \techname is the first deep learning-based APR approach to outperform traditional APR techniques on the Defects4J v1.2 benchmark.
  • The syntax-guided provider/decider architecture significantly reduces the generation of syntactically invalid patches, improving reliability and training efficiency.
  • Placeholder-based identifier generation enables context-aware patching, enhancing the relevance and correctness of repaired code in real-world projects.
Figure 2. The Patch for Lang-57 in Defects4J
Figure 2. The Patch for Lang-57 in Defects4J

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.