Abstract
Static Code Analyzers (SCAs) often overwhelm developers with "unactionable" warnings, creating a significant barrier to effective bug detection. This study presents the first systematic feasibility analysis of using Pre-trained Models (PTMs) to identify actionable warnings. By evaluating architectures like CodeBERT and CodeT5 against traditional deep learning baselines, we demonstrate that PTMs can improve identification performance by up to 21% in AUC. Our findings highlight the importance of semantic context and the limitations of traditional code abstraction in the era of large-scale pre-training.
Introduction
Static analysis is a cornerstone of modern software quality assurance, yet its utility is frequently hampered by high false-positive rates. Developers are often faced with a "wall of warnings," many of which are trivial or incorrect. While machine learning (ML) has been proposed to filter these warnings, the scarcity of labeled data remains a major bottleneck. This paper investigates whether Pre-trained Models (PTMs), which leverage vast amounts of unlabeled code during pre-training, can effectively bridge this gap and provide a robust filter for SCA noise.
Methodology
The researchers established a standardized workflow for PTM-based Actionable Warning Identification (AWI), encompassing data preprocessing, model training, and prediction phases.
Data Preprocessing and Model Selection
The study explored two critical aspects of preprocessing: warning context extraction (capturing the surrounding code) and code abstraction (replacing identifiers with generic tokens). Five representative PTM architectures were evaluated:
- Encoder-only: CodeBERT and GraphCodeBERT.
- Encoder-Decoder: CodeT5.
- Decoder-only: CodeGPT.
- Unified: UniXcoder.
These models were compared against standard Deep Learning (DL) baselines, specifically Convolutional Neural Networks (CNN) and Long Short-Term Memory (LSTM) networks.
Experimental Setup
The evaluation utilized a dataset of 10,140 distinct SpotBugs warnings collected from 10 large-scale open-source Java projects, such as Apache Commons codec, collections, and bcel. The dataset is highly imbalanced, containing only 474 actionable warnings against 9,666 unactionable ones, reflecting the real-world difficulty of identifying critical bugs amidst noise.
Results and Discussion
The experimental results confirm that PTMs significantly outperform traditional ML approaches.
Key Findings
- Architecture Performance: Encoder-only models, particularly CodeBERT, achieved the highest performance with an AUC of 70.77%. This aligns with the nature of AWI as a classification task, where encoders excel.
- The Role of Pre-training: Utilizing models pre-trained on code provided a performance boost of up to 8.27% compared to training the same architectures from scratch.
- Context vs. Abstraction: Contrary to traditional ML practices, "abstracting" code actually degraded PTM performance. PTMs rely on the semantic meaning of variable names learned during pre-training. Furthermore, extracting the entire method containing a warning proved more effective than focusing solely on the line of code where the warning was triggered.
- Cross-Project Generalization: A significant performance drop was observed in cross-project scenarios, suggesting that actionable patterns are often project-specific and difficult to generalize without further adaptation.
Conclusion
This feasibility study demonstrates that PTMs offer a substantial leap forward in identifying actionable static analysis warnings. While challenges remain—particularly regarding cross-project generalization and handling ambiguous code contexts—the integration of PTMs into the developer workflow could significantly reduce the manual effort required to manage SCA output. Future work should focus on refining warning contexts through program slicing and expanding labeled datasets to improve model robustness.
Summary updated