Skip to content

FIX Validate the jailbreak goal and success threshold in FuzzerGenerator - #3396

Open
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
microsoft:mainfrom
ShivamSharma43:fix/fuzzer-goal-threshold-validation
Open

Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
microsoft:mainfrom
ShivamSharma43:fix/fuzzer-goal-threshold-validation

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Description

Fixes #3394.

FuzzerGenerator validated template_converters and batch_size but not the two settings that decide when the run ends:

  • target_jailbreak_goal_count below 1 was already met before the first iteration, so the fuzzer sent no prompt, logged Target jailbreak goal reached. and returned an empty result.
  • scoring_success_threshold outside [0, 1]: float-scale scores are clamped to [0, 1] before the comparison, so a threshold below 0 marked every response a jailbreak, and one above 1 (or NaN) marked none, which keeps the run going until max_query_limit, or indefinitely without one.

Changes:

  • _validate_inputs now raises ValueError for a target_jailbreak_goal_count that is not a positive int (bools included) and for a scoring_success_threshold that is not a number in the closed interval [0.0, 1.0] (bools and NaN included).
  • The constructor docstring states both ranges.

Values that were valid before behave as before, including the bounds 0.0 and 1.0. with_default_scorer is unaffected unless it is given an invalid goal count, since it passes the generator default threshold.

Tests and Documentation

  • New tests in tests/unit/executor/promptgen/fuzzer/test_fuzzer.py: the constructor rejects goal counts 0, -1, True, 1.5, "2" and None, rejects thresholds -0.1, 1.5, NaN, True, "0.8" and None, and accepts the bounds 0, 0.0, 1 and 1.0.
  • On main all 12 rejection cases fail; the 4 bound cases pass on both. With this change all pass.
  • pytest tests/unit/executor/promptgen: 256 passed, 12 skipped.
  • ruff check and ruff format pass on the changed files, and ty check reports nothing new compared to main beyond the environment-only dynamic-function-decorator-return entries for the new parametrized tests. git diff --check is clean.
  • No documentation changes beyond the docstring.

🤖 Generated with Claude Code

A target_jailbreak_goal_count below 1 is already met before the first
iteration, so the fuzzer returned without sending a prompt. A
scoring_success_threshold outside [0, 1] made every float score a jailbreak
(below 0) or none of them (above 1, which runs until the query limit). Both
are now rejected at construction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 20, 2026 12:09

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

BUG: FuzzerGenerator accepts a jailbreak goal below 1 and a success threshold outside [0, 1]

2 participants