Abstract
Automated Program Repair (APR) has seen significant progress through the application of Neural Machine Translation (NMT) techniques. However, a persistent challenge remains: models frequently output code that is identical to the buggy input, resulting in a guaranteed failure. We propose the Fix-Filter-Fix ($F^3$) framework to address this "unchanged fix" problem. By implementing a simple, unsupervised filter that detects identical input-output pairs and redirects them to a secondary model with a distinct architectural perspective, $F^3$ enhances repair performance. Our evaluation across multiple Java benchmarks demonstrates that $F^3$ significantly boosts accuracy with negligible computational overhead compared to traditional ensemble methods.
Introduction: The "Unchanged Fix" Bottleneck
In recent years, bug fixing has been framed as a translation task where "buggy code" is translated into "fixed code." While powerful, NMT-based models often struggle with the high degree of similarity between the two. In many cases, a bug might involve only a single character or variable name change, meaning the buggy and fixed versions are often over 99% identical.
This proximity leads to a common failure mode: the model "plays it safe" and returns the input code completely unchanged. Because the input is known to be buggy, an unchanged output is an immediate, detectable failure. Current APR approaches often overlook this unsupervised signal, treating it as just another incorrect prediction rather than a specific type of failure that can be mitigated.
The Fix-Filter-Fix ($F^3$) Framework
The $F^3$ framework introduces a pipeline of "learners" connected by an intuitive filtering mechanism. The process follows three primary steps:
- Fix: A primary model (Learner A) attempts to repair the code.
- Filter: The system compares the output to the input. If they are identical, the output is flagged as an "unchanged fix."
- Fix: These flagged cases are passed to a secondary model (Learner B) for a second repair attempt.
Diversity and the "Lapse" Phenomenon
The authors identify these unchanged fixes as "lapses"—instances where a model fails to apply its learned knowledge to a specific case. Interestingly, while the frequency of these lapses generally decreases as models train longer, they never fully disappear in single-model architectures.
The effectiveness of $F^3$ relies on architectural diversity. Chaining two identical models provides no benefit because they likely share the same failure modes. Instead, the researchers utilize two different perspectives:
- Seq2Seq Transformer (ST): Processes code as a linear sequence of text tokens.
- AST2Seq Transformer (AT): Processes code based on its structural representation, the Abstract Syntax Tree.
Because ST and AT "see" the code differently, a bug that causes a lapse in one model is often correctly handled by the other.
Theoretical Lifting Effect and Results
A key contribution of this work is a mathematical framework to quantify the "lifting effect." By analyzing the individual performance of two models and the overlap of their failure sets, researchers can predict the accuracy of the combined $F^3$ system. This theory also helps determine the optimal ordering of models (e.g., ST followed by AT vs. AT followed by ST) without requiring exhaustive empirical testing.
The framework was evaluated on four Java bug-fixing benchmarks: BFP_small, BFP_medium, CodRep_real, and CodRep_abstract. On the BFP_small dataset, the standalone Seq2Seq Transformer (ST) achieved an accuracy of 14.09%. By applying the $F^3_{ST+AT}$ framework, the accuracy rose to 16.23%. This improvement is achieved with high efficiency; since the second model only runs when the first one fails via an unchanged fix, the additional computational cost is minimal compared to standard parallel ensemble methods.
Conclusion
The Fix-Filter-Fix framework demonstrates that simple, unsupervised signals can be leveraged to significantly improve the performance of deep learning models in specialized tasks like program repair. By strategically chaining diverse models and filtering obvious failures, $F^3$ provides a practical and theoretically grounded path toward more reliable automated bug fixing.
Summary updated