Skip to content

[FEAT] Add SemGuard Arabic Security Dataset loader - #2468

Open
Abdallah Abughallous (AbdaullahAG) wants to merge 5 commits into
microsoft:mainfrom
AbdaullahAG:main
Open

[FEAT] Add SemGuard Arabic Security Dataset loader#2468
Abdallah Abughallous (AbdaullahAG) wants to merge 5 commits into
microsoft:mainfrom
AbdaullahAG:main

Conversation

@AbdaullahAG

Copy link
Copy Markdown

Description

Adds a SeedDataset loader for the SemGuard Arabic Security
Dataset — 807 validated Arabic/Arabizi/English prompt attack
examples across 7 threat categories (injection/jailbreak,
phishing, privacy leakage, violent incitement, harmful content,
impersonation, safe). Validated via a three-judge LLM-as-Judge
pipeline (GPT-4o, Grok-4, Llama 3.3 70B; Fleiss' kappa = 0.839).

Closes #2331.

Implementation notes, per the discussion in #2331:

  • Category enum: SemGuardCategory (7 values) lets callers
    filter by threat category, following the VLGuardSubset pattern.
    SAFE is included as an explicit filterable value rather than
    always loaded, per Roman Lutz (@romanlutz)'s point about excluding safe
    prompts by default.
  • Language accessibility: each seed's metadata includes a
    language field (ar, en, or code-switched), so users can
    filter or at least identify non-English prompts programmatically
    even without reading Arabic. Category-level docstrings and the
    loader's own docstring describe each category in English. Open
    to adding English glosses per-seed if that would help further.
  • harm_categories mapping: PyRIT's HarmCategory taxonomy
    doesn't have a direct entry for "prompt injection" as an attack
    technique (as opposed to a content-harm type), so
    injection_jailbreak maps to COORDINATION_HARM via
    HARM_CATEGORY_ALIAS_OVERRIDES. Flagging this in case a more
    precise mapping is preferred.
  • The dataset itself is CC BY 4.0 licensed (separate from this
    loader file's MIT license, consistent with how gated/externally
    licensed datasets like VLGuard are handled).

Paper: accepted at IEEE AEECT 2026 (citation added to
references.bib / bibliography.md).

Tests and Documentation

  • Added tests/unit/datasets/test_semguard_dataset.py: 9 tests
    covering happy-path fetch, category filtering, empty-after-filter
    raises ValueError, empty-text rows are skipped, dataset_name
    property, HARM_CATEGORY_ALIAS_OVERRIDES coverage for all 7
    categories, and SemGuardCategory enum values. All passing
    locally (pytest tests/unit/datasets/test_semguard_dataset.py -v
    → 9 passed).
  • Registered the loader and SemGuardCategory in
    pyrit/datasets/seed_datasets/remote/__init__.py.
  • Added BibTeX entry (abughallous2026semguard) to
    doc/references.bib and the cite key to doc/bibliography.md.
  • Updated doc/code/datasets/1_loading_datasets.py (prose list)
    and regenerated the notebook via:
    jupytext --to ipynb --execute doc/code/datasets/1_loading_datasets.py
    — ran clean, confirmed semguard appears in the executed
    get_all_dataset_names_async() output cell alongside the other
    built-in datasets.

…Dataset loader for the SemGuard Arabic Security Dataset:807 validated Arabic/Arabizi/English prompt attack examples across7 threat categories, validated via a three-judge LLM-as-Judgepipeline (GPT-4o, Grok-4, Llama 3.3 70B; Fleiss' kappa = 0.839).Introduces SemGuardCategory enum for filtering by threat category.
…y-path fetch, category filtering, empty-after-filterraises, empty-text-skipped, dataset_name property, harm categoryalias overrides, and SemGuardCategory enum values.
@AbdaullahAG

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Arabic & Multilingual Security Contributions to PyRIT

1 participant