[FEAT] Add SemGuard Arabic Security Dataset loader - #2468
Open
Abdallah Abughallous (AbdaullahAG) wants to merge 5 commits into
Open
[FEAT] Add SemGuard Arabic Security Dataset loader#2468Abdallah Abughallous (AbdaullahAG) wants to merge 5 commits into
Abdallah Abughallous (AbdaullahAG) wants to merge 5 commits into
Conversation
…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.
…ed via: jupytext --to ipynb --execute
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a
SeedDatasetloader for the SemGuard Arabic SecurityDataset — 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:
SemGuardCategory(7 values) lets callersfilter by threat category, following the
VLGuardSubsetpattern.SAFEis included as an explicit filterable value rather thanalways loaded, per Roman Lutz (@romanlutz)'s point about excluding safe
prompts by default.
metadataincludes alanguagefield (ar,en, or code-switched), so users canfilter 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.
HarmCategorytaxonomydoesn't have a direct entry for "prompt injection" as an attack
technique (as opposed to a content-harm type), so
injection_jailbreakmaps toCOORDINATION_HARMviaHARM_CATEGORY_ALIAS_OVERRIDES. Flagging this in case a moreprecise mapping is preferred.
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
tests/unit/datasets/test_semguard_dataset.py: 9 testscovering happy-path fetch, category filtering, empty-after-filter
raises
ValueError, empty-text rows are skipped,dataset_nameproperty,
HARM_CATEGORY_ALIAS_OVERRIDEScoverage for all 7categories, and
SemGuardCategoryenum values. All passinglocally (
pytest tests/unit/datasets/test_semguard_dataset.py -v→ 9 passed).
SemGuardCategoryinpyrit/datasets/seed_datasets/remote/__init__.py.abughallous2026semguard) todoc/references.biband the cite key todoc/bibliography.md.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
semguardappears in the executedget_all_dataset_names_async()output cell alongside the otherbuilt-in datasets.