Skip to content

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
microsoft:mainfrom
WatchTree-19:feat/scorer-presentation-stability
Queued

WatchTree-19 wants to merge 6 commits into
microsoft:mainfrom
WatchTree-19:feat/scorer-presentation-stability

Conversation

@WatchTree-19

@WatchTree-19 WatchTree-19 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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? ScorerStabilityEvaluator scores 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:

flip rate = repeat flip rate + presentation effect

For one response, if the scorer answers true with chance a under the reference and b under 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.

  • ScorerPresentation is 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 reworded TrueFalseQuestion). A presentation with the reference's configuration, or with different judge settings (model, temperature, top_p), is rejected when the evaluator is built
  • Per presentation: flip_rate, repeat_flip_rate, presentation_effect, and positive_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 separately
  • With an objective scorer on the responses of an attack, positive_rate_shift is how far the attack success rate moves under that presentation
  • Two permutation p-values per presentation, with no assumption about the scorer: one for the effect (the runs of a response are reassigned between the two presentations) and one for the shift (the exact sign test when each presentation ran once). Both are Holm-adjusted across the presentations of one evaluation, and every presentation runs the same number of times
  • Runs without labels through evaluate_conversations_async, on conversations already in memory such as an attack's. With an OBJECTIVE HumanLabeledDataset it also gives each scorer the ObjectiveScorerMetrics that ObjectiveScorerEvaluator reports for it with the same trials
  • A run with no verdict removes the response from the comparisons it belongs to and is counted per presentation, never scored as false. One presentation's missing verdicts change no other presentation's counts, rates or unadjusted p-values, nor the reference's figures; the Holm-adjusted p-values depend on every presentation's p-value
  • compute_scorer_stability computes the same metrics from recorded verdicts without calling a scorer, and to_json() writes every verdict with the metrics
  • Scoring runs through ScorerEvaluator's trial loop, one ObjectiveScorerEvaluator per scorer, and every presentation is scored once before any is scored again, so drift in a judge over time falls on all of them alike

Demonstration

With a judge that reads only the first line of its prompt, giving SelfAskRefusalScorer a prompt_format_string that 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 to doc/references.bib.

…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.
Copilot AI balanced review requested due to automatic review settings November 17, 2026 20:39

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.

🟡 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

@WatchTree-19
WatchTree-19 deleted the feat/scorer-presentation-stability branch November 17, 2026 20:47
@WatchTree-19
WatchTree-19 restored the feat/scorer-presentation-stability branch November 17, 2026 20:53
@WatchTree-19 WatchTree-19 reopened this Nov 17, 2026
…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>

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.

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>
@richlundeen
Richard Lundeen (richlundeen) added this pull request to the merge queue Nov 25, 2026

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.

3 participants