用注意力机制捕捉代码指标关联,提升跨项目老化缺陷预测准确率
ARFT-Transformer: Modeling Metric Dependencies for Cross-Project Aging-Related Bug Prediction
- 引入多头注意力建模指标间依赖关系,避免信息重复与误判
- 结合焦点损失缓解样本不均衡问题,平衡指标提升达29.54%
- 适用于长期运行系统的缺陷预警,适合软件质量团队使用
长期运行的软件系统常因老化相关缺陷(ARBs)出现故障。为在开发阶段提前识别风险,提出跨项目ARB预测。该任务面临两大挑战:源与目标项目间数据分布差异导致的领域适应问题,以及ARB易发与非易发样本间的严重类别不平衡。现有方法通常将输入指标视为独立,忽略其内在关联,且多采用交叉熵损失,难以区分样本分类难易。为此,本文提出ARFT-Transformer框架,基于Transformer结构引入指标级多头注意力机制以捕获指标间交互,并采用焦点损失函数有效应对类别不平衡。在三个大规模开源项目上的实验表明,该方法在单源和多源场景下均优于当前最优方法,平均在Balance指标上分别提升29.54%和19.92%。
原文摘要 · Abstract (English)
Software systems that run for long periods often suffer from software aging, which is typically caused by Aging-Related Bugs (ARBs). To mitigate the risk of ARBs early in the development phase, ARB prediction has been introduced into software aging research. However, due to the difficulty of collecting ARBs, within-project ARB prediction faces the challenge of data scarcity, leading to the proposal of cross-project ARB prediction. This task faces two major challenges: 1) domain adaptation issue caused by distribution difference between source and target projects; and 2) severe class imbalance between ARB-prone and ARB-free samples. Although various methods have been proposed for cross-project ARB prediction, existing approaches treat the input metrics independently and often neglect the rich inter-metric dependencies, which can lead to overlapping information and misjudgment of metric importance, potentially affecting the model's performance. Moreover, they typically use cross-entropy as the loss function during training, which cannot distinguish the difficulty of sample classification. To overcome these limitations, we propose ARFT-Transformer, a transformer-based cross-project ARB prediction framework that introduces a metric-level multi-head attention mechanism to capture metric interactions and incorporates Focal Loss function to effectively handle class imbalance. Experiments conducted on three large-scale open-source projects demonstrate that ARFT-Transformer on average outperforms state-of-the-art cross-project ARB prediction methods in both single-source and multi-source cases, achieving up to a 29.54% and 19.92% improvement in Balance metric.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。