[Paper Review] Convolutional Neural Networks over Control Flow Graphs for Software Defect Prediction
This paper proposes a novel deep learning approach for software defect prediction by constructing Control Flow Graphs (CFGs) from compiled assembly code and applying multi-view, multi-layer Directed Graph Convolutional Neural Networks (DGCNNs) to automatically learn semantic features. The method significantly outperforms traditional feature-based and tree-based approaches, improving accuracy by up to 15.49% and AUC by up to 12.39% on real-world datasets.
Existing defects in software components is unavoidable and leads to not only a waste of time and money but also many serious consequences. To build predictive models, previous studies focus on manually extracting features or using tree representations of programs, and exploiting different machine learning algorithms. However, the performance of the models is not high since the existing features and tree structures often fail to capture the semantics of programs. To explore deeply programs' semantics, this paper proposes to leverage precise graphs representing program execution flows, and deep neural networks for automatically learning defect features. Firstly, control flow graphs are constructed from the assembly instructions obtained by compiling source code; we thereafter apply multi-view multi-layer directed graph-based convolutional neural networks (DGCNNs) to learn semantic features. The experiments on four real-world datasets show that our method significantly outperforms the baselines including several other deep learning approaches.
Motivation & Objective
- To address the limitation of existing software defect prediction methods that rely on manually designed metrics or ASTs, which often fail to capture deep program semantics.
- To explore whether control flow graphs (CFGs) derived from assembly code can better represent program execution semantics than ASTs or traditional metrics.
- To develop an end-to-end deep learning model that automatically learns defect-relevant features from CFGs using graph-based neural networks.
- To evaluate the proposed method on real-world datasets and compare its performance against state-of-the-art feature-based and tree-based approaches.
Proposed method
- Source code is compiled into assembly code, which is then used to construct precise Control Flow Graphs (CFGs) that represent the step-by-step execution flow of programs.
- Multi-view, multi-layer Directed Graph Convolutional Neural Networks (DGCNNs) are applied to the CFGs to learn hierarchical semantic features from graph-structured data.
- The DGCNN processes directed, labeled nodes and edges in CFGs, capturing structural and behavioral patterns relevant to defects through graph convolution operations.
- The model is trained end-to-end to classify source code as defective or non-defective based on learned CFG representations.
- The approach leverages the fact that assembly-level CFGs preserve low-level execution semantics and are less sensitive to syntactic reordering than ASTs.
- Performance is evaluated using standard metrics such as accuracy, AUC, and F1-score on four real-world software defect prediction datasets.
Experimental results
Research questions
- RQ1Can CFGs derived from assembly code better represent program semantics for defect prediction than traditional software metrics or ASTs?
- RQ2To what extent can DGCNNs effectively learn defect-relevant features from graph-structured CFGs compared to tree-structured ASTs?
- RQ3How does the proposed method perform in comparison to existing feature-based and tree-based deep learning approaches on real-world datasets?
- RQ4What types of code variations (e.g., structural reordering, statement replacement, library usage) affect the performance of the CFG-based model versus tree-based models?
Key findings
- The proposed DGCNN-based method on CFGs achieves a maximum improvement of 15.49% in accuracy over the best-performing feature-based baseline across four real-world datasets.
- The method improves AUC by up to 12.39% compared to tree-based deep learning approaches, demonstrating superior discrimination ability.
- Tree-based models like SibStCNN and TBCNN suffer from performance degradation as AST size increases, particularly on complex programs such as those in the SUMTRIAN dataset.
- The CFG-based approach is more robust to syntactic variations such as statement reordering and variable declaration placement, which significantly alter AST structures but have minimal impact on assembly-level CFGs.
- The model struggles with code involving external library functions (e.g., __gcd), as these are not included in the CFGs due to lack of source code, leading to misclassification in such cases.
- Despite limitations with library calls, the overall performance of the CFG-DGCNN model consistently outperforms both feature-based and tree-based baselines across all evaluation metrics.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.