🤖 AI Summary
Existing automated program repair (APR) methods lack transparent, human-understandable diagnostics—especially for novice programmers—while struggling with multilingual error localization, correction, and explainability.
Method: We propose the first joint modeling framework for repair and explanation, integrating pretrained code language models, a customized repair network, chain-of-thought (CoT) reasoning to generate intermediate diagnostic logic, graph neural networks (GNNs) to encode program structure, and a multi-perspective program–test-case augmentation strategy.
Contribution/Results: Our approach is the first to deeply couple explainability into the repair pipeline via structure-aware encoding and logical reasoning, significantly enhancing diagnostic transparency. Experiments on multilingual error benchmarks demonstrate substantial improvements in both repair accuracy and explanation relevance. Crucially, while maintaining expert-level repair performance, our method markedly improves novices’ comprehension of error causes and repair justifications—bridging the gap between automation and pedagogical utility.
📝 Abstract
Program errors can occur in any type of programming, and can manifest in a variety of ways, such as unexpected output, crashes, or performance issues. And program error diagnosis can often be too abstract or technical for developers to understand, especially for beginners. The goal of this paper is to present a novel machine-learning approach for Multi-task Program Error Repair and Explanatory Diagnosis (mPRED). A pre-trained language model is used to encode the source code, and a downstream model is specifically designed to identify and repair errors. Programs and test cases will be augmented and optimized from several perspectives. Additionally, our approach incorporates a"chain of thoughts"method, which enables the models to produce intermediate reasoning explanations before providing the final correction. To aid in visualizing and analyzing the program structure, we use a graph neural network for program structure visualization. Overall, our approach offers a promising approach for repairing program errors across different programming languages and providing helpful explanations to programmers.