Dataset Viewer
Auto-converted to Parquet Duplicate
messages
listlengths
5
9
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
[ { "role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs. Given a CVE and its triage data, you generate the actual fix (diff) that a remediator can review and approve.\n\nYou have three strategies available:\n\n1. **version-bump**: Update the package version + hash to a release that ...
End of preview. Expand in Data Studio

nixpkgs-security-patches

Training dataset for fine-tuning LLMs on nixpkgs security patch generation. Derived from real merged security PRs in NixOS/nixpkgs.

Status. A one-time collection from 2 March 2026, not refreshed since. The split below is a seeded random 90/10 shuffle over individual PRs, with no grouping by CVE or package, so 32 of the 65 (CVE, package) pairs in eval also appear in train: an eval number measured against this split reflects recall, not generalization to unseen packages. The adapter this dataset trained (nixpkgs-security-qwen-lora) is no longer deployed. This dataset is not used by trace, a separate, later project from the same team.

Dataset Details

  • 588 training examples / 66 eval examples (654 total)
  • Format: Multi-turn tool-calling conversations in ChatML JSONL
  • Each example is a realistic agent session: the model reads the package file, finds the upstream fix, computes hashes via tools, and submits the fix for approval
  • Hashes and URLs appear only in tool results (not in model outputs), so the model learns the tool-calling flow rather than memorizing unpredictable values

Tool-Calling Format (v3)

Examples use the Qwen 2.5 native <tool_call> / <tool_response> XML format. Each conversation includes:

  1. System message: Fix generation prompt + 6 tool definitions (lookup_cve, find_upstream_fix, read_nixpkgs_file, generate_patch_diff, prefetch_hash, submit_for_approval)
  2. User message: CVE + package + recommended strategy
  3. Multi-turn tool exchanges:
    • read_nixpkgs_file β†’ package definition (always present)
    • find_upstream_fix β†’ commit/release info (when extractable from diff)
    • prefetch_hash β†’ SRI hash (when extractable from diff)
    • submit_for_approval β†’ final diff + commit message (always present)

Tool Flow Breakdown

Flow Count Description
Full (read β†’ find β†’ hash β†’ submit) 277 fetchpatch with GitHub commit URL or version bump with fetchFromGitHub
Short (read β†’ submit) 377 Local patches, non-GitHub sources

Data Collection

Examples were collected from merged PRs in NixOS/nixpkgs using multiple strategies:

  1. PRs with 1.severity: security label
  2. PRs with "CVE" in the title
  3. Commits referencing CVE IDs
  4. PRs linked from closed security-labeled issues

Quality Filters

  • Only merged PRs with nix file changes
  • All examples have a CVE reference (in metadata, title, or diff)
  • Version bumps without CVE IDs excluded (trivially automatable)
  • "Other" strategy excluded (too heterogeneous for consistent tool flow)
  • Diffs larger than 50KB or changing >10 files excluded
  • Examples exceeding ~5500 estimated tokens excluded (training uses 4096 max seq length)

Token Statistics

Metric Value
Average ~2,533 tokens
Min ~2,011 tokens
Max ~5,341 tokens

Usage

from datasets import load_dataset

dataset = load_dataset("adastracomputing/nixpkgs-security-patches", data_files={
    "train": "train.jsonl",
    "eval": "eval.jsonl",
})

Example

{
  "messages": [
    {"role": "system", "content": "You are a fix generation agent for NixOS/nixpkgs...\n\n# Tools\n<tools>...</tools>"},
    {"role": "user", "content": "Generate a fix for CVE-2025-62813 in lz4..."},
    {"role": "assistant", "content": "I need to read the current package.\n\n<tool_call>\n{\"name\": \"read_nixpkgs_file\", \"arguments\": {\"path\": \"pkgs/by-name/lz/lz4/package.nix\"}}\n</tool_call>"},
    {"role": "user", "content": "<tool_response>\n  lib, stdenv, fetchFromGitHub, ...\n</tool_response>"},
    {"role": "assistant", "content": "Let me find the upstream fix.\n\n<tool_call>\n{\"name\": \"find_upstream_fix\", \"arguments\": {\"cve_id\": \"CVE-2025-62813\", \"repo_owner\": \"lz4\", \"repo_name\": \"lz4\"}}\n</tool_call>"},
    {"role": "user", "content": "<tool_response>\n{\"found\": true, \"type\": \"commit\", \"commits\": [{\"sha\": \"f64efec0...\"}]}\n</tool_response>"},
    {"role": "assistant", "content": "Computing the hash.\n\n<tool_call>\n{\"name\": \"prefetch_hash\", \"arguments\": {\"type\": \"patch\", \"url\": \"https://github.com/lz4/lz4/commit/f64efec0.patch\"}}\n</tool_call>"},
    {"role": "user", "content": "<tool_response>\n{\"hash\": \"sha256-qOvK0A3MGX14WdhThV7m4G6s+ZMP6eA/07A2BY5nesY=\"}\n</tool_response>"},
    {"role": "assistant", "content": "<tool_call>\n{\"name\": \"submit_for_approval\", \"arguments\": {\"cve_id\": \"CVE-2025-62813\", \"package_name\": \"lz4\", \"strategy\": \"cve-patch\", \"diff\": \"diff --git a/...\", \"commit_message\": \"lz4: add patch for CVE-2025-62813\", \"explanation\": \"Backport upstream fix as fetchpatch.\"}}\n</tool_call>"}
  ]
}

Models Trained on This Dataset

Changelog

  • v3 (2026-03-03): Reformatted as multi-turn tool-calling conversations. Hashes now appear only in tool results, not model outputs. Includes version bumps with CVEs. 654 examples.
  • v2 (2026-03-03): Filtered out 763 version bump / hash-only examples. 652 complex patches remaining.
  • v1 (2026-03-02): Initial collection of 1,415 examples (unfiltered).
Downloads last month
95

Models trained or fine-tuned on adastracomputing/nixpkgs-security-patches