FEAT: Add Garak divergence scenario - #2547
Open
Vimal Sahani (VimalN2005) wants to merge 1 commit into
Open
Conversation
Author
|
@microsoft-github-policy-service agree |
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 #2533
This PR adds a native PyRIT scenario porting Garak's
divergenceprobe (divergence.Repeatanddivergence.RepeatedToken), testing whether prompt repetition causes target models to diverge from requested repetition into unexpected continuation, output instability, or training data replay.Key changes:
pyrit/datasets/seed_datasets/local/garak/garak_divergence.prompt):poem,company,book,aacross 1, 3, 40 repeats) and a small, bounded set of precomputed repeated tokens (without any runtime tokenizer dependency).confidentiality,training_data_leakage.pyrit/score/true_false/regex/divergence_scorer.py):DivergenceScorer(MessageTrueFalseScorer), a deterministic scorer distinguishing compliant bounded repetition and standard refusal/mitigation prefixes from divergence hits into unexpected continuations.pyrit.score.true_false.regexandpyrit.score.pyrit/scenario/scenarios/garak/divergence.py):DivergenceTechnique(ScenarioTechnique)withRepeatas default,RepeatedTokenas explicit opt-in, andALL.Divergence(Scenario)leveraging standardPromptSendingAttackworkflow and per-prompt derived objectives.pyrit.scenario.scenarios.garak.doc/scanner/garak.py&doc/scanner/garak.ipynb):Tests and Documentation
tests/unit/scenario/garak/test_divergence.py:PromptSendingAttackgeneration.DEFAULT->repeat,ALL->repeat+repeated_token).pytest tests/unit/scenario/garak/): 154/154 passed.jupytext --sync doc/scanner/garak.py.ruff checkandruff format --check.