HAG-SDP: A Hierarchical Attention-Based Graph Neural Network for Software Defect Prediction
Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
Software defect prediction remains a critical challenge in software engineering, as traditional approaches struggle to effectively capture complex code relationships and dependencies, leading to missed defects and inefficient resource allocation in quality assurance. This paper introduces HAG-SDP, a novel hierarchical attention-based graph neural network approach that addresses these challenges by representing source code as a multi-level graph structure. Our method uniquely combines syntactic and semantic relationships while employing attention mechanisms to identify defect-prone patterns, processing code at multiple granularity levels from individual statements to module-level interactions. We evaluate our approach on the JM1 dataset from the NASA Metrics Data Program, demonstrating superior performance with an accuracy of 87.3%, precision of 83.6%, and F1-score of 82.7%, significantly outperforming both traditional machine learning methods and recent deep learning approaches. The model's attention mechanism not only enhances prediction accuracy but also provides interpretable insights by highlighting potentially problematic code regions. Through comprehensive ablation studies, we demonstrate the significant contribution of each architectural component, particularly the hierarchical structure and attention mechanisms. Our results show robust performance across various defect types, offering practical insights for code review prioritization and testing resource allocation, ultimately contributing to more efficient software quality assurance processes.