FEAT: report harm scorer error split by inter-rater agreement - #2722
Open
WatchTree-19 wants to merge 1 commit into
Open
WatchTree-19 wants to merge 1 commit into
WatchTree-19 wants to merge 1 commit into
Conversation
Implements microsoft#2628. A harm scorer is evaluated against one gold label per response. Where that label is the median of several human raters, the aggregate MAE hides how much the raters disagreed. On violence_multi_score.csv nearly a third of the binary harmful/not labels are a 2-1 split, so a scorer marked wrong on those rows was outvoted by one human rather than overruled by a consensus, and a scorer near chance on exactly those rows can still look strong overall. HarmScorerEvaluator now also reports the MAE over unanimous responses (every rater on the same side of 0.5) and over contested responses (a split across 0.5), with the counts of each and the threshold used. The split is only computed when a gold set has more than one rater; single-rater sets report None rather than a trivially unanimous split, because there is no disagreement there to measure. Nothing existing moves. The aggregate MAE is untouched and is the row-weighted average of the two strata, and metrics files written before these fields still load. The pretty printer shows the two rows when they are present and the scorer metrics page documents them. On the shipped multi-rater gold sets the split lands as 129 unanimous and 58 contested for violence, 164 and 35 for hate speech, and 11 and 4 for the hate speech mini set. Written with AI assistance.
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
Implements #2628.
A harm scorer is evaluated against one gold label per response. Where that label is the median of several human raters, the aggregate MAE hides how much the raters disagreed. On
violence_multi_score.csvnearly a third of the binary harmful/not labels are a 2-1 split (58 of 187), so a scorer marked wrong on those rows was outvoted by one human rather than overruled by a consensus. The measurement in #2628 shows why that matters: out of fold, the violence classifier from #2626 is at 86.0% on unanimous rows and 51.7% on contested ones, and the single aggregate figure of 75.4% says nothing about that gap.HarmScorerEvaluatornow also reports the MAE over unanimous responses (every rater on the same side of 0.5) and over contested responses (a split across 0.5), with the count of each and the threshold used, as five new optional fields onHarmScorerMetrics:contested_thresholdnum_unanimous_responses,num_contested_responsesmean_absolute_error_unanimous,mean_absolute_error_contestedThe split is only computed when a gold set has more than one rater. Single-rater sets report
Nonerather than a trivially unanimous split, because there is no disagreement there to measure, which is the other half of #2628.Nothing existing moves. The aggregate
mean_absolute_erroris untouched and is the row-weighted average of the two strata, so every number in the shipped*_metrics.jsonlfiles is unchanged. Metrics files written before these fields still load, sincefrom_json_filealready tolerates absent keys. The pretty printer shows the two rows when they are present, and the scorer metrics page documents them.On the shipped multi-rater gold sets the split lands as 129 unanimous and 58 contested for violence, 164 and 35 for hate speech, and 11 and 4 for the hate speech mini set, matching the audit table in #2628.
Tests and Documentation
tests/unit/score/test_scorer_evaluator.pygains four tests: the split on a mixed gold set, including that the aggregate equals the row-weighted average of the strata;Nonefor a single rater;Nonefor the contested stratum when no rows are contested; and that a metrics file written before these fields still loads. All four fail on an unpatched tree withAttributeError.tests/unit/output/scorer/test_pretty.pygains two: the rows print when present and are absent for a single rater.Verified against upstream main
0ac4526: 71 passed intest_scorer_evaluator.pyand 86 across it andtest_pretty.py.ruff checkandruff formatclean on every touched file. mypy reports the same 134 pre-existing errors before and after, none in the touched files. The notebook4_scorer_metrics.ipynbround-trips through jupytext against its.pywith only the tool version stamp differing.Written with AI assistance.