[Paper Review] DiverseVul: A New Vulnerable Source Code Dataset for Deep Learning Based Vulnerability Detection
DiverseVul introduces a large, diverse C/C++ vulnerable source code dataset with 18,945 vulnerable functions across 150 CWEs, and analyzes 11 DL architectures across four families, highlighting data scale and code-specific pretraining as key factors for vulnerability detection performance.
We propose and release a new vulnerable source code dataset. We curate the dataset by crawling security issue websites, extracting vulnerability-fixing commits and source codes from the corresponding projects. Our new dataset contains 18,945 vulnerable functions spanning 150 CWEs and 330,492 non-vulnerable functions extracted from 7,514 commits. Our dataset covers 295 more projects than all previous datasets combined. Combining our new dataset with previous datasets, we present an analysis of the challenges and promising research directions of using deep learning for detecting software vulnerabilities. We study 11 model architectures belonging to 4 families. Our results show that deep learning is still not ready for vulnerability detection, due to high false positive rate, low F1 score, and difficulty of detecting hard CWEs. In particular, we demonstrate an important generalization challenge for the deployment of deep learning-based models. We show that increasing the volume of training data may not further improve the performance of deep learning models for vulnerability detection, but might be useful to improve the generalization ability to unseen projects. We also identify hopeful future research directions. We demonstrate that large language models (LLMs) are a promising research direction for ML-based vulnerability detection, outperforming Graph Neural Networks (GNNs) with code-structure features in our experiments. Moreover, developing source code specific pre-training objectives is a promising research direction to improve the vulnerability detection performance.
Motivation & Objective
- Create a large, diverse open dataset of vulnerable and non-vulnerable C/C++ functions from real-world projects and security issues.
- Benchmark a wide range of deep learning architectures on vulnerability detection using this dataset and prior datasets.
- Investigate how training data volume, model architecture, and pretraining tasks influence vulnerability detection performance.
- Assess label noise and generalization challenges, including performance on unseen projects.
- Identify promising directions to advance ML-based vulnerability detection with large language models and code-specific pretraining.
Proposed method
- Crawl security issue websites to obtain vulnerability reports and fixing commits.
- Extract vulnerable and non-vulnerable functions from cloned projects by labeling the before-commit version as vulnerable and after-commit as non-vulnerable.
- Deduplicate functions by MD5 while preserving project and CWE annotations when available.
- Evaluate 11 model architectures from 4 families, including GNNs and transformers/LLMs, on three data setups (CVEFixes, Previous, Previous+DiverseVul).
- Inspect label noise via manual sampling to estimate label accuracy (~60% for DiverseVul).
- Compare model performance with and without DiverseVul to study data scale effects on F1, TP rate, and FP rate.

Experimental results
Research questions
- RQ1How does increasing training data (via DiverseVul and other datasets) impact vulnerability detection performance across model families?
- RQ2Are large language models superior to graph-based models when trained on large, diverse vulnerability datasets?
- RQ3What pretraining objectives best improve vulnerability detection for code?
- RQ4How well do models generalize to unseen projects, and what techniques mitigate generalization gaps?
- RQ5What is the extent and impact of label noise in vulnerability datasets and how does it affect model evaluation?
Key findings
- DiverseVul adds 18,945 vulnerable and 330,492 non-vulnerable functions from 7,514 commits across 150 CWEs, spanning 797 projects.
- On CVEFixes alone, architecture differences are small, but with larger datasets, LLMs outperform GNNs significantly.
- Best F1 score on the combined Previous+DiverseVul test set is 47.2%, with 43.3% true positive rate and 3.5% false positive rate.
- LLMs pretrained on code-specific tasks (e.g., CodeT5 Small/Base, NatGen) yield the strongest performance gains over GNNs.
- Performance on unseen projects drops markedly (e.g., F1 from 49% on seen projects to 9.4% on unseen projects), highlighting generalization challenges.
- Label accuracy of vulnerability labels via commit-based signaling is ~60% for DiverseVul, indicating notable label noise across datasets.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.