VulnBridge / README.md
AnnyNguyen's picture
Upload README.md
a3d77be verified
|
Raw
History Blame Contribute Delete
7.85 kB
---
pretty_name: VulnBridge
license: other
task_categories:
- text-classification
language:
- code
tags:
- software-security
- vulnerability-detection
- cwe-classification
- source-code
- benchmark
- c
- cpp
size_categories:
- 100K<n<1M
configs:
- config_name: top10
data_files:
- split: train
path: top10/top10_train.jsonl
- split: validation
path: top10/top10_val.jsonl
- split: test
path: top10/top10_test.jsonl
- config_name: top20
data_files:
- split: train
path: top20/top20_train.jsonl
- split: validation
path: top20/top20_val.jsonl
- split: test
path: top20/top20_test.jsonl
- config_name: top50
data_files:
- split: train
path: top50/top50_train.jsonl
- split: validation
path: top50/top50_val.jsonl
- split: test
path: top50/top50_test.jsonl
- config_name: full
data_files:
- split: train
path: full/full_train.jsonl
- split: validation
path: full/full_val.jsonl
- split: test
path: full/full_test.jsonl
---
# VulnBridge
VulnBridge is a unified function-level benchmark for software vulnerability
detection and CWE classification. It integrates seven public C/C++ vulnerability
datasets under a common schema, applies function-level deduplication, normalizes
binary and CWE labels, derives frequency-based Top-K CWE variants, and provides
fixed stratified train/validation/test splits.
The benchmark is designed for two tasks:
- Binary vulnerability detection: predict whether a function is vulnerable.
- CWE classification: predict the CWE weakness category for CWE-annotated
vulnerable functions.
## Dataset Summary
After unification and deduplication, VulnBridge contains 744,650 functions,
52,936 vulnerable functions, 333 CWE types, and 7,749 CVEs. The public modeling
variants are:
| Variant | Train | Validation | Test | Total | #CWE | Vulnerable % | Head coverage % | Shrink vs Full % |
|---|---:|---:|---:|---:|---:|---:|---:|---:|
| Top-10 | 36,088 | 4,511 | 4,511 | 45,110 | 10 | 39.6 | 60.5 | 20.0 |
| Top-20 | 40,468 | 5,058 | 5,059 | 50,585 | 20 | 46.1 | 79.5 | 10.3 |
| Top-50 | 43,740 | 5,467 | 5,468 | 54,675 | 50 | 50.2 | 93.9 | 3.0 |
| Full | 45,100 | 5,638 | 5,638 | 56,376 | 174 | 51.7 | N/A | 0.0 |
## Repository Files
The Hugging Face repository uses one directory per VulnBridge variant:
| Variant | Train | Validation | Test | CWE mapping |
|---|---|---|---|---|
| Top-10 | `top10/top10_train.jsonl` | `top10/top10_val.jsonl` | `top10/top10_test.jsonl` | `top10/top10_mapping` |
| Top-20 | `top20/top20_train.jsonl` | `top20/top20_val.jsonl` | `top20/top20_test.jsonl` | `top20/top20_mapping` |
| Top-50 | `top50/top50_train.jsonl` | `top50/top50_val.jsonl` | `top50/top50_test.jsonl` | `top50/top50_mapping` |
| Full | `full/full_train.jsonl` | `full/full_val.jsonl` | `full/full_test.jsonl` | `full/full_mapping` |
## Source Datasets
VulnBridge is constructed from the following public function-level vulnerability
sources:
| Dataset | Year | Functions | Vulnerable | Vulnerable % | Vulnerable with CWE | #CWE | #CVE | Language |
|---|---:|---:|---:|---:|---:|---:|---:|---|
| Devign | 2019 | 26,037 | 11,888 | 45.7 | N/A | N/A | N/A | C/C++ |
| ReVeal | 2020 | 18,169 | 1,664 | 9.2 | N/A | N/A | N/A | C/C++ |
| CrossVul | 2023 | 134,126 | 6,884 | 5.1 | 6,833 | 107 | 224 | C/C++ |
| CVEfixes | 2022 | 168,089 | 8,932 | 5.3 | 8,343 | 121 | 104 | C/C++ |
| BigVul | 2020 | 264,919 | 11,823 | 4.5 | 8,783 | 91 | 181 | C/C++ |
| MegaVul | 2024 | 353,873 | 11,557 | 3.3 | 11,556 | 312 | 5,620 | C/C++ |
| DiverseVul | 2023 | 523,956 | 41,377 | 7.9 | 22,382 | 155 | 2,336 | C/C++ |
| VulnBridge | 2026 | 744,650 | 52,936 | 7.1 | 28,188 | 333 | 7,749 | C/C++ |
## Data Format
Each split is distributed as JSON Lines using the folder and file names listed above. A typical record has the following
fields:
```json
{
"id": "top20_train_000001",
"func": "int example(...) { ... }",
"label_bin": 1,
"CWE": ["CWE-787"],
"CWE_multiclass": "CWE-787",
"label_cwe_multiclass": 0,
"source": "BigVul",
"cve": "CVE-XXXX-YYYY"
}
```
Recommended fields:
| Field | Type | Description |
|---|---|---|
| `id` | string | Stable sample identifier. |
| `func` | string | Function-level C/C++ source code. |
| `label_bin` | integer | Binary vulnerability label: `1` vulnerable, `0` non-vulnerable. |
| `CWE` | list[string] or null | Original normalized CWE label(s), when available. |
| `CWE_multiclass` | string or null | Selected single CWE class for multiclass classification. |
| `label_cwe_multiclass` | integer | Integer class id for CWE classification; use `-1` when unavailable or ignored. |
| `source` | string | Original source dataset name. |
| `cve` | string or null | CVE identifier when available. |
For CWE classification, samples with `label_cwe_multiclass = -1` should be
ignored in the CWE loss and CWE metrics, while they may still be used for binary
vulnerability detection.
## Loading the Dataset
The dataset repository is `AnnyNguyen/VulnBridge`.
```python
from datasets import load_dataset
dataset = load_dataset("AnnyNguyen/VulnBridge", "top20")
train = dataset["train"]
valid = dataset["validation"]
test = dataset["test"]
print(train[0].keys())
```
To load a different CWE coverage variant:
```python
top10 = load_dataset("AnnyNguyen/VulnBridge", "top10")
top50 = load_dataset("AnnyNguyen/VulnBridge", "top50")
full = load_dataset("AnnyNguyen/VulnBridge", "full")
```
## Intended Use
VulnBridge is intended for research on:
- Function-level software vulnerability detection.
- CWE weakness classification.
- Benchmarking pre-trained code encoders and source-code classifiers.
- Studying class imbalance, label normalization, deduplication, and long-tail CWE
behavior under fixed evaluation splits.
The dataset is not a production vulnerability scanner and should not be used as
the sole basis for security decisions.
## Construction Pipeline
VulnBridge is built through the following stages:
1. Source merging into a common function-level record format.
2. Function-level deduplication before splitting to reduce cross-split leakage.
3. Binary vulnerability label normalization.
4. CWE label normalization into a shared schema.
5. Frequency-based Top-K CWE variant construction.
6. Fixed stratified 80/10/10 train/validation/test splitting.
Unresolved or inconsistent CWE labels are excluded from CWE training and
evaluation but retain their binary vulnerability labels.
## Limitations
- The benchmark currently covers C/C++ functions only.
- CWE labels are inherited from public vulnerability datasets and may contain
residual source-label noise.
- Function-level deduplication reduces but cannot fully eliminate all semantic
overlap or labeling inconsistencies.
- CWE labels are long-tailed; macro-averaged metrics should be reported
alongside accuracy.
## Ethical and Security Considerations
The dataset contains source code associated with software vulnerabilities. It is
released for defensive research, benchmarking, and reproducibility. Users should
respect the licenses and terms of the upstream datasets and avoid using the data
to facilitate harmful exploitation.
## Citation
If you use VulnBridge, please cite:
```bibtex
@inproceedings{nguyen2026vulnbridge,
title = {VulnBridge: A Unified Function-Level Benchmark for Vulnerability Detection and CWE Classification},
author = {Nguyen, Anh Thi-Hoang and Nguyen, Dung Ha and Cam, Nguyen Tan},
booktitle = {Proceedings of ISWTA 2026},
year = {2026}
}
```
## License
This benchmark is derived from multiple public datasets. Before public release,
please verify redistribution rights and license compatibility for every upstream
source. If in doubt, publish only normalized metadata, splits, and scripts, and
provide instructions for users to reconstruct the dataset from the upstream
sources.