from Do Language Models Prefer Vulnerable Code? A Probabilistic Study of Insecure Code Preference @ICST 2026
A curated dataset of 2,493 paired vulnerable/secure C code samples from real-world vulnerability-fixing commits, covering 25 CWE (Common Weakness Enumeration) categories and 2,422 unique vulnerability identifiers.
DeltaSecommits provides paired code snapshots—the vulnerable version (pre-patch) and the secure version (post-patch) of the same file from a single commit. This structure eliminates confounds from stylistic variation between authors and projects, making it ideal for mechanistic analysis of how models encode security properties.
Each pair includes:
The dataset is drawn from authoritative sources:
Filtering pipeline (for quality assurance):
This resulted in the final dataset of 2,493 high-quality pairs from 278 publicly disclosed vulnerabilities.
The dataset spans 25 CWE categories across four major families:
Memory Safety (3 CWEs, 610 pairs)
Injection (2 CWEs, 471 pairs)
Resource Management (3 CWEs, 248 pairs)
Information Disclosure (1 CWE, 143 pairs)
And 16 additional CWEs with varying sample counts (minimum 20 pairs per type).
| Metric | Value |
|---|---|
| Total pairs | 2,493 |
| CWE categories | 25 |
| Unique vulnerabilities | 2,422 |
| Programming language | C |
| Mean tokens (vulnerable) | 230 |
| Mean tokens (secure) | 191 |
| Pairs where vulnerable > secure | 85% |
from datasets import load_dataset
# Load full dataset
ds = load_dataset("deltasecommits")
# Access a single example
example = ds["train"][0]
print(example["vulnerable_code"])
print(example["secure_code"])
print(example["cwe"])
Each example contains:
{
"vulnerable_code": str, # Pre-patch code with vulnerability
"secure_code": str, # Post-patch code with fix
"cwe": str, # CWE identifier (e.g., "CWE-119")
"severity": str, # CVE severity (if available)
"vulnerability_id": str, # Unique identifier
"source": str # Source (osv, nvd)
}
Security-focused ML research:
Mechanistic interpretability:
Code generation safety:
The core findings have been validated on two additional C vulnerability datasets:
Results consistently replicate across all three datasets.
For dataset issues, questions, or contributions:
DeltaSecommits is provided under the MIT License. Code samples are derived from publicly disclosed vulnerabilities in the OSV and NVD databases and are used in accordance with those databases' terms.
If you use this work in your research, please cite:
@inproceedings{melo2026vulnerable,
title = {Do Language Models Prefer Vulnerable Code? A Probabilistic Study of Insecure Code Preference},
author = {Melo, Rui and Reis, Sofia and Catarino, Andre and Abreu, Rui},
booktitle = {Proceedings of the IEEE International Conference on Software Testing, Verification and Validation (ICST)},
year = {2026},
publisher = {IEEE}
}
9 commits
from Do Language Models Prefer Vulnerable Code? A Probabilistic Study of Insecure Code Preference @ICST 2026
A curated dataset of 2,493 paired vulnerable/secure C code samples from real-world vulnerability-fixing commits, covering 25 CWE (Common Weakness Enumeration) categories and 2,422 unique vulnerability identifiers.
DeltaSecommits provides paired code snapshots—the vulnerable version (pre-patch) and the secure version (post-patch) of the same file from a single commit. This structure eliminates confounds from stylistic variation between authors and projects, making it ideal for mechanistic analysis of how models encode security properties.
Each pair includes:
The dataset is drawn from authoritative sources:
Filtering pipeline (for quality assurance):
This resulted in the final dataset of 2,493 high-quality pairs from 278 publicly disclosed vulnerabilities.
The dataset spans 25 CWE categories across four major families:
Memory Safety (3 CWEs, 610 pairs)
Injection (2 CWEs, 471 pairs)
Resource Management (3 CWEs, 248 pairs)
Information Disclosure (1 CWE, 143 pairs)
And 16 additional CWEs with varying sample counts (minimum 20 pairs per type).
| Metric | Value |
|---|---|
| Total pairs | 2,493 |
| CWE categories | 25 |
| Unique vulnerabilities | 2,422 |
| Programming language | C |
| Mean tokens (vulnerable) | 230 |
| Mean tokens (secure) | 191 |
| Pairs where vulnerable > secure | 85% |
from datasets import load_dataset
# Load full dataset
ds = load_dataset("deltasecommits")
# Access a single example
example = ds["train"][0]
print(example["vulnerable_code"])
print(example["secure_code"])
print(example["cwe"])
Each example contains:
{
"vulnerable_code": str, # Pre-patch code with vulnerability
"secure_code": str, # Post-patch code with fix
"cwe": str, # CWE identifier (e.g., "CWE-119")
"severity": str, # CVE severity (if available)
"vulnerability_id": str, # Unique identifier
"source": str # Source (osv, nvd)
}
Security-focused ML research:
Mechanistic interpretability:
Code generation safety:
The core findings have been validated on two additional C vulnerability datasets:
Results consistently replicate across all three datasets.
For dataset issues, questions, or contributions:
DeltaSecommits is provided under the MIT License. Code samples are derived from publicly disclosed vulnerabilities in the OSV and NVD databases and are used in accordance with those databases' terms.
If you use this work in your research, please cite:
@inproceedings{melo2026vulnerable,
title = {Do Language Models Prefer Vulnerable Code? A Probabilistic Study of Insecure Code Preference},
author = {Melo, Rui and Reis, Sofia and Catarino, Andre and Abreu, Rui},
booktitle = {Proceedings of the IEEE International Conference on Software Testing, Verification and Validation (ICST)},
year = {2026},
publisher = {IEEE}
}
9 commits