File size: 4,896 Bytes
9d2d9ea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

---
dataset_info:
  name: PrimeVul Dataset Splits
  description: >
    A dataset for vulnerability detection in C/C++ code, designed to train and evaluate code language models in realistic settings. This version provides pre-split training, validation, and testing sets from the PrimeVul project, featuring diverse real-world functions, accurate labels, and rich metadata.
  version: 0.1
  license: Not specified
  splits:
    - name: train
      description: >
        Training split containing ~7k vulnerable and ~229k benign C/C++ functions from real-world projects, used to train vulnerability detection models. Includes metadata like commit details, vulnerability info, and file-level context.
    - name: val
      description: >
        Validation split with a subset of vulnerable and benign C/C++ functions, used for model tuning and evaluation during development. Includes the same metadata as the training split.
    - name: test
      description: >
        Testing split with a distinct subset of vulnerable and benign C/C++ functions, used for final model evaluation. Includes paired samples to assess subtle vulnerability detection and metadata for in-depth analysis.
  citation: |
    @article{ding2024primevul,
      title={Vulnerability Detection with Code Language Models: How Far Are We?},
      author={Yangruibo Ding and Yanjun Fu and Omniyyah Ibrahim and Chawin Sitawarin and Xinyun Chen and Basel Alomair and David Wagner and Baishakhi Ray and Yizheng Chen},
      journal={arXiv preprint arXiv:2403.18624},
      year={2024}
    }
  homepage: https://github.com/DLVulDet/PrimeVul
  doi: Not specified in original source
---

### Dataset Card: PrimeVul Dataset Splits

#### Overview
PrimeVul is a dataset crafted for vulnerability detection in C/C++ code, aimed at training and evaluating code language models under realistic conditions. This dataset card describes the pre-split version (train, validation, and test) uploaded to Hugging Face, based on the PrimeVul-v0.1 release. It includes approximately 7,000 vulnerable functions and 229,000 benign functions from real-world projects, covering over 140 Common Weakness Enumerations (CWEs). The dataset emphasizes accurate labeling, minimal data contamination, and rich metadata for advanced analysis.

#### Dataset Content
The dataset comprises C/C++ functions with the following key attributes:
- **Function Code**: Source code of vulnerable and benign functions.
- **Labels**: Binary labels indicating vulnerability (1) or benign (0), derived using novel techniques for human-level accuracy.
- **Metadata**:
  - **Commit Metadata**: Project URL, commit URL, and commit message for vulnerability context.
  - **Vulnerability Metadata**: CVE description and NVD link for identified vulnerabilities.
  - **File-level Metadata**: File name, relative path, function location, and a copy of the full file for context.

The dataset is constructed from existing vulnerability detection datasets, reconstructed with improved labels and chronological splits to minimize contamination. In PrimeVul-v0.1, only samples with successfully retrieved metadata are included.

#### Splits
- **Train**: Contains the majority of the ~7k vulnerable and ~229k benign functions, used for training vulnerability detection models. This split includes diverse examples across 140+ CWEs, with full metadata for commit, vulnerability, and file-level details.
- **Validation**: A smaller subset of vulnerable and benign functions, used for hyperparameter tuning and intermediate evaluation. Mirrors the training split’s structure and metadata.
- **Test**: A distinct subset for final evaluation, featuring paired samples (vulnerable code and its patch) to test models’ ability to detect subtle vulnerabilities. Includes the same metadata as other splits, enabling detailed analysis.

#### Usage
This dataset is ideal for researchers and developers working on vulnerability detection with code language models. The pre-split format and rich metadata support customized training, evaluation, and in-depth vulnerability studies. The test split’s paired samples are particularly useful for assessing model sensitivity to subtle code changes.

#### Source
PrimeVul originates from a combination of existing vulnerability datasets, enhanced with accurate labels and metadata. For more details, refer to the original GitHub repository: [https://github.com/DLVulDet/PrimeVul](https://github.com/DLVulDet/PrimeVul).

#### Citation
If you use this dataset, please cite the original PrimeVul paper:

```bibtex
@article{ding2024primevul,
  title={Vulnerability Detection with Code Language Models: How Far Are We?},
  author={Yangruibo Ding and Yanjun Fu and Omniyyah Ibrahim and Chawin Sitawarin and Xinyun Chen and Basel Alomair and David Wagner and Baishakhi Ray and Yizheng Chen},
  journal={arXiv preprint arXiv:2403.18624},
  year={2024}
}
```