Skip to content

Traversal-Aware Structural Fusion of AST and CFG for Code Representation Learning in Software Fault and Code Smell Detection

2026 · IEEE Transactions on Reliability · Vol 75, pp. 2913-2927 · 0 citations · 35 references

Abstract

The effectiveness of machine learning and deep learning models in software engineering (SE) tasks, such as fault prediction and code smell detection, depends heavily on the quality of source code representation and feature extraction. Previous studies have primarily used abstract syntax trees (ASTs) for source code representation in SE tasks but often fail to capture crucial semantic and control-flow details. To overcome this, control-flow graphs (CFGs) and combined representations (AST+CFG) have been explored for richer code understanding. However, their tradeoffs and benefits on the prediction models for SE tasks remain largely unexplored. This study investigates the impact of different source code representation techniques, including AST, CFG, their combination (AST+CFG), and pretrained code models (CodeBERT and Code2Vec) in software fault prediction and code smell detection. In addition, we investigate different traversal methods, including root-to-leaf and leaf-to-leaf, for both AST and CFG and their combination (AST+CFG) to assess their effectiveness in capturing structural and semantic information for improving prediction model performance. The experimental analysis is performed using the seven projects in the PROMISE dataset for fault prediction and the Multilabel Code Quality dataset for code smell detection. We employ various machine learning techniques for prediction model building and different performance measures for a comprehensive evaluation. The results show that a combined AST+CFG representation outperforms individual representations (AST or CFG) by providing a more comprehensive view of structural and control-flow semantics. In addition, CodeBERT stands out in both domains, demonstrating its ability to capture deeper relationships in the code. However, pretrained models were found to be more computationally expensive.

View source

Similar papers

Open access 2026

A Text-Based Refactoring Dataset for Multi-Type Prediction Using Code Snippets and Software Metrics

Refactoring is a disciplined process of improving the internal structure of software without changing its external behavior. Empirical studies have shown that refactoring contributes to maintainability and code quality; however, existing machine learning approaches for refactoring prediction rely predominantly on struc...

Amal Alazba, Muna Alrazgan, Nada Al Jamaan et al. · 0 citations
Open access 2026

Fine-Tuning UniXcoder for Code Smell Detection in Java Projects

This study investigates the application of UniXcoder, a pre-trained transformer model for source code, to classify Java source code methods across multiple projects as smell or clean, with a particular focus on the Switch Statements smell, and confirms that pre-trained transformer models, particularly UniXcoder, are ca...

Hanson Prihantoro Putro, Umi Laili Yuhana, E. M. Yuniarno et al. · 0 citations
#software testing Open access Sep 2026

SeqRankFL: Sequence-Aware Ranking of LLM-Based Code Representations for Statement-Level Fault Localization

Software reliability is an important part of reliability assurance for complex engineering systems, and timely fault diagnosis supports safe and continuous operation. After a test failure, statement-level fault localization ranks source-code lines for early inspection. Representation-based approaches can operate withou...

D. An, Shi-Hai Wang, Bin Liu et al. · 0 citations
#small language model Preprint Sep 2026

Towards Behavior Tree-Guided Vulnerability Detection with Lightweight LLMs

Investigating Behavior Trees (BTs) as an alternative intermediate representation for LLM-based vulnerability detection suggests that BTs can provide a compact and useful structured representation for vulnerability detection with quantized, locally deployable LLMs.

Enna Bašić, A. Giaretta · 0 citations
#software testing Open access Oct 2026

Project-Scale Statement-Level Fault Localization via Multi-view Semantic Learning and Pairwise Reranking

FaultScape is a novel LLM-based framework for project-scale, statement-level FL that formulates FL as a multi-view semantic learning and reasoning problem and shows that combining multi-view fault semantics with contrastive, failure-guided reasoning substantially improves the effectiveness and robustness of statement-l...

Hong-Wei Yu, Xu Wang, Jian Zhang et al. · 0 citations
Open access Aug 2026

StructFix: a structure-aware reasoning framework for automated program repair with code property graphs

StructFix is proposed, a structure-aware APR framework that grounds masked patch generation in Code Property Graphs (CPGs), and explicitly coupling structural dependencies with masked generation improves repair effectiveness and enables transfer across datasets.

Mengtian Cui, Yang-Fan Liu, Zhibo Lu et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.