Skip to content

feat(eval): report completion token confidence intervals - #3855

Merged
mpatel31415 merged 4 commits into
mainfrom
codex/completion-token-welch-ci
Oct 9, 2026
Merged

mpatel31415 merged 4 commits into
mainfrom
codex/completion-token-welch-ci

Conversation

@mpatel31415

@mpatel31415 mpatel31415 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Issue that would simplify this implementation.

What does this PR do?

Compute completion tokens and tokens per turn from ng_perf for each observed repeat, then use the existing repeat aggregator for their across-repeat means and confidence intervals. Comparison reads those means directly for point values and Welch differences, while keeping both rows visible when usage is unavailable.

Validation

RAY_TMPDIR=/tmp /Users/mpatelka/Projects/Gym/.venv/bin/pytest -q -o cache_dir=/tmp/gym-pytest-cache tests/unit_tests/test_aggregate_metrics.py tests/unit_tests/test_compare.py tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_fern_docs_links.py passed (541 tests, 17 subtests), and /Users/mpatelka/Projects/Gym/.venv/bin/pre-commit run --all-files passed. The Fern CLI check could not resolve its version in this local runtime (fetch failed); the documentation-link tests passed, and CI will run the Fern check.

Rollouts

Two live example_single_tool_call runs of five tasks × three repeats produced 30 healthy rollouts with zero failures; all 15 rollouts in each run recorded ng_perf completion tokens and turn counts. I reran aggregation and comparison using those saved real rollouts, and the Markdown and JSON reports contain numeric Welch difference intervals for both token metrics.

Compatibility and benchmark impact

No benchmark recipe, agent harness, or observability collector changes are needed; both metrics use the same observed ng_perf token evidence and may be partial when model-call usage is missing. The path supports FN100 Sprint, MRCR-1M, RULER-128k, and RULER-1M when runs emit ng_perf and have at least two observed repeats; SciCode and Tau3 rely on the announced upstream observability work, and the named benchmark suite was not run locally.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@mpatel31415 mpatel31415 added feature New capabilities, enhancements, or enablement work area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters needs-review PR is ready for code review and waiting on a reviewer labels Oct 1, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 1, 2026 08:15
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

@mpatel31415
mpatel31415 force-pushed the codex/completion-token-welch-ci branch from fad91be to c431f6f Compare October 1, 2026 08:38
@mpatel31415
mpatel31415 force-pushed the codex/completion-token-welch-ci branch from c431f6f to 562f50f Compare October 1, 2026 08:45
@mpatel31415
mpatel31415 force-pushed the codex/completion-token-welch-ci branch from 562f50f to 9be01c5 Compare October 1, 2026 11:03
@mpatel31415
mpatel31415 force-pushed the codex/completion-token-welch-ci branch from 99660a5 to 43c5072 Compare October 2, 2026 10:16
@mpatel31415
mpatel31415 force-pushed the codex/completion-token-welch-ci branch from 43c5072 to 3c8e10d Compare October 2, 2026 10:23
@mpatel31415
mpatel31415 force-pushed the codex/completion-token-welch-ci branch from 3c8e10d to cb41485 Compare October 2, 2026 10:28
@mpatel31415
mpatel31415 force-pushed the codex/completion-token-welch-ci branch from cb41485 to 1d3dc80 Compare October 2, 2026 10:53

@marta-sd marta-sd 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.

My agent flagged some unintended effects outside of the diff:

  1. Spurious "incomplete or unequal task coverage" warning (nemo_gym/reward_profile.py, _add_completion_token_metrics)
  • Cause: when a repeat has ng_perf but no scored rows (all masked), the function creates a new repeat row holding only _ng_rollout_index and the token values. That row has no
    sample_count or missing_count; those keys are set only at reward_profile.py:287-288.
  • Effect: _warn_if_repeat_samples_differ (diff.py:98) collects sample_count across repeat rows. The new row contributes None, so the set has more than one value. Comparing any run
    with a masked-only repeat then emits "has incomplete or unequal task coverage across repeats; delta confidence intervals may mix task-difficulty differences with repeat variance".
    That warning is about quality coverage and is wrong here.
  • Test gap: test_masked_only_repeat_contributes_usage_but_not_quality produces such a row but never goes through compare, so it doesn't catch this.
  • Fix: make the warning ignore rows without sample_count, or keep token rows out of repeat_level_metrics. The second option would need a separate field for the Welch step.
  1. Token placeholder rows always appear, and the empty-state message is now dead (diff.py, report.py)
  • compare_runs appends two key-metric rows (mean_completion_tokens, mean_tokens_per_turn) to every comparison, even for benchmarks and runs with no ng_perf. Every report then shows
    two all-"—" rows in "Key metrics", and render_key_metrics_tables shows them too (the test change at test_compare.py:1246-1255 encodes this).
  • The "No key metrics were recorded for this agent." branch can no longer be reached for comparisons.
  • This is deliberate (the PR says it keeps both rows visible when usage is unavailable), but I'd drop the placeholders when neither side has data, or at least remove the dead branch.

Other than that looks good 👍

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37910445169

This branch was previously deployed

1 inactive deployment
public — 88feb5bd Deployed Oct 9, 2026 by copy-pr-bot[bot] via release / finalize / notify #4841
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters complexity:medium Single-domain change with interacting parts or a moderate review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants