arXiv:2602.12038cs.SEcs.AI2026-02中稿 · the 28th European …被引 7

研究代码漏洞检测中样本不平衡问题及其影响

An Empirical Study of the Imbalance Issue in Software Vulnerability Detection

  • 通过九个数据集验证漏洞样本稀少是性能波动主因
  • 焦点损失提升精确率,类平衡损失增强召回率
  • 不同优化方法效果各异,无通用最优解

漏洞检测对保障软件安全至关重要。当前深度学习(DL)是自动化检测的主流技术,能从海量代码中提取模式与表征。然而其性能在不同数据集间波动明显。受计算机视觉等领域启发,我们推测样本不平衡(漏洞代码数量极少)是核心原因。为此,我们在九个开源数据集上,结合两种先进深度学习模型进行了全面实证研究。结果证实该猜想,并发现现有不平衡处理方案表现不一:1)焦点损失更利于提升精确率;2)均值误报误差和类平衡损失有助于提高召回率;3)随机过采样可优化F1分数。但无一种方法在所有指标上均占优。进一步分析外部因素影响,为新方法设计提供依据。

原文摘要 · Abstract (English)

Vulnerability detection is crucial to protect software security. Nowadays, deep learning (DL) is the most promising technique to automate this detection task, leveraging its superior ability to extract patterns and representations within extensive code volumes. Despite its promise, DL-based vulnerability detection remains in its early stages, with model performance exhibiting variability across datasets. Drawing insights from other well-explored application areas like computer vision, we conjecture that the imbalance issue (the number of vulnerable code is extremely small) is at the core of the phenomenon. To validate this, we conduct a comprehensive empirical study involving nine open-source datasets and two state-of-the-art DL models. The results confirm our conjecture. We also obtain insightful findings on how existing imbalance solutions perform in vulnerability detection. It turns out that these solutions perform differently as well across datasets and evaluation metrics. Specifically: 1) Focal loss is more suitable to improve the precision, 2) mean false error and class-balanced loss encourages the recall, and 3) random over-sampling facilitates the F1-measure. However, none of them excels across all metrics. To delve deeper, we explore external influences on these solutions and offer insights for developing new solutions.

漏洞检测深度学习不平衡数据F1分数

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。