Cybersecurity Instruction-Tuning Dataset
A large, cleaned, multi-domain cybersecurity chat dataset for LLM finetuning,
built from 198 distinct sources spanning offensive security, blue-team
operations, vulnerability intelligence, cloud/AWS security, malware analysis,
digital forensics, and more. Every record is normalized to the standard
messages chat format and deduplicated at both file and record level.
⚠️ Research use only. This dataset is provided exclusively for non-commercial research. Commercial use — including commercial use of models trained on it — is not permitted; see
LICENSE.
Quick start
from datasets import load_dataset
# recommended (domain-balanced) split
ds = load_dataset("oi-uae/cyber-security") # balanced config
ds = load_dataset("oi-uae/cyber-security", "full") # everything, 1.9M rows
{"messages": [
{"role": "system", "content": "..."},
{"role": "user", "content": "..."},
{"role": "assistant", "content": "..."}
],
"metadata": {"source": "cybersec_master.jsonl", "domain": "vulnerability-intelligence",
"task_type": "cve_qa", "n_turns": 4, "est_tokens": 321,
"has_system": false, "cve_id": "CVE-2023-5877",
"severity": "Critical", "published": "2024-01-01",
"doc": null, "language": null}}
Data files are Apache Parquet with a fixed schema; each row is one chat record.
The metadata object enables filtering and analysis
(ds.filter(...), ds.select(...)); trainers ignore it, or drop it with
ds.remove_columns(["metadata"]).
Metadata fields
| field | description |
|---|---|
source |
provenance file the record was built from |
domain |
topical domain (e.g. red-team, blue-team, cloud-security, vulnerability-intelligence) |
task_type |
training-signal type: cve_qa, causal_reasoning, community_qa, doc_qa, vuln_fix, classification, reference_qa, playbook_qa, scenario_qa, incident_qa, tutoring, instruction |
n_turns |
number of turns in the conversation |
est_tokens |
approximate token count (characters / 4) |
has_system |
whether a system prompt is present |
cve_id, severity, published |
CVE records only |
doc |
AWS documentation file (AWS records only) |
language |
programming language of the fixed file (ARVO records only) |
Splits
| config | train | validation | notes |
|---|---|---|---|
| balanced (default) | 302,034 | 3,050 | per-source caps applied; recommended for finetuning |
| full | 1,877,209 | 18,961 | everything that survived cleaning (~649M est. tokens) |
What's inside
| domain | sources include |
|---|---|
| Vulnerability intelligence | 1.8M multi-turn NVD CVE Q&A (cybersec_master), CVE instruction sets |
| Causal security reasoning | 100K "what-if" attack/defense scenarios (220426-CyberSec-Dataset) |
| Community Q&A | 15.7K ShareGPT cybersecurity conversations |
| Cloud security | 69K AWS documentation reading-comprehension pairs (743 PDFs) |
| Vulnerability fixing | 814 ARVO "find & fix" pairs from real OSS repos (C/C++/Python) |
| Blue team | incident-response playbooks, hardening guides, threat-hunting procedures |
| Threat intelligence | MITRE ATT&CK techniques, groups, tools, malware, RaaS, APT campaigns |
| Offensive security | red-team tooling, phishing/social-engineering, VAPT methodology, OSINT |
| Other | ransomware, forensics, container/K8s, IoT/Thread, blockchain/DeFi, compliance, news classification |
How the data was cleaned
Starting from a 95 GB folder with every file duplicated 2–3× and 12 different source schemas:
- File-level dedup — every file existed in a domain folder, a flat
assets/mirror, and explicit__dup1copies; content-hashed, one kept (35% of raw disk was redundant copies). - Schema normalization — Alpaca, ShareGPT,
messages, top-level system/user/assistant, nested blue-team playbooks and MITRE tables were all mapped to the single chat format above. - Text repair — literal
\nescape damage (text stored double-escaped, present in the 220426 file and mixed into the master file) was detected and repaired; broken surrogate pairs fixed. - Quality filters — non-empty turns, assistant ≥ 20 chars, conversation
≤ 60k chars, strict
system? (user/assistant)+role alternation. - Record-level dedup — 12% of records were exact duplicates.
- Domain balancing — the
balancedconfig caps dominant templated sources (CVE master 1.7M → 200k, 220426 → 60k, AWS chunks → 20k, ShareGPT → 15k) so one source cannot dominate gradient updates. - Deterministic split — seeded shuffle, 99/1 train/validation, verified zero overlap between splits.
Cleaning effect: 2,094,702 raw records → 1,896,170 clean records (54,076 unconvertible schema, 295 failed quality, 144,161 exact duplicates removed).
Data analysis highlights
The largest source is cybersec_master: one multi-turn conversation per CVE
from the NVD feed (severity, CVSS vector, CWE, affected products, references,
follow-up questions). Medium and High severity dominate.
78 GB of the raw folder were zipped ARVO repository snapshot pairs (vulnerable + fixed). These were streamed, diffed, and converted into 814 "review this vulnerable code" records — mostly C/C++ projects, with the vulnerable function in the user turn and the description + patch in the assistant turn.
Median conversation is ~300 tokens; p95 ≈ 1645; max ≈ 13949. ~2.4 turns per conversation on average, with a small share of multi-turn dialogues.
Data sources
This dataset aggregates and reprocesses material from the following upstream
origins. Record counts refer to the full config after cleaning.
| upstream source | material | records | notes |
|---|---|---|---|
| Vyber07/cyber-security (Apache-2.0) | the upstream aggregate this collection derives from: ~35 domain-organized instruction sets, red/blue-team scenarios, MITRE tables, ShareGPT-style conversations, the 220426 causal-reasoning set | bulk of the dataset | local folder was cleaned, deduplicated and re-normalized for this repo |
| NVD / NIST | every CVE feed record turned into a multi-turn Q&A (severity, CVSS vector, CWE, affected products, references) | 1.72 M | the cve_id, severity, published metadata fields come from here |
| MITRE ATT&CK | tactics, techniques, groups, tools and software reference tables | ~2.2 K | converted to question/answer reference records |
| ARVO — Atlas of Reproducible Vulnerabilities for Open-Source Software (OSS-Fuzz–derived) | 867 vulnerable/fixed open-source repo snapshot pairs (78 GB of tarballs) | 814 | streamed and diffed locally into "find & fix the vulnerability" records; mostly C/C++ projects |
| AWS documentation | 743 official PDFs (SageMaker, RDS, Control Tower, App2Container, …) | 53.5 K | excerpts converted to reading-comprehension QA; doc metadata field holds the source PDF |
| Security news outlets | labeled headlines from 564 outlets (The Register, TechRadar, BleepingComputer, …) | 3 K | used for threat-topic classification records |
| LLM-generated instruction sets | synthetic tutoring and domain instruction data (authored with LLM assistance, incl. a Claude-generated CS tutoring set) | ~2 K | manifests in the source mark these as synthetic educational content |
Reference knowledge bases cited by the source material include HackerOne and BugCrowd disclosure reports, the OWASP Testing Guide and OWASP LLM Top 10, PortSwigger Web Security Academy and Research, HackTheBox, TryHackMe, VulnHub, SANS, NIST publications, MITRE ATLAS/D3FEND, PTES and OSSTMM methodologies.
Training recommendations & best practices
1. Pick the right config for your compute
| setup | config | size | suggested epochs |
|---|---|---|---|
| QLoRA / LoRA, single 16–24 GB GPU, 7–8 B model | balanced |
302 k records / ~173 M tokens | 1–2 |
| Full-parameter SFT, multi-GPU, 7–70 B | full |
1.88 M records / ~650 M tokens | 1 |
| Domain-adaptive continued pretraining | full (streaming) |
same | 1+ with packing |
Start with balanced. The full config is dominated by 1.7 M templated CVE
Q&A records; more epochs on it mostly teach NVD boilerplate phrasing rather
than deeper security reasoning.
2. Preprocessing
- The
messagesfield is the standard chat format — apply your model's chat template directly (tokenizer.apply_chat_template(example["messages"]...)). - Mask the loss to assistant turns only (completion-only loss). Every
trainer supports this (
train_on_prompt=Falsein Axolotl,assistant_only_lossin LLaMA-Factory,SFTTrainerdoes it automatically formessagescolumns). - Sequence length: median conversation ≈ 300 tokens, p95 ≈ 1.6 k, p99 ≈
2.6 k, max ≈ 14.5 k.
max_seq_len=4096covers 99.6% of records; use 8192 to cover 99.9%. Enable sequence packing for throughput.
3. Build your own domain mix with metadata
Even the balanced split is 66% CVE Q&A by design. If your use case needs a
different emphasis, filter with the metadata before training:
from datasets import load_dataset
ds = load_dataset("oi-uae/cyber-security", split="train")
# example: defensive-focused mix, dropping the weakest signals
keep = {"cve_qa", "causal_reasoning", "community_qa", "playbook_qa",
"vuln_fix", "reference_qa", "scenario_qa", "incident_qa"}
mix = ds.filter(lambda r: r["metadata"]["task_type"] in keep)
mix = mix.shuffle(seed=42).select(range(100_000))
# example: only critical/high CVEs
crit = ds.filter(lambda r: r["metadata"]["severity"] in ("Critical", "High"))
Quality notes: doc_qa (AWS excerpts) and tutoring (general CS) are the
lowest-signal task types — reasonable first candidates for exclusion.
vuln_fix (real code patches) is high-signal but small (814 records); consider
upsampling it 2–3× in code-security mixes.
4. Hyperparameter starting points
| method | learning rate | schedule | notes |
|---|---|---|---|
| QLoRA 7–8 B | 1e-4 – 2e-4 | cosine, 3% warmup | rank 16–64, alpha = 2×rank, target all linear layers |
| LoRA | 1e-4 | cosine | same targets as above |
| Full SFT | 1e-5 – 2e-5 | cosine, 3% warmup | gradient checkpointing; watch for loss collapse to CVE template style |
| Continued pretraining | 5e-5 – 1e-5 | constant + decay | pack to 4096, include doc_qa |
Batch via gradient accumulation to an effective batch of 64–256 conversations.
5. Evaluation
- The
validationsplits are held out with zero train overlap (verified by content hash); usevalidationof the same config you train on. - Log loss per
task_type/domain(the metadata makes this a one-liner) — CVE loss will fall fast; watchplaybook_qaandincident_qafor real security-reasoning gains. - Add a held-out safety probe: the model will happily reproduce offensive content from this data; test refusal behavior on misuse prompts before any deployment.
6. Deployment safety
This corpus teaches exploit techniques, phishing tradecraft and malware analysis alongside defensive material. Fine-tuned models should ship behind a guardrail system prompt, output filtering, and access controls — and be evaluated for your threat model. Do not expose such a model as an open public assistant.
Provenance & licensing
⚠️ Research use only — commercial use is not permitted. This dataset is made available exclusively for academic research, personal study, and other non-commercial purposes. Using it — or models trained on it — in any commercial product, service, or business context is not allowed without prior written permission from the dataset maintainers. See the
LICENSEfile for the full terms.
This is an aggregate of community cybersecurity datasets (NVD/NIST CVE data, MITRE ATT&CK, ARVO, OWASP-derived material, AWS documentation excerpts, forum/ShareGPT conversations, and synthetically generated instruction sets). The aggregate is distributed for research use only; upstream sources retain their respective rights — AWS documentation excerpts and some reference material are © their respective owners.
Content warning
This dataset contains professional cybersecurity content including offensive-security material (red-team techniques, phishing scenarios, malware analysis, exploit descriptions). It is intended for defensive research, security training, and professional education. Use in compliance with your organization's policies and applicable law.
- Downloads last month
- -






