Skip to content

FEAT: Add compute_outcome_repeatability for outcome agreement across reruns - #4652

Open
Adam Amzar (ADAMAMZAR) wants to merge 1 commit into
microsoft:mainfrom
ADAMAMZAR:feat/outcome-repeatability
Open

Adam Amzar (ADAMAMZAR) wants to merge 1 commit into
microsoft:mainfrom
ADAMAMZAR:feat/outcome-repeatability

Conversation

@ADAMAMZAR

Copy link
Copy Markdown

Description

Adds compute_outcome_repeatability, which compares two or more separately executed runs of the same scenario configuration and reports, for each objective planned in all of them, whether the attack always succeeded, always failed, or changed between runs. It ports the logic of ASSERT's compute_repeatability. Closes #4651.

  • New pyrit/analytics/outcome_repeatability.py, exported from pyrit.analytics, returns a frozen OutcomeRepeatability with run_count, overall and by_technique counts (OutcomeRepeatabilityCounts).
  • Runs must each have a valid saved plan and share ScenarioEvaluationIdentifier(...).eval_hash, the check resume uses; otherwise ValueError. Fewer than two runs, or the same run passed twice (which would read as full agreement), also raise.
  • Units are matched by ScenarioExecutionUnit(atomic_group_id, seed_group_id) from each plan. _select_effective_results moved from assert_policy_metrics.py into scenario_statistics.py as select_effective_attack_results(scenario_result, *, plan), keyed by unit and without the ASSERT technique naming; assert_policy_metrics.py now calls it and maps techniques itself.
  • agreement_rate, per-run success counts and rates, and rate_range use the units decided in every run. ERROR, UNDETERMINED and missing outcomes are counted instead (error_units, undetermined_units, missing_units, which may overlap), as are units planned in only some runs (partially_planned_units). Per-technique counts use technique_label, so the baseline is baseline.
  • Documented as "Compare reruns of the same scenario" next to "Compare matched baseline and attack outcomes" in 0_attack_results.md, whose "separately executed runs are not supported" line now points to it. The module docstring cites ASSERT; no text is copied.

…reruns

Compares two or more separately executed runs of the same scenario configuration and reports, for each objective planned in all of them, whether the attack always succeeded, always failed, or changed between runs, overall and per technique. Ports the logic of ASSERT's compute_repeatability.

Moves the latest-top-level attempt selection from assert_policy_metrics into scenario_statistics as select_effective_attack_results so both use it.

Closes microsoft#4651
Copilot AI balanced review requested due to automatic review settings November 26, 2026 01:22
@ADAMAMZAR

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

🟢 Approval recommended

No active review issues block the cross-run outcome repeatability analytics changes.

No open issues 🎉

What changed in this PR

Adds library-only outcome repeatability analytics for separately executed runs of the same scenario, complementing existing within-run comparisons and addressing #4651.

Changes:

  • Reports overall and per-technique agreement, per-run success rates, and excluded-unit counts.
  • Validates run compatibility and shares latest-result selection with ASSERT policy metrics.
  • Adds public exports, unit tests, and usage documentation.
File Description
tests/​unit/​analytics/​test_outcome_repeatability.py Tests agreement counts, exclusions, result selection, and input validation.
pyrit/​analytics/​scenario_statistics.py Extracts shared effective-result selection by execution unit.
pyrit/​analytics/​outcome_repeatability.py Implements cross-run comparison and report dataclasses.
pyrit/​analytics/​assert_policy_metrics.py Reuses shared selection while preserving ASSERT technique naming.
pyrit/​analytics/​__init__.py Lazily exports the new function and report types.
doc/​code/​analytics/​0_attack_results.md Documents rerun comparisons, usage, and metric definitions.

Review effort: Balanced

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.

FEAT: Add compute_outcome_repeatability analytics function (outcome agreement across reruns of the same scenario, from ASSERT)

3 participants