metadata
dataset_info:
features:
- name: project
dtype: string
- name: commit_id
dtype: string
- name: CVE ID
dtype: string
- name: CWE ID
dtype: string
- name: func
dtype: string
- name: vul
dtype: int8
splits:
- name: train
num_bytes: 299777443
num_examples: 239822
- name: test
num_bytes: 63350463
num_examples: 51390
- name: validation
num_bytes: 63678823
num_examples: 51392
download_size: 190857204
dataset_size: 426806729
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: test
path: data/test-*
- split: validation
path: data/validation-*
license: mit
task_categories:
- text-classification
- feature-extraction
tags:
- Code
- Vulnerability
Merged BigVul and PrimeVul Dataset
Dataset ID: mahdin70/merged_bigvul_primevul
This dataset is a merged and preprocessed combination of the BigVul (bstee615/bigvul
) and PrimeVul (colin/PrimeVul
, "default" configuration) datasets, designed for vulnerability analysis and machine learning tasks. The preprocessing ensures consistency in column names, data types, and formats, making it suitable for fine-tuning models.
Dataset Overview
The dataset integrates vulnerability data from two sources:
- BigVul: A dataset of real-world vulnerabilities from open-source C/C++ projects.
- PrimeVul: A vulnerability dataset with additional project-specific details.
- Paper: (https://doi.org/10.48550/arXiv.2403.18624)
- Repository:(https://github.com/DLVulDet/PrimeVul)
The merged dataset retains key information about projects, commits, functions, and vulnerabilities, standardized for consistency.
Columns
The dataset contains the following columns:
project
: String - The name of the project (e.g., "qemu", "linux-2.6").commit_id
: String - Unique identifier of the commit associated with the function.func
: String - The source code of the function before fixing (fromfunc_before
in BigVul).vul
: Int8 - Vulnerability label (1 = vulnerable, 0 = not vulnerable).CVE ID
: String - Common Vulnerabilities and Exposures identifier (e.g.,CVE-2007-1320
), orNOT_APPLICABLE
ifvul = 0
.CWE ID
: String - Common Weakness Enumeration identifier (e.g.,CWE-20
), orNOT_APPLICABLE
ifvul = 0
.
Splits
- Train: Combined training data from BigVul and PrimeVul.
- Test: Combined testing data from BigVul and PrimeVul.
- Validation: Combined validation data from BigVul and PrimeVul.
Preprocessing Steps
The dataset was preprocessed to ensure consistency and quality:
BigVul Preprocessing
- Source Columns:
project
,commit_id
,CVE ID
,CWE ID
,func_before
,vul
.
- Transformations:
- Renamed
func_before
tofunc
. - Kept
CWE ID
in its original format (CWE-XXX
). - Converted
vul
toint8
.
- Renamed
PrimeVul Preprocessing
- Source Columns:
project
,commit_id
,cve
,cwe
,func
,target
.
- Transformations:
- Renamed
cve
toCVE ID
,cwe
toCWE ID
,target
tovul
. - Standardized
CWE ID
by removing brackets from list format (e.g.,["CWE-XXX"]
→CWE-XXX
), taking the first element if multiple CWEs exist. - Converted
vul
fromint64
toint8
.
- Renamed
Merging and Final Preprocessing
- Merging: Concatenated preprocessed BigVul and PrimeVul data for each split (
train
,test
,validation
). - Final Steps:
- Removed rows with any null values.
- Removed duplicates based on the
func
column. - For rows where
vul = 0
, replacedCVE ID
andCWE ID
with"NOT_APPLICABLE
.
Dataset Statistics
Below are the analysis results for the final merged dataset:
Train Split
- Number of rows: 239,822
- Unique CWE IDs (excluding
NOT_APPLICABLE
): 127 - Unique commit IDs: 7,559
- Vulnerable functions (
vul = 1
): 9,037
Test Split
- Number of rows: 51,390
- Unique CWE IDs (excluding
NOT_APPLICABLE
): 87 - Unique commit IDs: 6,032
- Vulnerable functions (
vul = 1
): 1,911
Validation Split
- Number of rows: 51,392
- Unique CWE IDs (excluding
NOT_APPLICABLE
): 91 - Unique commit IDs: 6,059
- Vulnerable functions (
vul = 1
): 1,933
Usage
Loading the Dataset
from datasets import load_dataset
dataset = load_dataset("mahdin70/merged_bigvul_primevul")