FEAT: Add CategoricalHarmfulQA (CatQA) dataset loader#1749
Open
romanlutz wants to merge 2 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 loader for declare-lab/CategoricalHarmfulQA (CatQA), a 550-question safety evaluation dataset hand-authored against the combined prohibited-use lists from OpenAI's usage policies and Meta's Llama2 acceptable use policy.
CatQA complements the existing
harmful_qaloader rather than duplicating it:harm_categories(11 main categories: Illegal Activity, Child Abuse, Hate/Harass/Violence, Malware Viruses, Physical Harm, Economic Harm, Fraud/Deception, Adult Content, Political Campaigning, Privacy Violation Activity, Tailored Financial Advice), each with 5 sub-categories surfaced via per-promptmetadata. HarmfulQA's "topics" (Social Sciences, Computer Science, ...) are academic disciplines, not harm categories.language={"en","zh","vi"}(default"en"). HarmfulQA is English-only.The loader follows the same patterns as the existing remote dataset providers (
_HarmfulQADataset,_AyaRedteamingDataset, etc.): inherits_RemoteDatasetLoader, fetches via thedatasetslibrary, exposes class-level metadata (tags={"safety","multilingual"},size="large",modalities=["text"], fullharm_categorieslist) for filterable discovery, and registers automatically through the__init_subclass__hook.Tests and Documentation
tests/unit/datasets/test_categorical_harmful_qa_dataset.pycover default English split, all three language splits (parametrized), empty-category handling, anddataset_name. All 6 pass; the fulltests/unit/datasetstier (428 tests) is also green.bhardwaj2024homerbibliography entry (arXiv 2402.11746) and listed CatQA indoc/code/datasets/1_loading_datasets.{py,ipynb}.1_loading_datasets.ipynbviajupytext --to ipynb --executeso the printed dataset roster includescategorical_harmful_qa.pre-commit(ruff-format, ruff-check, ty, nbstripout, link-checker) is clean.