Repository navigation
feat: Add XSTest safety benchmark resource server - #764
Merged
Merged
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Adds XSTest (Rottger et al., NAACL 2024) as a new resource server for evaluating LLM over-refusal behavior. 450 hand-crafted prompts (250 safe, 200 unsafe) test whether models correctly comply with safe requests and refuse unsafe ones. Two verification modes: - String-match classification (from the paper's 21 refusal prefixes) - LLM-as-judge with the paper's 3-class taxonomy (optional, configurable) Judge falls back to string matching on errors. Includes per-category aggregate reporting script and documentation. Signed-off-by: Dave Farris <dfarris@nvidia.com>
- Remove system prompt from dataset (XSTest tests raw prompt behavior) - Document recommended generation params (temp=1.0, max_output_tokens=32768) - Update README with no-system-prompt rationale and gen param guidance - Simplify _parse_judge_verdict (remove unnecessary variable) - Simplify test_sanity and aggregate_results.py Signed-off-by: Dave Farris <dfarris@nvidia.com>
Auto-generated by update-readme-table pre-commit hook. Signed-off-by: Dave Farris <dfarris@nvidia.com>
dcfarris
force-pushed
the
dfarris/add-xstest-benchmark
branch
from
March 4, 2026 23:34
adf194f to
88b4cec
Compare
- Add judge_output_format config ("xstest" or "wildguard") to select parser
- Add WildGuard verdict parser matching allenai/wildguard library output
- Add WildGuard prompt template (inner content only, chat template in YAML)
- Add xstest_wildguard.yaml config with local_vllm_model + custom chat template
- WildGuard chat template verified to produce identical prompts to wildguard library
- 31 tests (string-match, xstest judge, wildguard judge parsing + integration)
Signed-off-by: Dave Farris <dfarris@nvidia.com>
dcfarris
marked this pull request as ready for review
March 6, 2026 23:13
bxyu-nvidia
previously approved these changes
Mar 7, 2026
prasoonvarshney
requested changes
Mar 9, 2026
prasoonvarshney
left a comment
Contributor
There was a problem hiding this comment.
Added comments inline
β¦arsing, judge error tracking - Make WildGuard the default judge config (xstest.yaml), move string-match to xstest_string_match.yaml. - Fix _strip_thinking_blocks() to handle missing opening <think> tag (split on closing tag only, which is the reliable indicator). - Distinguish judge_parsing_error from judge_error in verdict labels for better debugging of unparseable judge output vs HTTP failures. - Log detected judge type (WildGuard/XSTest 3-class/string-match) in aggregate results output. - Add tests for thinking trace edge cases (no opening tag, orphaned opening tag, non-thinking model) and judge_parsing_error label. - Update README to document all three verification modes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Dave Farris <dfarris@nvidia.com>
Per reviewer consensus, reasoning trace separation is the model server's responsibility (via --reasoning-parser for vLLM, or the Responses schema's native reasoning content type. The resource server no longer strips <think>/<thinking> blocks. Added a warning log if </think> tags are detected in response content, indicating the model server's reasoning parser may not be enabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> EOF ) Signed-off-by: Dave Farris <dfarris@nvidia.com>
prasoonvarshney
previously approved these changes
Mar 10, 2026
prasoonvarshney
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the updates, LGTM
bxyu-nvidia
previously approved these changes
Mar 10, 2026
β¦s/add-xstest-benchmark Signed-off-by: Brian Yu <bxyu@nvidia.com>
bxyu-nvidia
dismissed stale reviews from prasoonvarshney and themself
via
March 10, 2026 04:34
5f48716
- Add policy_model placeholder to xstest.yaml and xstest_string_match.yaml (required by config validation when agent references policy_model) - Add example_rollouts.jsonl (5 entries, required by new CI data validation) - Add example_metrics.json (required by CI data validation) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Dave Farris <dfarris@nvidia.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Dave Farris <dfarris@nvidia.com>
bxyu-nvidia
approved these changes
Mar 10, 2026
raveedturing
pushed a commit
to turing-rlgym/Gym
that referenced
this pull request
Mar 18, 2026
## Summary - Adds XSTest safety benchmark (Rottger et al., NAACL 2024) as a new resource server - 450 hand-crafted prompts (250 safe, 200 unsafe) that test whether models correctly comply with safe requests and refuse unsafe ones - Three verification modes: string-match (from the paper), LLM-as-judge (3-class taxonomy), and WildGuard (Allen AI safety classifier) - Judge mode is configurable via `use_judge` + `judge_output_format` β easily swappable between WildGuard, Qwen3-Guard, or any LLM judge - Includes WildGuard config (`xstest_wildguard.yaml`) with custom chat template for `local_vllm_model` ## What's in this PR - `app.py` β resource server with string-match + LLM judge + WildGuard verdict parsing - `configs/xstest.yaml` β default config (string-match only) - `configs/xstest_wildguard.yaml` β WildGuard via `local_vllm_model` with custom chat template - `prompt_templates/xstest_judge.txt` β XSTest paper's 3-class judge prompt - `prompt_templates/wildguard_judge.txt` β WildGuard classifier prompt (verified identical to allenai/wildguard library) - `data/example.jsonl` β 5 example prompts (no system prompt) - `tests/test_app.py` β 31 tests (string-match, XSTest judge, WildGuard judge) - `scripts/aggregate_results.py` β per-category results aggregation ## Validation - End-to-end tested with WildGuard judge on all 450 prompts - Results match internal baseline within expected temp=1.0 variance ## Test plan - [x] 31 unit tests passing (`pytest`) - [x] `ruff check` and `ruff format` clean - [x] `ng_prepare_data` example validation passing - [x] End-to-end rollout collection with `ng_collect_rollouts` - [x] Full 450-prompt run with WildGuard judge via `local_vllm_model` - [x] Aggregate reporting verified with per-category breakdown --------- Signed-off-by: Dave Farris <dfarris@nvidia.com> Signed-off-by: Brian Yu <bxyu@nvidia.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Brian Yu <bxyu@nvidia.com>
mahanfathi
pushed a commit
that referenced
this pull request
Mar 24, 2026
## Summary - Adds XSTest safety benchmark (Rottger et al., NAACL 2024) as a new resource server - 450 hand-crafted prompts (250 safe, 200 unsafe) that test whether models correctly comply with safe requests and refuse unsafe ones - Three verification modes: string-match (from the paper), LLM-as-judge (3-class taxonomy), and WildGuard (Allen AI safety classifier) - Judge mode is configurable via `use_judge` + `judge_output_format` β easily swappable between WildGuard, Qwen3-Guard, or any LLM judge - Includes WildGuard config (`xstest_wildguard.yaml`) with custom chat template for `local_vllm_model` ## What's in this PR - `app.py` β resource server with string-match + LLM judge + WildGuard verdict parsing - `configs/xstest.yaml` β default config (string-match only) - `configs/xstest_wildguard.yaml` β WildGuard via `local_vllm_model` with custom chat template - `prompt_templates/xstest_judge.txt` β XSTest paper's 3-class judge prompt - `prompt_templates/wildguard_judge.txt` β WildGuard classifier prompt (verified identical to allenai/wildguard library) - `data/example.jsonl` β 5 example prompts (no system prompt) - `tests/test_app.py` β 31 tests (string-match, XSTest judge, WildGuard judge) - `scripts/aggregate_results.py` β per-category results aggregation ## Validation - End-to-end tested with WildGuard judge on all 450 prompts - Results match internal baseline within expected temp=1.0 variance ## Test plan - [x] 31 unit tests passing (`pytest`) - [x] `ruff check` and `ruff format` clean - [x] `ng_prepare_data` example validation passing - [x] End-to-end rollout collection with `ng_collect_rollouts` - [x] Full 450-prompt run with WildGuard judge via `local_vllm_model` - [x] Aggregate reporting verified with per-category breakdown --------- Signed-off-by: Dave Farris <dfarris@nvidia.com> Signed-off-by: Brian Yu <bxyu@nvidia.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Brian Yu <bxyu@nvidia.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.
Summary
use_judge+judge_output_formatβ easily swappable between WildGuard, Qwen3-Guard, or any LLM judgexstest_wildguard.yaml) with custom chat template forlocal_vllm_modelWhat's in this PR
app.pyβ resource server with string-match + LLM judge + WildGuard verdict parsingconfigs/xstest.yamlβ default config (string-match only)configs/xstest_wildguard.yamlβ WildGuard vialocal_vllm_modelwith custom chat templateprompt_templates/xstest_judge.txtβ XSTest paper's 3-class judge promptprompt_templates/wildguard_judge.txtβ WildGuard classifier prompt (verified identical to allenai/wildguard library)data/example.jsonlβ 5 example prompts (no system prompt)tests/test_app.pyβ 31 tests (string-match, XSTest judge, WildGuard judge)scripts/aggregate_results.pyβ per-category results aggregationValidation
Test plan
pytest)ruff checkandruff formatcleanng_prepare_dataexample validation passingng_collect_rolloutslocal_vllm_model