Datasets:
Download build_scripts/make_cards.py from VertexAGI-Archives/cyberdata-2-medium: direct link, hf CLI and curl.
- Browser
- Download file 13.2 kB
-
https://huggingface.co/datasets/VertexAGI-Archives/cyberdata-2-medium/resolve/main/build_scripts/make_cards.py
- Command line
-
hf download hf://datasets/VertexAGI-Archives/cyberdata-2-medium/build_scripts/make_cards.py
-
curl -L -o make_cards.py https://huggingface.co/datasets/VertexAGI-Archives/cyberdata-2-medium/resolve/main/build_scripts/make_cards.py
13.2 kB
| #!/usr/bin/env python3 | |
| """Write README.md for each CyberData 2 tier from its stats.json (every number computed, none typed by hand).""" | |
| import json, os | |
| HERE = os.path.dirname(os.path.abspath(__file__)); OUT = os.path.join(HERE, "out") | |
| TIERS = ["small", "medium", "large", "full"]; NAME = {t: f"CyberData 2 {t.capitalize()}" for t in TIERS}; REPO = {t: f"VertexAGI/cyberdata-2-{t}" for t in TIERS} | |
| ST = {t: json.load(open(os.path.join(OUT, f"cyberdata-2-{t}", "stats.json"))) for t in TIERS} | |
| GOALS = [("Writing secure code and detection rules (fix, rewrite, write-a-rule)", {"sigma_write", "detection_rule_write", "secure_code_fix", "code_fix", "cwe_code_fix"}), | |
| ("Finding vulnerabilities (code review, weakness identification)", {"code_review_vulnerable", "code_review_patched", "cwe_code_weakness"}), | |
| ("Cyber reasoning (step-by-step vulnerability analysis with a verdict)", {"reasoning_vulnerability_detection"}), | |
| ("Agentic coding and tool use (security and software-engineering agents)", {"agent_security", "agent_swe", "agent_appsec_step"})] | |
| SRC = [ | |
| ("mitre/cwe", "MITRE CWE", "authoritative-structured", "MITRE CWE terms of use (royalty-free; keep the MITRE copyright notice)", "Weakness definitions, mitigations, detection methods, and the entries' own bad/good code examples"), | |
| ("mitre/capec", "MITRE CAPEC", "authoritative-structured", "MITRE CAPEC terms of use (royalty-free; keep the MITRE copyright notice)", "Attack-pattern descriptions, prerequisites, consequences, mitigations"), | |
| ("mitre/attack", "MITRE ATT&CK (enterprise)", "authoritative-structured", "MITRE ATT&CK terms of use (royalty-free; keep the MITRE copyright notice)", "Techniques, mitigations, detection analytics, groups, software, campaigns"), | |
| ("sigmahq/sigma", "SigmaHQ detection rules", "authoritative-structured", "Detection Rule License 1.1 (attribution to the rule authors, kept inside each rule)", "Real rules: write a rule from a description, explain a rule"), | |
| ("cisa/kev", "CISA Known Exploited Vulnerabilities", "authoritative-structured", "US-government work, public domain", "Exploited-in-the-wild status and required action per CVE"), | |
| ("primevul", "PrimeVul (paired vulnerable/fixed C/C++ functions)", "authoritative-structured", "MIT (train + valid pairs only; the test pairs are never used)", "Review a vulnerable function, review its patched version, fix it"), | |
| ("hitoshura25/cvefixes", "CVEfixes (real CVE fix commits, many languages)", "authoritative-structured", "Apache-2.0 per the Hub listing (the original CVEfixes release is CC BY 4.0)", "The same three code tasks across PHP/Python/JavaScript/Java/Go/Ruby/C/C++ and others"), | |
| ("Leopo1d/OpenVul-rejection-sampling", "OpenVul rejection-sampling vulnerability reasoning (Leopo1d)", "reasoning-verified", "Apache-2.0 (reasoning distilled from DeepSeek-R1-0528 by the dataset's authors)", "Step-by-step reasoning about whether C/C++ code is vulnerable, kept only when the verdict matched the label; vulnerable and patched versions in pairs"), | |
| ("mrmoor/cyber-threat-intelligence", "Annotated threat-report corpus", "human-annotated", "CC-BY-4.0 per the Hub tag (the dataset card has no text)", "Entity extraction and relationship listing from real threat-report excerpts"), | |
| ("reloading0101/threat-intelligence-dataset", "CTI instruction dataset (reloading0101)", "grounded-third-party", "CC-BY-4.0", "CVE/ATT&CK/KEV/Sigma-grounded threat-intelligence instructions and follow-ups; its authors state every claim is checked against the source"), | |
| ("nuhmanpk/cybersecurity-controls-instructions", "NIST SP excerpt instructions (nuhmanpk)", "nist-excerpt", "CC-BY-4.0 (source documents are NIST publications)", "Answers grounded in excerpts of NIST SP 800-series documents"), | |
| ("Humanlearning/CyberSecurity_OWASP-sft-dataset", "OWASP defensive repair trajectories (Humanlearning)", "verified-executed", "Apache-2.0", "Agent steps from episodes that were executed and reward-verified in a local environment (successful episodes only, no anti-cheat flags)"), | |
| ("Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset", "Trendyol cybersecurity instructions", "third-party-synthetic", "Apache-2.0", "AI-written defensive Q&A, filtered (see below)"), | |
| ("AlicanKiraz0/Cybersecurity-Dataset-Fenrir-v2.1", "Fenrir v2.1", "third-party-synthetic", "Apache-2.0", "AI-written defensive Q&A, filtered, de-duplicated against Trendyol"), | |
| ("CyberNative/Code_Vulnerability_Security_DPO", "CyberNative code vulnerability pairs", "third-party-synthetic", "Apache-2.0", "Review vulnerable code and write the safer version"), | |
| ("jcordon5/cybersecurity-rules", "YARA / Suricata rules Q&A", "third-party-synthetic", "Apache-2.0", "Write a YARA or Suricata rule"), | |
| ("agentforge", "0xKitkat/AgentForge-1152 (security split)", "agent-trajectories", "Apache-2.0", "Defensive security-agent trajectories with tool use"), | |
| ("swe-hero", "nvidia/SWE-Hero-openhands-trajectories", "agent-trajectories", "CC-BY-4.0", "Software-engineering agent trajectories (OpenHands), length-capped at 120,000 characters"), | |
| ("openswe", "nvidia/Open-SWE-Traces (resolved runs only)", "agent-trajectories", "CC-BY-4.0", "Coding-agent trajectories whose patch was verified to fix the task (OpenHands / SWE-agent / mini-swe-agent), length-capped at 120,000 characters"), | |
| ] | |
| PROVDESC = {"authoritative-structured": "real records (MITRE entries, Sigma rules, KEV entries, real CVE-fix code) turned into chat rows by fixed templates; every fact is copied or composed from a field of the record", | |
| "reasoning-verified": "reasoning traces written by DeepSeek-R1-0528 for the OpenVul authors and kept only when the final verdict matched the ground-truth label", | |
| "human-annotated": "expert-annotated threat-report text turned into extraction tasks by a template", | |
| "verified-executed": "agent steps whose episodes were executed against a local environment and passed a deterministic reward check", | |
| "grounded-third-party": "instruction sets written by their authors from real sources, who state their claims are checked against the source", | |
| "nist-excerpt": "answers grounded in excerpts of NIST publications", | |
| "third-party-synthetic": "AI-written Q&A by the dataset authors; the least reliable rows, so they are FILTERED: any row citing a CWE id that does not exist, or naming a CWE or ATT&CK technique with a name that does not match MITRE's data, is dropped (on 3,000-row samples roughly 15-19% of rows that cite ids had a nonexistent or mismatched one), as are refusals and duplicate questions", | |
| "agent-trajectories": "security-agent and software-engineering agent trajectories"} | |
| fam = "| Size | Repo | Examples | Train | Valid |\n|---|---|---:|---:|---:|\n" + "\n".join(f"| {t.capitalize()} | [{REPO[t]}](https://huggingface.co/datasets/{REPO[t]}) | {ST[t]['rows']:,} | {ST[t]['train']:,} | {ST[t]['valid']:,} |" for t in TIERS) | |
| for t in TIERS: | |
| st = ST[t]; n = st["rows"]; bt = st["by_task"]; used = 0; grows = [] | |
| for g, ts in GOALS: | |
| c = sum(bt.get(x, 0) for x in ts); used += c; grows.append(f"| {g} | {c:,} | {100*c/n:.1f}% |") | |
| grows.append(f"| Security knowledge, Q&A and threat intelligence (supporting material) | {n-used:,} | {100*(n-used)/n:.1f}% |") | |
| prov = "\n".join(f"| `{k}` | {v:,} | {100*v/n:.1f}% | {PROVDESC.get(k, '')} |" for k, v in sorted(st["by_provenance"].items(), key=lambda x: -x[1])) | |
| src = "\n".join(f"| {d} | {st['by_source'].get(k, 0):,} | {100*st['by_source'].get(k, 0)/n:.1f}% | `{p}` | {lic} | {w} |" for k, d, p, lic, w in SRC if st["by_source"].get(k, 0)) | |
| how = ("This is the **everything** release: every row from every source that passed our filters." if t == "full" else | |
| f"{NAME[t]} is a **nested subset** of the larger sizes: each source contributes a fixed share (capped at what exists), always the first rows of a fixed order, so Small is inside Medium, Medium inside Large and Large inside Full, and every row keeps the same train/valid split in every size. Shares are set by goal (agentic coding about 29%, writing code and finding vulnerabilities about 37%, reasoning about 9%, supporting knowledge about 21%), not by how much of each source exists.") | |
| card = f"""--- | |
| license: other | |
| license_name: mixed-see-attribution | |
| language: | |
| - en | |
| - code | |
| task_categories: | |
| - text-generation | |
| - question-answering | |
| tags: | |
| - cybersecurity | |
| - security | |
| - vulnerability-detection | |
| - secure-code | |
| - agentic-coding | |
| - reasoning | |
| - mitre-attack | |
| - cwe | |
| - sigma | |
| size_categories: | |
| - {'100K<n<1M' if n >= 100000 else '10K<n<100K'} | |
| pretty_name: {NAME[t]} | |
| vertex_family: cyberdata | |
| vertex_params: "N/A (dataset)" | |
| vertex_purpose: "Fine-tuning for secure code, vulnerability finding, cyber reasoning and agentic coding" | |
| vertex_result: "{n:,} examples from existing public datasets only; provenance tagged per row" | |
| vertex_status: preview | |
| vertex_name: "{NAME[t]}" | |
| --- | |
| <div align="center"> | |
| # {NAME[t]} | |
| **{n:,} chat examples for fine-tuning a model to write secure code, find vulnerabilities, reason about them, and work as a coding agent. Assembled entirely from existing public datasets; no model was run to write any of it.** | |
| </div> | |
| --- | |
| ## The CyberData 2 family | |
| {fam} | |
| {how} | |
| ## What this size teaches | |
| | Goal | Rows | Share | | |
| |---|---:|---:| | |
| {chr(10).join(grows)} | |
| ## Where every row comes from (`provenance`) | |
| Each row has a provenance tag in `row_index.csv`, so you can train on a stricter subset (for example, drop `third-party-synthetic`). | |
| | provenance | rows | share | what it means | | |
| |---|---:|---:|---| | |
| {prov} | |
| ## Sources | |
| | Source | Rows | % | Provenance | License / terms | What it contributes | | |
| |---|---:|---:|---|---|---| | |
| {src} | |
| ### Considered and left out | |
| - `trendmicro-ailab/Primus-Reasoning` and `Primus-Instruct`: gated (access request required). | |
| - `rmems/incident-response-oncall-trajectories`: tagged Apache-2.0, but its own rights note says it is *not training data for any model-weight update*. | |
| - `netgoat-ai/Koda-IDS-CyberReasoning`: inspected and rejected. After quality filtering only templated scenarios for one vendor's tool API remained. | |
| - `ayshajavd/code-security-vulnerability-dataset`: mostly a repackaging of BigVul (no clear license), PrimeVul-derived samples and CyberNative, so it added little that was new. | |
| - Benchmark sets (CyberMetric, MMLU computer security, CTI-Bench): kept out so they stay usable for evaluation; a scan found none of their questions verbatim here. | |
| ## Splits and checks | |
| `train.jsonl` has {st['train']:,} rows and `valid.jsonl` has {st['valid']:,}. Rows derived from the same object (a CWE entry, a Sigma rule, a code-fix pair, an agent episode, a vulnerable/patched reasoning pair, a document chunk) always share one split. Checks run before release (`build_scripts/verify_sizes.py`): exact row counts; unique ids; strict nesting between sizes; the same split for every row in every size; every line parses with valid roles and an assistant last turn; no row mentions any of the 916 CVEs we hold out for a CVE-recall evaluation; no verbatim CyberMetric / MMLU-security question appears. | |
| ## Format | |
| Each line is `{{"messages": [...]}}`, standard chat SFT format. Agent rows carry `tool_calls`; reasoning rows keep the source's `<think>...</think>` block followed by the final answer. `row_index.csv` has `id, source, task, provenance, split, group` per row. | |
| ```python | |
| from datasets import load_dataset | |
| ds = load_dataset("{REPO[t]}") | |
| print(ds["train"][0]["messages"]) | |
| ``` | |
| ## Limitations | |
| - **Vulnerability finding is supply-limited.** The real vulnerable-and-fixed code comes from PrimeVul, CVEfixes and the OpenVul reasoning set; there is no more openly licensed labeled data we trusted. Vulnerability detection is a hard task: training on these labels does not by itself guarantee good detection. | |
| - **Reasoning covers one task.** The only verified reasoning set we found is vulnerability detection in C/C++. There is no verified reasoning data here for incident response or threat analysis. | |
| - **Agent trajectories are length-capped** at 120,000 characters (about 30k tokens), so the longest runs are absent. | |
| - Templated rows teach the answer format and the content of the records as written; they are not a verified knowledge base. In our tests none of the 8B base models we tried could recall facts about CVEs they had not seen, so for CVE-specific facts use lookup, not memory. | |
| - PrimeVul and CVEfixes CWE labels come from NVD and are sometimes loose. The `third-party-synthetic` and `grounded-third-party` rows can still contain errors beyond the ids we can check. | |
| ## Licensing and attribution | |
| A mixture of independently licensed sources (see the table). Required attribution: (c) The MITRE Corporation for CWE, CAPEC and ATT&CK content; SigmaHQ rule authors (Detection Rule License 1.1; author fields are kept in the rule text); CC-BY-4.0 sources (nvidia SWE-Hero and Open-SWE-Traces, reloading0101, nuhmanpk, mrmoor) must be credited as listed. The OpenVul reasoning was written by DeepSeek-R1-0528; check DeepSeek's terms for your use. No source is gated or carries a non-commercial restriction. | |
| """ | |
| open(os.path.join(OUT, f"cyberdata-2-{t}", "README.md"), "w").write(card) | |
| print("card", t, len(card)) | |