Skip to content

Resolve named primary metrics to their Metric instance - #453

Open
jopetty wants to merge 2 commits into
allenai:mainfrom
jopetty:resolve-named-primary-metric
Open

jopetty wants to merge 2 commits into
allenai:mainfrom
jopetty:resolve-named-primary-metric

Conversation

@jopetty

@jopetty jopetty commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

TaskConfig.get_primary_metric resolves a primary_metric given as a Metric instance, but returns None when it is given by name (a MetricName or plain string). A task left unresolved contributes nothing to a parent suite's average-of-averages, and the suite silently falls back to averaging whichever metric name its children happen to share. This PR resolves a name to the task's metric of that name.

This changes task hashes. TaskConfig.to_dict serializes the resolved primary metric, which used to be None for named primaries. I iterated the task registry and compared hashes before and after. Exactly the 78 RULER tasks change (ruler_cwe, ruler_fwe, ruler_niah_*, ruler_qa_* and ruler_vt at all sizes), because they name their primary metric "recall". No other registered task changes. New RULER results will appear as a separate task variant from earlier ones in the results views.

Split out of #281 at reviewer request. HELMET no longer depends on this change, because each HELMET task now passes its Metric instance directly.

Tests: a named primary resolves to its Metric, an unknown name resolves to None, and RULER's "recall" primary now serializes as the metric. The full unit suite passes (2984 passed, 35 skipped).

🤖 Generated with Claude Code

jopetty and others added 2 commits October 6, 2026 14:24
A MetricName or bare str primary_metric names one of the task's own
metrics, but get_primary_metric only resolved a Metric instance and
returned None for a name. A task left unresolved contributes nothing to a
parent suite's average-of-averages, which then silently falls back to
whichever metric name its children share.

This changes the task hash of the 78 RULER tasks, which name their
primary metric "recall": TaskConfig.to_dict serializes the resolved
metric where it used to serialize None. No other registered task's hash
changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Covers a string primary_metric resolving to its Metric, an unknown name
resolving to None, and RULER's "recall" primary now serializing as the
metric rather than None.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@5ef9cee). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #453   +/-   ##
=======================================
  Coverage        ?   55.33%           
=======================================
  Files           ?      446           
  Lines           ?    39894           
  Branches        ?     6270           
=======================================
  Hits            ?    22076           
  Misses          ?    16512           
  Partials        ?     1306           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants