CVEs / README.md
almersawi's picture
Upload README.md with huggingface_hub
018a57c verified
|
Raw History Blame Contribute Delete
8.09 kB
---
language:
- en
license: other
license_name: cve-list-terms-of-use-and-cc0
license_link: https://www.cve.org/Legal/TermsOfUse
task_categories:
- text-generation
- question-answering
tags:
- cybersecurity
- cve
- vulnerability
- security
- chat
- fine-tuning
size_categories:
- 1M<n<10M
source_datasets:
- CVEProject/cvelistV5
- fkie-cad/nvd-json-data-feeds
dataset_info:
features:
- name: messages
list:
- name: role
dtype: string
- name: content
dtype: string
- name: metadata
struct:
- name: source
dtype: string
- name: domain
dtype: string
- name: task_type
dtype: string
- name: n_turns
dtype: int64
- name: est_tokens
dtype: int64
- name: has_system
dtype: bool
- name: cve_id
dtype: string
- name: severity
dtype: string
- name: published
dtype: string
splits:
- name: train
num_examples: 1608514
num_bytes: 1385703113
- name: validation
num_examples: 16503
num_bytes: 14014544
configs:
- config_name: default
data_files:
- split: train
path: cve_train.jsonl
- split: validation
path: cve_validation.jsonl
---
# CVEs — a full-coverage CVE chat dataset
**1,625,017 chat conversations covering all 361,190 usable CVEs** (1999–2026), built for fine-tuning cybersecurity assistants. Every known CVE in the official [CVE List](https://github.com/CVEProject/cvelistV5) with severity enrichment from NVD (via the [fkie-cad community feeds](https://github.com/fkie-cad/nvd-json-data-feeds)), rendered as English user/assistant conversations with varied phrasings, honest handling of missing data, and a per-CVE 99/1 train/validation split with zero leakage.
The schema matches [`oi-uae/cyber-security`](https://huggingface.co/datasets/oi-uae/cyber-security) exactly (`messages` + `metadata` rows), so it can be concatenated with that dataset directly.
## Dataset summary
| Metric | Value |
|---|---|
| Total conversations | 1,625,017 |
| Train / validation | 1,608,514 / 16,503 (1.02%, split **by CVE** — no CVE appears in both) |
| Unique CVEs covered | 361,190 (every usable CVE, REJECTED/reserved placeholders excluded) |
| Severity-enriched from NVD | 168,961 records |
| Estimated tokens | ~206M (`est_tokens` = total characters ÷ 4) |
| Languages | English only |
| System prompts | 29.96% of conversations |
| Determinism | Fully reproducible: seeded per CVE ID (MD5-based) |
## Data analysis
![Conversations by task type](charts/task_distribution.png)
![Severity distribution](charts/severity_distribution.png)
![Conversations by CVE publication year](charts/rows_by_year.png)
![Cumulative CVE coverage](charts/cumulative_cves_by_year.png)
![Conversation size by task type](charts/tokens_by_task.png)
![Conversation depth](charts/conversation_rounds.png)
Average conversation size by task type (est. tokens): multi-turn 343 · JSON extraction 283 · full lookup 215 · mitigation 91 · references 83 · affected software 59 · severity 53 · CWE classification 45.
## Task types
Each CVE yields 1–6 conversations (typically 4–5), chosen deterministically from what the record supports:
| `task_type` | Conversations | What the model learns |
|---|---:|---|
| `cve_qa` | 361,190 | Full record lookup — "What is CVE-2021-44228?" |
| `cve_severity_qa` | 358,724 | CVSS score, severity label, vector |
| `cve_affected_qa` | 216,435 | Affected products and version ranges |
| `cve_mitigation_qa` | 216,261 | Documented fixes, workarounds, vendor advisories |
| `cve_references_qa` | 216,566 | Reference/advisory URLs |
| `cve_cwe_qa` | 75,584 | CWE weakness classification |
| `cve_extraction` | 108,006 | Record → clean structured JSON |
| `cve_multiturn` | 72,251 | 2–4 round follow-up conversations |
## Schema
Each row is one conversation:
```json
{
"messages": [
{"role": "system", "content": "You are a cybersecurity assistant..."},
{"role": "user", "content": "How severe is CVE-2021-44228?"},
{"role": "assistant", "content": "CVE-2021-44228 is rated CRITICAL severity..."}
],
"metadata": {
"source": "cvelistV5+nvd",
"domain": "vulnerability-intelligence",
"task_type": "cve_severity_qa",
"n_turns": 2,
"est_tokens": 321,
"has_system": true,
"cve_id": "CVE-2021-44228",
"severity": "CRITICAL",
"published": "2021-12-10"
}
}
```
- `messages`: optional `system` prompt first (~30% of rows), then strictly alternating `user`/`assistant` turns ending with `assistant`.
- `n_turns`: count of user+assistant messages (system excluded).
- `est_tokens`: rough token estimate (total content characters ÷ 4).
## Methodology
- **Sources**: CVE records from the official `CVEProject/cvelistV5` repository (100% coverage of published CVEs), enriched with CVSS severity from NVD data redistributed by `fkie-cad/nvd-json-data-feeds` (CC0). Where the CVE List record already carries metrics (CNA or ADP containers), the record's own values win; NVD fills gaps.
- **Grounding**: every assistant answer is template-generated **strictly from the published record** — no invented facts. Missing data is stated explicitly (e.g. "No CVSS score has been assigned to this CVE yet"). Mitigation answers only cite documented fixed versions, guidance sentences from the record description, or vendor advisories in the references.
- **Variety**: 8–10 user phrasings and 1–3 assistant response structures per task type, selected by a per-CVE seeded RNG, so the model does not overfit a single wording.
- **Determinism**: the same raw data always produces the identical dataset (MD5-seeded per CVE ID, stable across processes).
- **Filtering**: English-only descriptions; REJECTED and placeholder records excluded.
## Limitations
- **497 rows** carry `severity: "NONE"` — the honest CVSS label for a 0.0 base score, outside the CRITICAL/HIGH/MEDIUM/LOW/UNRATED set.
- Some affected-product strings render the record's literal `n/a` placeholder (e.g. `n/a/n/a`); this mirrors the source record faithfully.
- `est_tokens` is a character-based heuristic (÷4), not a tokenizer count.
- Answers reflect the CVE List at build time (September 2026); records are amended upstream over time.
- No exploit-availability (KEV/EPSS) or patch-status signals — only what the published CVE record contains.
## Uses
- Fine-tuning a CVE-aware cybersecurity assistant (lookup, triage, vulnerability-intelligence Q&A).
- Structured extraction training (natural language → record JSON).
- Evaluation on held-out CVEs (the validation split contains full conversations for ~3,600 unseen CVEs).
## Sources & licensing
- **CVE List v5** — © MITRE/the CVE Program, used under the [CVE Terms of Use](https://www.cve.org/Legal/TermsOfUse). All CVE data is attributable to the CVE Program and its CNAs.
- **NVD enrichment** — NIST NVD data (US government public domain) as redistributed by [fkie-cad/nvd-json-data-feeds](https://github.com/fkie-cad/nvd-json-data-feeds) under CC0.
## Merging with `oi-uae/cyber-security`
The schema is identical, so rows concatenate directly:
```python
from datasets import load_dataset, concatenate_datasets
mine = load_dataset("oi-uae/CVEs")
other = load_dataset("oi-uae/cyber-security", "full")
merged = concatenate_datasets([other["train"], mine["train"]])
```
## Maintenance
The dataset is fully reproducible. Rebuild with:
```bash
python3 scripts/download.py raw
python3 scripts/build_dataset.py --raw raw --out data --cleanup
```
Only per-year NVD feed files are consumed; the build aborts before writing if zero records parse, so a failed extraction can never overwrite a good dataset. Regenerate the charts with `python3 scripts/make_charts.py`.
## Acknowledgements
Thanks to the CVE Program, its CNAs, and NIST NVD for publishing the underlying vulnerability data, and to `oi-uae` for the parent `cyber-security` dataset whose schema this follows.