Repository navigation
fix(metrics): name numeric dimensions in metric labels - #1856
Merged
Yunnglin merged 3 commits intoOct 15, 2026
Merged
Conversation
Metric labels joined dimension values without their keys, so a needle_haystack cell read `Accuracy ↑ · 1000 · 0` and an openai_mrcr bucket `Score ↑ · 8192 · 4096`. Word values such as `Overall` or `Answer` read fine on their own, numbers do not. `format_metric_label` and the frontend `formatMetricIdentityLabel` now put a short axis name before the numeric dimensions: context_length (Context), depth_percent (Depth), min_tokens and max_tokens (Min tokens, Max tokens), threshold (Threshold), ngram (n-gram) and k (k). Every other dimension keeps its bare value. max_tokens now sorts after min_tokens, so a token range reads lower bound first. Only the display text changes; identities, cache keys and scores are untouched. The web report Details tab labelled its rows by metric name only, so the needle_haystack cells showed `Accuracy ↑ (accuracy:mean[...])`. `formatMetricLabels` now mirrors the backend `format_metric_labels`: it labels each identity and adds the identity key only when a label repeats. The report page passes these labels to the Details tab, which now matches the CLI table and the HTML report. The dashboard's aggregated results table still shows only the primary metric name and is left for a follow-up. The shared golden samples pin the new labels for both implementations, and the example tables in the docs show the new BLEU, ROUGE and tau labels. Fixes modelscope#1854
accuracy + pass_hat_k now resolves to metric_name="Pass^k" instead of sharing "Pass@k" with pass_at_k. Only the display name changes; the semantic_id stays quality.pass_at_k.ratio and no cache or score is affected. Changes: - catalog.py: AGGREGATION_SEMANTICS entry for (accuracy, pass_hat_k) now carries metric_name="Pass^k". - golden_samples.json: new pass_hat_k semantics entry and label sample. - test_resolver.py: parametrized test covers both aggregation names. - docs tau_bench/tau2_bench (en+zh): example tables now show Pass^k.
The text-block grid tables had misaligned column separators since before this PR. A script now computes the max content width per column and rebuilds every separator line to match, across all 10 affected doc files (en + zh).
Yunnglin
approved these changes
Oct 15, 2026
Yunnglin
left a comment
Collaborator
There was a problem hiding this comment.
LGTM — the original dimension-label fix is clean and well tested; the two follow-up commits add:
- Pass^k display name:
accuracy + pass_hat_know resolves tometric_name="Pass^k"(catalog.py override), so tau_bench / arc_agi_2 showPass^k ↑ · k 1instead of the misleadingPass@k ↑ · k 1. semantic_id unchanged, no cache/score impact. - Table alignment: all 24 grid tables across the 10 doc files now have separators matching the widest cell per column.
Local verification: 875 Python tests passed (tests/report/semantics full suite), 41 vitest passed (metricFormat.test.ts), ruff clean. CI green on all three commits.
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.
Fixes #1854
Summary
format_metric_labeland its frontend mirrorformatMetricIdentityLabeljoined dimension values without their keys, so numeric dimensions lost their meaning (Accuracy ↑ · 1000 · 0). Both now look the key up in a small axis-name table and renderLabel value:context_length,depth_percentmin_tokens,max_tokensthresholdngramkThese are the only numeric keys that adapters, aggregators and the legacy name rules emit today. Every other dimension (
scope,target,level,variant,statistic,question_type,task,topic, ...) keeps its bare value.The metric names come from the catalog, so they differ from the examples in the issue: openai_mrcr is
Score ↑(quality.score.ratio), notMRCR Score ↑, and pass@k isPass@k ↑ · k 1. This PR only adds the axis names.The sort order is the same except for one entry:
max_tokensnow sorts aftermin_tokens(the alphabetical tie-break put it first), so the openai_mrcr bucket reads lower bound first as in the issue. Only display text changes;MetricIdentity, identity keys, the cache and scores are untouched, so there is noevaluation_versionbump.All three surfaces
The CLI table (
gen_table) and the HTML report already labelled metrics throughformat_metric_labels. On the web, the report header, Overview and Compare useformatMetricIdentityLabel, but the Details tab, the only web view that lists the needle_haystack cells, labelled rows by metric name only and showedAccuracy ↑ (accuracy:mean[context_length=1000,depth_percent=0]).formatMetricLabelsnow mirrorsformat_metric_labels: it takes identities, labels each one withformatMetricIdentityLabel, keys the result by identity key and appends the key only when a label repeats.ReportDetailPagebuilds these labels from the report's metrics and passes them toDetailsTab, which now showsAccuracy ↑ · Context 1000 · Depth 0like the CLI table and the HTML report. The dimension order table inmetricFormat.tsalso became a module-levelMap, like the new label table.The dashboard's aggregated results table (
AggregatedResults.tsx) still labels each row withformatMetricLabel, so it shows the primary metric name without dimensions (Accuracy ↑). It never showed bare numbers, so I left it for a follow-up.The example tables in
docs/{en,zh}(custom dataset LLM and VLM, tau_bench, tau2_bench, arena) now show the new dimension text (BLEU ↑ · n-gram 1,ROUGE ↑ · n-gram 1 · Recall,Accuracy ↑ · k 1); nothing else in those tables changed.Validation
golden_samples.json:label-single-dimension(threshold=0.5) now expectsAccuracy ↑ · Threshold 0.5, and four new label samples cover a needle_haystack cell, the openai_mrcr token range (with thequality.score.ratioentry added to the registry), wide_search'sknext to word dimensions, andngramwithstatistic.test_golden_samples.pyand the vitest golden test both read them, and the coverage check now requires a label sample for every key in the axis-name table.test_formatting.pyandmetricFormat.test.tsadd the same five cases;metricFormat.test.tsalso covers the newformatMetricLabels, andDetailsTab.test.tsxrenders needle_haystack rows and expectsAccuracy ↑ · Context 1000 · Depth 0.Results (Windows):
A needle_haystack report built through the adapter (
calculate_metrics,aggregate_scores,generate_report; no dataset, tokenizer or model) prints this ingen_table; the HTML report and the dashboard's Details tab (built SPA served byevalscope service) show the same labels. On main the cells readAccuracy ↑ · 1000 · 0in the CLI and HTML andAccuracy ↑ (accuracy:mean[...])in the Details tab.