ccrb / EXECUTION_PLAN.md
prshrs's picture
Upload CCRB v0.2-dev cybersecurity retrieval benchmark
8510f62 verified
|
Raw History Blame Contribute Delete
8.76 kB

CCRB Dataset Construction & Execution Plan

This document defines the end-to-end engineering plan to build CCRB v1.0 with 3,600 validated queries (600 per track across all six tracks; scalable up to 6,000 in future releases), with explicit support for cyber-code-to-knowledge and code-to-code retrieval.


1. Key Benchmark Design Adjustments (Before Data Collection)

To make CCRB scientifically credible alongside MTEB / BEIR / CoIR, six structural safeguards are enforced:

  1. Per-Track Document Corpora + Distractor Scaling (data/documents/<track>.jsonl)
    • A benchmark needs explicit, fixed document collections per track (data/documents/<track>.jsonl), not just queries and qrels.
    • Because CWE (940 entries) and ATT&CK (650 techniques) are small taxonomies, Recall@100 is trivially inflated if searched alone. Every track corpus must either contain hard-negative distractors (minimum 10,000+ documents per track or full NVD/GHSA scale) or be evaluated in unified-corpus mode alongside cross-track documents.
  2. Strict Anti-Shortcut / Anti-Leakage Filtering
    • Queries must never include target IDs (CVE-YYYY-NNNN, CWE-NNN, CAPEC-NNN, T1059, GHSA-...) or verbatim document titles. Enforced automatically via scripts/validate_dataset.py --strict-leakage.
  3. Multi-Positive Graded Qrels (Fixing the Single-Positive Trap)
    • Recall@10 and Recall@100 collapse to binary Hit@k when each query has only 1 positive document.
    • Use taxonomy graphs (CWE parent/child, CAPEC-to-CWE, ATT&CK sub-technique-to-technique, CVE-to-GHSA aliases, CWE/ATT&CK mitigations) plus hard-negative pooling so queries average 2–5 graded positives (3, 2, 1) and 15–25 verified hard negatives (0).
  4. Dev / Test Splits + Temporal Holdout
    • Allocate 20% dev (for tuning chunking/prompts) and 80% test (held-out evaluation).
    • For cve and advisories, reserve a temporal out-of-time test slice (e.g., 2025–2026 records) to separate true semantic generalization from pre-training memorization.
  5. Licensing Hygiene for Cyber Code (The Stack v3 Caveat)
    • The Stack v3 (and v2) contains mixed licenses (GPL/AGPL/proprietary/opt-outs) and raw repository text that cannot all be redistributed under Apache-2.0.
    • Rule: Filter code sources strictly to verified permissive licenses (MIT, Apache-2.0, BSD-2/3-Clause, ISC, CC0) or distribute offset/hash-referenced reconstruction scripts for any non-redistributable corpus, keeping redistributed data/documents/code.jsonl 100% license-clean.
  6. BM25 Lexical Baseline Gate
    • Every track must be evaluated with BM25 first. Any query subset where BM25 achieves near-ceiling nDCG@10 (>0.85) is flagged for semantic paraphrasing or cross-modal code-to-concept rewriting.

2. Target Allocation (3,600 Queries for v1.0)

Track dev test Total Queries Corpus Target Size Primary Sources
cve 120 480 600 50,000–100,000 docs NVD JSON 2.0 API, CVE List v5, CISA KEV
cwe 120 480 600 ~1,000 CWE/CAPEC + 10k distractors MITRE CWE XML, MITRE CAPEC XML
attack 120 480 600 ~2,500 ATT&CK/CAPEC + 10k distractors MITRE ATT&CK STIX 2.1 (Enterprise, ICS, Mobile)
advisories 120 480 600 40,000–80,000 docs GitHub Advisory DB (OSV/GHSA), CISA KEV, PyPA/RustSec/Go
remediation 120 480 600 10,000–15,000 docs CWE/ATT&CK Mitigations, OWASP Cheat Sheets & ASVS
code 120 480 600 30,000–50,000 docs Permissive Stack v3 / GitHub CVE fix diffs / Semgrep & CodeQL OSS rules
Total 720 2,880 3,600 ~150k–265k docs

(Equal 600 queries/track ensures balanced statistical power across every track and clean macro-averaging; can scale to 1,000/track = 6,000 in v1.1+.)


3. Query Modality Mix (Integrating Cyber Code Throughout)

Because CCRB specifically measures how well embedding models connect cyber code to security semantics, avoid pure English-to-English paraphrase queries:

  • Natural-Language → Document (~45%): Realistic analyst, engineer, or incident-responder questions describing symptoms, blast radius, or behaviors without naming identifiers.
  • Code / Diff / Telemetry → Concept (~35%):
    • Vulnerable code snippet → cwe (identify weakness class) or cve / advisories (identify matching vulnerability pattern).
    • Security patch diff / fix commit → remediation or cve.
    • Log line, Sigma/YARA rule, or CLI telemetry → attack technique.
  • Code ↔ Security Code (~20%) (primarily in code track):
    • Vulnerable pattern → secure defensive implementation (e.g., unsafe SQL concatenation → parameterized query).
    • Cross-language security equivalent (e.g., Python safe deserialization ↔ Go/Rust equivalent).
    • Security requirement / threat model → reference implementation snippet.

4. Phased Execution Roadmap

Phase 1 — Source Ingestion & License Registry (Weeks 1–2)

  1. Mirror official snapshots with pinned collection timestamps (SOURCE_MANIFEST.json):
    • NVD API 2.0 + CISA KEV JSON + CVEProject cvelistV5.
    • MITRE CWE XML + CAPEC XML + ATT&CK STIX (cti repository).
    • GitHub Advisory Database (github/advisory-database, CC-BY-4.0).
    • OWASP CheatSheetSeries / ASVS (CC-BY-SA-4.0 — track share-alike boundary separately or cite/link cleanly).
    • Permissive code slices: GitHub Security Advisories with linked permissive fix commits, OSS-Fuzz/CWE examples, and license-filtered The Stack v3 (MIT/Apache-2.0/BSD).
  2. Normalize all raw documents into data/documents/<track>.jsonl, strip boilerplate/HTML, deduplicate via MinHash/SimHash, and record exact license, source_id, and published_date.

Phase 2 — Graph-Seeded Candidate Pairing & Query Synthesis (Weeks 3–5)

  1. Build a cross-source entity graph linking CVE ↔ CISA KEV ↔ GHSA ↔ CWE ↔ CAPEC ↔ ATT&CK ↔ Mitigations ↔ Fix Commits.
  2. Generate queries in stratified batches:
    • Real-world derived queries: Rephrased issue reports, commit messages, and analyst descriptions (with IDs scrubbed).
    • Code-grounded queries: Extracted functions/diffs (10–80 lines) paired to their verified CWE, advisory, or secure counterpart.
    • Controlled synthetic paraphrases: Generated via diverse templates/models and strictly checked against lexical overlap thresholds (Jaccard < 0.45 with target title/first sentence).
  3. Run scripts/validate_dataset.py --strict-leakage continuously during generation.

Phase 3 — Hard-Negative Mining & Graded Relevance Annotation (Weeks 6–7)

  1. Retrieve top-50 candidates per query using BM25 + 2 diverse open embedding baselines (e.g., general-purpose + code embedding model).
  2. Sample top unjudged candidates (pooled hard negatives) alongside graph-linked positives.
  3. Score candidate pairs (query, doc) on the 0–3 rubric:
    • Grade 3 (Highly Relevant): Exact target CVE/CWE/technique/advisory/remediation/secure-code match.
    • Grade 2 (Relevant): Direct parent/child CWE, parent ATT&CK technique, sibling advisory for the same vulnerability class/component, or valid alternative mitigation.
    • Grade 1 (Marginally Relevant): Related tactic/category or partial conceptual overlap that aids triage without directly answering the query.
    • Grade 0 (Not Relevant): Verified hard negative (same domain/keywords, wrong root cause, wrong vulnerability, or wrong mechanism).
  4. Human Audit Gate: Independent human cybersecurity reviewers double-annotate a 15% stratified sample (~720 queries, ~3,600 pairs) to calibrate automated/LLM-assisted judging and report inter-annotator agreement (Cohen's $\kappa$ / Krippendorff's $\alpha \ge 0.75$).

Phase 4 — Baseline Calibration & Contamination Audit (Week 8)

  1. Run baseline suite on dev and test:
    • Lexical: BM25
    • General dense models (small/medium/large open-weights)
    • Code-specialized embedding models
    • Cybersecurity-tuned embedding models (if available)
  2. Verify:
    • Dense models meaningfully outperform BM25 on semantic/code-to-concept slices.
    • Temporal out-of-time slice shows expected performance delta vs historical slice.
    • No train/dev/test document leakage or near-duplicate queries.

Phase 5 — v1.0 Release Packaging (Week 9)

  1. Freeze data/ checksums (SHA256SUMS), update DATASET_CARD.md with exact counts, agreement scores, and collection dates.
  2. Publish baseline scoreboard in results/ and tag v1.0.0 on Hugging Face (continuum-oss/ccrb).