FEAT: Add HiXSTest (Hindi exaggerated-safety) dataset loader#1755
Open
romanlutz wants to merge 2 commits into
Open
FEAT: Add HiXSTest (Hindi exaggerated-safety) dataset loader#1755romanlutz wants to merge 2 commits into
romanlutz wants to merge 2 commits into
Conversation
Adds the _HiXSTestDataset remote loader for the walledai/HiXSTest HuggingFace dataset (50 Hindi exaggerated-safety prompts with English translations). The dataset is gated; the loader mirrors the SorryBench token-handling pattern (constructor argument with HUGGINGFACE_TOKEN env fallback). Hindi prompt is the SeedPrompt value; english_prompt, label, category, and language are stored in metadata. Adds the gupta2024walledeval citation to references.bib and bibliography.md, plus unit tests. 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 remote seed dataset loader for HiXSTest (
walledai/HiXSTest), the Hindi companion to SGXSTest from the WalledEval paper. HiXSTest is a manually-curated set of 50 exaggerated-safety prompts in Hindi, each paired with an English translation, asafe/unsafelabel, and a polysemous Hindi trigger word ascategory(e.g.मारनाis both "to kill" and "to overcome"). It lets us measure whether models over-refuse benign Hindi prompts that happen to share surface tokens with harmful ones, in a way English-only XSTest variants can't capture.Approach
_HiXSTestDataset(_RemoteDatasetLoader)inpyrit/datasets/seed_datasets/remote/hixstest_dataset.py(dataset_name="hixstest", singletrainsplit, 50 rows).gated="auto") on HuggingFace, so users must accept the terms on the dataset page and provide a token. Token handling mirrorssorry_bench_dataset.py: explicittoken=kwarg, falling back to theHUGGINGFACE_TOKENenvironment variable. Gating is documented in the class docstring.HiXSTestLanguageenum (HINDI,ENGLISH) controls which text becomes theSeedPrompt.value. The other-language text is always preserved inmetadataashindi_prompt/english_prompt, so consumers can switch without re-fetching. Validation goes through the existing_validate_enumhelper, matching the VLGuard pattern.categoryis mirrored into bothharm_categoriesandmetadata["category"].labelis stored as metadata so callers can filtersafevsunsafe.modalities=["text"],size="small"(50 prompts),tags={"default", "safety", "multilingual"}._HiXSTestDatasetandHiXSTestLanguagefrompyrit/datasets/seed_datasets/remote/__init__.py.@gupta2024walledeval, arXiv:2408.03837) todoc/references.bibanddoc/bibliography.md.Tests and Documentation
tests/unit/datasets/test_hixstest_dataset.py(8 tests):dataset_name, default-Hindi language, non-enum rejection, token-from-env, explicit-token override, Hindi-mode fetch (asserts Hindivalue+ both translations in metadata), English-mode fetch (asserts Englishvalue+ Hindi preserved in metadata), and thattoken/split/cacheare forwarded to_fetch_from_huggingface.valueswitches correctly, metadata stays consistent.uv run ruff format,uv run ruff check,uv run ty check, and the fulltests/unit/datasetssuite (430 tests) all pass.