Repository navigation
FIX Validate the jailbreak goal and success threshold in FuzzerGenerator - #3396
Open
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
Open
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
Conversation
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>
This branch has not been deployed
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
Fixes #3394.
FuzzerGeneratorvalidatedtemplate_convertersandbatch_sizebut not the two settings that decide when the run ends:target_jailbreak_goal_countbelow 1 was already met before the first iteration, so the fuzzer sent no prompt, loggedTarget jailbreak goal reached.and returned an empty result.scoring_success_thresholdoutside[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 (orNaN) marked none, which keeps the run going untilmax_query_limit, or indefinitely without one.Changes:
_validate_inputsnow raisesValueErrorfor atarget_jailbreak_goal_countthat is not a positiveint(bools included) and for ascoring_success_thresholdthat is not a number in the closed interval[0.0, 1.0](bools andNaNincluded).Values that were valid before behave as before, including the bounds
0.0and1.0.with_default_scoreris unaffected unless it is given an invalid goal count, since it passes the generator default threshold.Tests and Documentation
tests/unit/executor/promptgen/fuzzer/test_fuzzer.py: the constructor rejects goal counts0,-1,True,1.5,"2"andNone, rejects thresholds-0.1,1.5,NaN,True,"0.8"andNone, and accepts the bounds0,0.0,1and1.0.mainall 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 checkandruff formatpass on the changed files, andty checkreports nothing new compared tomainbeyond the environment-onlydynamic-function-decorator-returnentries for the new parametrized tests.git diff --checkis clean.🤖 Generated with Claude Code