Repository navigation
FEAT: Measure how far a scorer's verdicts move with the presentation of the question - #4369
Queued
WatchTree-19 wants to merge 6 commits into
Queued
WatchTree-19 wants to merge 6 commits into
WatchTree-19 wants to merge 6 commits into
Conversation
…of the question ScorerStabilityEvaluator scores the same responses under several presentations of the same question and reports how the verdicts and the reported rate move. Repeated runs split the flip rate into the scorer's own run-to-run noise and the presentation effect, permutation tests say whether an effect or a shift is there, and compute_scorer_stability gives the same metrics from recorded verdicts.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The sign-flip p-value can falsely indicate presentation effects with unequal run counts, while delayed argument validation wastes API calls and missing typed expectations prevent supported scorers from running.
3 open issues
What changed in this PR
Adds presentation-stability evaluation alongside PyRIT’s existing scorer accuracy metrics, addressing the evaluation portion of #2168 without generating rubric rewrites.
Changes:
- Adds repeated scoring across presentations, separating repeat noise from presentation effects and reporting rate shifts.
- Supports unlabeled conversations, labeled datasets, recorded verdicts, and JSON serialization.
- Adds statistical simulations, evaluator tests, usage documentation, and research references.
| File | Description |
|---|---|
tests/unit/score/test_scorer_stability.py |
Tests estimates, statistical behavior, serialization, and evaluator integration. |
pyrit/score/scorer_evaluation/scorer_stability.py |
Implements presentations, stability metrics, statistical calculations, and evaluation. |
pyrit/score/__init__.py |
Exposes the new APIs through lazy exports. |
doc/references.bib |
Adds two judge-reliability research references. |
doc/myst.yml |
Adds the stability guide to documentation navigation. |
doc/code/scoring/scorer_stability.md |
Explains usage, metrics, and interpretation limits. |
doc/bibliography.md |
Includes the new references in the bibliography. |
Review effort: Balanced
…and pass expectations through Reversing each response's shift is only a fair comparison when the reference and the presentation ran the same number of times, so the shift p-value is None otherwise. Settings are validated before anything is stored or scored. The evaluator takes a ScoringExpectation per response and passes it on as it is, so scorers that need typed conditions can be evaluated.
Resolve doc/bibliography.md by taking the union of the citation keys from both sides (main's kour2023unveiling and yu2024cosafe plus this PR's dev2026judgereliability and weng2026policyinvariance), sorted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…trics Share ScorerEvaluator's scoring-trial loop (_run_scoring_trials_async and _compute_trial_metrics) instead of a second loop, with no change to evaluate_dataset_async. _score_responses_grouped_async also accepts per-response expectations, and objectives= still works. ScorerStabilityEvaluator now scores already-configured scorers in interleaved rounds, one ObjectiveScorerEvaluator per scorer. It no longer stores per-presentation conversation copies, and response_converters is removed. Construction rejects a presentation that repeats a scorer configuration or changes the judge settings. evaluate_conversations_async requires the conversations to be in memory already and adds nothing but scores. Metrics fixes: - pairwise deletion of undetermined verdicts, so one failing presentation no longer changes the reference figures or other comparisons; - Holm-adjusted shift and effect p-values; - every presentation must have the same number of runs; - labeled accuracy comes from ObjectiveScorerMetrics, under the registry's definitions, instead of single-trial accuracy; - num_repeats defaults to 3. Removed: t intervals, ranges, flip directions, consistent-rate and alpha fields, gold_labels, and PresentationKind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Build the human-score matrix before scoring in both evaluate_dataset_async methods, so ragged human scores fail before any scoring call, as on main. Add regression tests that no scoring call is made. - Remove compute_scorer_stability's unused reference= parameter. - Say that one presentation's failures leave other comparisons' counts, rates and unadjusted p-values unchanged, and that Holm-adjusted p-values depend on every presentation's p-value. - Test the forwarding of num_permutations and seed, reference_num_undetermined_items, and the judge-settings check on a wrapped scorer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Richard Lundeen (richlundeen)
approved these changes
Nov 25, 2026
Richard Lundeen (richlundeen)
left a comment
Contributor
There was a problem hiding this comment.
Automated review completed. No blocking concerns remain. This review records source coverage; merging is handled separately.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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
Scorer metrics say how often a scorer agrees with human labels. This adds the check that needs no labels: does the scorer give the same verdict when the same question is put to it another way?
ScorerStabilityEvaluatorscores the same responses under several presentations (option order, label wording, a rubric paraphrase, field order, formatting of the prompt) and reports how the verdicts and the reported rate move.A raw flip count overstates the effect, because a scorer that samples also disagrees with itself when nothing changes. So every presentation is scored more than once and the result is split:
For one response, if the scorer answers true with chance
aunder the reference andbunder the presentation, the presentation effect is(a - b) ** 2, averaged over responses. It is zero for a scorer that ignores the presentation, however noisy, and equals the flip rate for a scorer that repeats itself.ScorerPresentationis a named scorer already configured for one way of asking. Anything a scorer's constructor accepts can be a presentation (prompt_format_string,system_prompt_template, a rewordedTrueFalseQuestion). A presentation with the reference's configuration, or with different judge settings (model, temperature, top_p), is rejected when the evaluator is builtflip_rate,repeat_flip_rate,presentation_effect, andpositive_rate_shift, which is how far the reported rate moves. A presentation can reverse many verdicts and leave the rate where it was, so the two are reported and tested separatelypositive_rate_shiftis how far the attack success rate moves under that presentationevaluate_conversations_async, on conversations already in memory such as an attack's. With an OBJECTIVEHumanLabeledDatasetit also gives each scorer theObjectiveScorerMetricsthatObjectiveScorerEvaluatorreports for it with the same trialscompute_scorer_stabilitycomputes the same metrics from recorded verdicts without calling a scorer, andto_json()writes every verdict with the metricsScorerEvaluator's trial loop, oneObjectiveScorerEvaluatorper scorer, and every presentation is scored once before any is scored again, so drift in a judge over time falls on all of them alikeDemonstration
With a judge that reads only the first line of its prompt, giving
SelfAskRefusalScoreraprompt_format_stringthat puts the response before the objective moves the reported rate from 0 to 0.4, all of it presentation effect.The tests also give the evaluator scorers whose answer is known. A simulated scorer that is noisy but ignores presentation flips on a third of run pairs and shows an effect of zero. A planted effect of 0.075 is recovered where the raw flip rate reads 0.21. A scorer that reverses 10% of its verdicts, as many each way, is found by the effect test while the shift test reports that the rate did not move.
Related
#2168 proposes policy invariance testing for scorers, following Weng, Feng and Xie (arXiv 2605.06161). A rubric rewording is one kind of presentation here, so this is the evaluator and the metrics in general form. Generating rewordings is not part of this PR. That issue notes that subtracting pairwise jitter from a flip rate measured against a majority anchor is a mismatched baseline. Here both terms count pairs of single runs, so the split is exact.
This comes out of Parallax, my project on how far a safety score moves when only the grader's presentation changes.
Documented in
doc/code/scoring/scorer_stability.md, with both sources it draws on added todoc/references.bib.