按时间演进重构漏洞数据集,验证模型是否真在学习。
Today's Cat Is Tomorrow's Dog: Accounting for Time-Based Changes in the Labels of ML Vulnerability Detection Approaches
- 用实际可用标签重构建数据集,模拟真实训练场景
- 5个模型在4个数据集上表现不稳定,多数未随时间提升
- 适合关注模型长期有效性的安全研究者
用于机器学习测试的漏洞数据集隐含回溯信息。实际部署时只能使用训练和测试时可获得的标签(如已知和假设的负样本)。随着漏洞在日历时间中被发现,标签会动态变化,过去性能未必反映未来表现。以往工作仅考虑全历史数据(如 DiverseVUl)或版本间差异(如 Jimenez et al. ESEC/FSE 2019),前者过于乐观,后者过于保守。本文提出一种方法,将数据集重构为一系列随时间演进的数据集,使训练与测试标签均反映当时可得知识。若模型真正学习,应随数据积累和稳定而性能提升,该趋势可通过 Mann-Kendall 检验验证。我们在 4 个时间数据集(BigVul 中 3 个项目 + Vuldeepecker 的 NVD)和 5 个模型(Code2Vec、CodeBERT、LineVul、ReGVD、Vuldeepecker)上验证该方法。结果表明,性能变化不一致,多数模型并未随时间提升,与‘越多历史信息越好’的直觉相悖。
原文摘要 · Abstract (English)
Vulnerability datasets used for ML testing implicitly contain retrospective information. When tested on the field, one can only use the labels available at the time of training and testing (e.g. seen and assumed negatives). As vulnerabilities are discovered across calendar time, labels change and past performance is not necessarily aligned with future performance. Past works only considered the slices of the whole history (e.g. DiverseVUl) or individual differences between releases (e.g. Jimenez et al. ESEC/FSE 2019). Such approaches are either too optimistic in training (e.g. the whole history) or too conservative (e.g. consecutive releases). We propose a method to restructure a dataset into a series of datasets in which both training and testing labels change to account for the knowledge available at the time. If the model is actually learning, it should improve its performance over time as more data becomes available and data becomes more stable, an effect that can be checked with the Mann-Kendall test. We validate our methodology for vulnerability detection with 4 time-based datasets (3 projects from BigVul dataset + Vuldeepecker's NVD) and 5 ML models (Code2Vec, CodeBERT, LineVul, ReGVD, and Vuldeepecker). In contrast to the intuitive expectation (more retrospective information, better performance), the trend results show that performance changes inconsistently across the years, showing that most models are not learning.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。