Skip to content

FEAT: Add AttaQ dataset loader - #4541

Open
Lanre Shittu (Shizoqua) wants to merge 4 commits into
microsoft:mainfrom
Shizoqua:feat/attaq-dataset-loader
Open

Lanre Shittu (Shizoqua) wants to merge 4 commits into
microsoft:mainfrom
Shizoqua:feat/attaq-dataset-loader

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

Description

Fixes #4495.

Adds a seed dataset loader for AttaQ (Kour et al., 2023): 1,402 adversarial questions from IBM Research, each labelled with one of seven harm categories.

  • AttaQCategory enum with the seven exact label values from the data (deception, discrimination, explicit_content, harmful_info, pii, substance_abuse, violence). categories=None loads all of them.
  • One SeedPrompt per row, with harm_categories=[label] and the row's additional_info in metadata.
  • Fetched with _fetch_from_huggingface_async from the train split, pinned to a dataset revision.
  • The class docstring repeats the dataset card's restriction: "We restrict the usage of the dataset to make models less harmful."
  • Rows with an unknown label or an empty question raise ValueError rather than being skipped silently.

Checked against the real data: 1,402 prompts with the expected count per label.

Tests and Documentation

  • Added tests/unit/datasets/test_attaq_dataset.py (10 tests) with mocked HuggingFace rows: dataset name and registration, the pinned fetch arguments, per-category filtering, empty results, invalid and empty category arguments, and malformed rows.
  • Added the BibTeX entry (kour2023unveiling) to doc/references.bib and doc/bibliography.md, and listed AttaQ in doc/code/datasets/1_loading_datasets.py and its notebook, including the dataset-name output. I edited the notebook inline to match the .py file rather than re-executing it with JupyText.

Copilot AI balanced review requested due to automatic review settings November 21, 2026 17:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Successful filtering tests cover only three of the seven AttaQ categories, leaving four without the matching-row coverage required by #4495 and the loader guidelines.

1 open issue
What changed in this PR

Adds AttaQ to PyRIT’s seed dataset catalog, providing access to 1,402 adversarial questions across seven harm categories for safety evaluation.

Changes:

  • Adds a revision-pinned loader with category filtering, source metadata preservation, and malformed-row validation.
  • Registers the loader and category enum through lazy exports and adds mocked unit tests.
  • Updates dataset documentation and adds the paper citation.
File Description
tests/​unit/​datasets/​test_attaq_dataset.py Tests registration, fetching, filtering, and validation.
pyrit/​datasets/​seed_datasets/​remote/​attaq_dataset.py Implements the AttaQ loader and category enum.
pyrit/​datasets/​seed_datasets/​remote/​__init__.py Exports the loader and enum lazily.
doc/​references.bib Adds the AttaQ paper reference.
doc/​code/​datasets/​1_loading_datasets.py Lists AttaQ in the dataset guide.
doc/​code/​datasets/​1_loading_datasets.ipynb Updates the guide and displayed dataset-name list.
doc/​bibliography.md Includes the new citation key.

Review effort: Balanced

AttaQ is ungated and fetched in a single call, which is the bar for the
"default" tag per the RECOMMENDED_TAGS rule in seed_metadata.py.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

FEAT: Add AttaQ dataset loader (1,402 adversarial questions in 7 harm categories)

3 participants