Skip to content

Combine subtask stderrs in quadrature for the _average and all rows - #1468

Open
Andreas-Hum wants to merge 1 commit into
huggingface:mainfrom
Andreas-Hum:fix-group-stderr
Open

Andreas-Hum wants to merge 1 commit into
huggingface:mainfrom
Andreas-Hum:fix-group-stderr

Conversation

@Andreas-Hum

Copy link
Copy Markdown

Fixes #1466

What

The _average rows (e.g. mmlu:_average|5) and the all row report the arithmetic mean of the subtask stderrs as the stderr of the averaged score. These rows are unweighted means of G subtask scores computed on disjoint question sets, so the standard error of the average is sqrt(sum_i se_i**2) / G. lm-evaluation-harness's unweighted_mean_stderr uses the same formula. With the 57 MMLU subjects, the current value is about 7x too large: 0.0345 instead of 0.0047 in the example in the issue, which matches a Monte Carlo over fresh question draws.

This PR changes MetricsLogger.aggregate to add the _stderr values in quadrature for the _average rows and for all. Point estimates are unchanged.

For all, this assumes the tasks in a run are evaluated on different samples. That holds unless the same benchmark appears twice, e.g. at two few-shot settings.

Tests

  • New tests/unit/logging/test_info_loggers.py checks both rows against sqrt(sum_i se_i**2) / G. It fails on current main and passes with this change.
  • pytest tests/unit/logging: 9 passed, 1 skipped.
  • ruff check and ruff format --check (ruff 0.11.10, as in .pre-commit-config.yaml) pass on the changed files.

The stderr of the _average and all rows was the arithmetic mean of the
subtask stderrs. These rows are unweighted means of G subtask scores
computed on disjoint samples, so the standard error of the average is
sqrt(sum_i stderr_i**2) / G. For the 57 MMLU subjects the mean of the
stderrs is about 7x too large. Point estimates are unchanged.

Fixes huggingface#1466
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.

[BUG] Stderr of _average and all rows is the mean of the subtask stderrs (about 7x too large for MMLU)

1 participant