Skip to content

feat(eval): plan benchmark and suite repeat counts - #5857

Merged
mpatel31415 merged 21 commits into
NVIDIA-NeMo:mainfrom
mpatel31415:mpatelka/eval-repeat-planning
Nov 17, 2026
Merged

mpatel31415 merged 21 commits into
NVIDIA-NeMo:mainfrom
mpatel31415:mpatelka/eval-repeat-planning

Conversation

@mpatel31415

@mpatel31415 mpatel31415 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Use gym eval plan-repeats --plan planning.yaml to plan benchmark, model, or suite repeat budgets before running evaluation benchmarks with Gym. Keep existing baseline counts fixed or optimize baseline investment across distinct candidate checkpoints, defaulting to one candidate. Inputs support legal repeat increments and common-unit per-pass costs.

Each model × benchmark entry supplies one normalized complete-pass score SD; an omitted candidate SD defaults to its baseline SD forecast, and entries have equal aggregate weight. The walkthrough shows normalization and averaging within each repeat before estimating SD, including a three-repeat SD-0.9 example, baseline reuse, and the matching final comparison decision.

The prospective noncentral-t calculation shares Gym's Welch uncertainty implementation. The power function documents the exact equations and links to NCSS, NIST, and SciPy references; the scalar search uses descriptive names and goal comments for each algorithm section. Scalar allocation finds an exact bounded integer minimum by evaluating noncentral-t power directly. Scalar count bounds and repeat steps stay as numbers; the same power calculation also evaluates batches for suite allocation. Suite allocation reports a feasible local solution without a global minimum claim. Optional simulation evaluates Gym's actual Welch decision and reports power and boundary false-success rates without changing counts. It redraws both arms in hypothetical normal experiments, including existing-baseline mode; it is not conditioned on the collected baseline observations.

No separate issue: this is a focused feature addition with its input contract and examples documented here. Existing comparison commands and report formats are unchanged.

Validation

  • Broad regression: 2,393 passed plus 24 subtests (35 warnings) with .venv/bin/python -m pytest tests/unit_tests/eval/ tests/unit_tests/test_public_api_facades.py tests/unit_tests/cli/test_cli_main.py tests/unit_tests/cli/test_cli_eval.py tests/unit_tests/test_fern_docs_links.py -q --no-cov --tb=short.
  • Final focused numerical/CLI/Gym-Welch regression: 152 passed, including independent exhaustive allocation oracles, nonmonotonic power, explicit zero candidate SD, legal increments, frozen baseline counts, and overflow validation.
  • Local-only independent audit: 18 tests passed; 651 frozen-design formula checks (642 benchmark and nine aggregate), maximum power difference 1.11e-15; 107 shared-baseline plans / 214 matching optimized arm counts; four exhaustive scalar checks passed. Audit tools and evidence are retained locally, outside the PR.
  • Seven local CLI demos passed, including saved GPQA/AA-LCR inputs and 48-candidate baseline reuse. Unchanged-input numerical results match exactly. The SD-0.9 example retains 18 new passes and 91.87% analytic power.
  • The documented Python example and scalar YAML were checked. cd fern && npm run check: zero errors; the authenticated missing-redirect check is unavailable locally.
  • pre-commit run --all-files, including Ruff and package layering: passed.
  • Independent read-only Claude Code review with opus[1m] (resolved claude-opus-5-5) and literal --effort max: completed. Addressed count-array dtype, scalar clamp compatibility, and the final naming findings. The review confirmed the formula citations and all six scalar-search section comments. Added regressions for exactly representable large baseline counts/caps and overflow in both scalar and suite paths.

Formula parity replays the reference's frozen counts and weights; it does not require joint optimization to reproduce its equal-arm allocations. Product suites weight entries equally; some reference aggregates weight models equally. The audit also preserves a small-count case with approximately 84% analytic power and 62% actual Welch power, so formula agreement is not presented as an achieved-power guarantee.

Rollout evidence: N/A for new model execution. This adds an offline statistical command and changes no agent, environment, scorer, or existing benchmark results. Saved real rollout artifacts were used for end-to-end validation; no inference or GPU jobs were launched. The implementation is independent, with no external executable code imported or vendored.

@copy-pr-bot

copy-pr-bot Bot commented Nov 9, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@mpatel31415
mpatel31415 marked this pull request as ready for review November 9, 2026 15:14
@mpatel31415 mpatel31415 added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Nov 9, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 9, 2026 15:15
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP WITH CARE

Two RISK findings: multi-metric plans silently discard within-repeat covariance, and the saved-report exporter can emit an invalid empty plan while the audit reports success.

I reviewed all 23 changed paths and traced the affected contracts through the existing Welch comparison and suite-report producer. Validation was static; I didn't execute tests or independently verify the PR's reported test results.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

Comment thread scripts/validate_repeat_planning.py Resolved

@AdamRajfer AdamRajfer 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.

🤖 Adam’s AI assistant
I reviewed this PR for Adam.

Verdict: COMMENT. The power math is sound and reproduces under my checks, CI is green and the tests pass. What is missing is guardrails: the command can report 80% power in cases where the real chance of success is much lower, and the PR is large for an offline calculator.

Thanks for the long wait on this, Martyna. The earlier multi-metric covariance concern is resolved: the input is now one composite SD per cell, and the docs explain how to compute it. Findings in order of severity:

  1. Several candidates: "80% power" is per comparison, but the cost is for all of them. nemo_gym/eval/comparison/statistics/repeat_planning.py:82 and nemo_gym/eval/comparison/planning/schema.py:77. With candidate_experiments: 5 and 80% power each, the chance that all five pass is about 33% (about 11% for ten), and there is no familywise alpha correction. The report says "power describes one candidate comparison", but the summary line only shows the single number. Fix: print the joint power for all K candidates next to it, and add an optional Bonferroni-style alpha (alpha/K) so the plan can target a family-wise decision.

  2. The SD is treated as exact, and the usual input is 3 repeats. nemo_gym/eval/comparison/planning/runner.py:69-75 and schema.py:49-63. The 95% interval for an SD estimated from 3 repeats spans roughly 0.5x to 6x the estimate. I ran the plan for SD 0.9 (12 baseline, 10 candidate repeats, 80% planned): if the true SD is 1.35 the power is 51%, and at 1.8 it is 35%. The docs say the simulation ignores this, but the report still gives one confident number. Fix: add a sensitivity table (power at 1.5x and 2x the SD) or an optional upper-confidence-bound SD from the chi-square interval, and show it in the Markdown report.

  3. Suite search can fail or stop short on large inputs. repeat_planning.py:458-527. The local search uses fixed caps (1,000 improvement rounds, 4 exchange partners, 20 steps, 20,000 repair loops) and raises "exceeded its finite ... search" when they are hit. A suite with dozens of cells and a large max_repeats can therefore fail with no plan, even though a feasible allocation was already found. Fix: return the best feasible allocation found so far with the method label saying the search was truncated, and add a test with a 48+ cell suite near the caps.

  4. Nothing ties the plan to real runs or recovered runs. schema.py:63. existing_baseline_repeats is typed in by hand. A resumed or recovered run can leave a partial repeat, and the docs do not say that only complete repeats count. Over-counting makes the planner under-buy candidate repeats. Fix: add one docs sentence (count and SD use only complete repeats of the finished run), and optionally a cross-check helper that reads the counts from the run's saved aggregate file.

  5. Size. 2,600 added lines for an offline planner: a 670-line statistics module, a new agent skill, a 210-line tutorial and a 129-line reference page that overlap, plus the index edits. The simulation and the suite heuristic are the parts that carry the most review and maintenance cost. Suggestion: land the scalar planner, CLI and one doc page first, and move the suite heuristic and skill to a follow-up, or cut the tutorial down to a link.

Not verified: the NCSS and NIST formula references, and the full broad regression the PR describes. I ran the PR's two new test files (102 passed), plus my own numerical probes.

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 17, 2026 14:00
@mpatel31415

Copy link
Copy Markdown
Contributor Author

Thanks for the review and for independently checking the calculations. Responding to the five points in your review:

  1. Several candidates and the power claim. The requesting team and I agreed on marginal power for each comparison, with total cost covering one shared baseline and all K candidate evaluations. This does not promise a simultaneous all-candidates result. Because the comparisons share a baseline, they need not be independent; 0.8**K is therefore not generally their joint power. Family-wise false-positive control is a separate objective; Bonferroni can be conservative and substantially increase the required repeats. We can track that objective, its reporting, and its validation in a separate follow-up. It does not block the team's agreed use case.

  2. Uncertainty in the supplied SDs. Agreed: the power estimates are conditional on the supplied variability forecasts, which may be uncertain when based on few historical repeats. Users can assess sensitivity of the repeat budget with the existing command by rerunning it with plausible alternative SD forecasts and comparing the recommended counts. I have added a note to the Markdown report stating that planning and simulation hold the SDs fixed, that actual variability may differ, and that simulation intervals do not account for uncertainty in those forecasts. It explicitly recommends sensitivity reruns when the SDs are uncertain. This revision adds that clarification without adding automatic sensitivity tables or SD confidence-bound options.

  3. Suite-search limits. These are real limits of the bounded heuristic, and the improvement limit can indeed raise after a feasible allocation has been found. I am keeping the current explicit-failure behavior for this PR. I would revisit the limits with a concrete workload that reaches them at the scale the requesting team needs. Returning a truncated result would need a clear result/status contract and targeted validation, which I would handle separately.

  4. Counts, SDs, and run provenance. This command intentionally accepts human-provided numerical summaries. The existing input contract defines a repeat as a complete pass and the SD as variability across those complete-pass scores. That requirement applies to the existing baseline count as well, including data from recovered runs: incomplete or invalid repeats must be excluded from both summaries. The planner cannot verify run provenance from scalar inputs. Run ingestion, recovery-aware counting, and cross-checking aggregate artifacts remain outside this PR.

  5. Size and scope. I understand the review and maintenance cost. Benchmark and suite planning are both part of the requested workflow, and the simulation is the diagnostic that exposes the approximation's limitations alongside the planned counts. A substantial part of the diff is behavioral tests, examples, and explanatory documentation. The reference defines the input and statistical contract; the tutorial provides a runnable walkthrough. I am keeping that structure and the current feature scope, and limiting this revision to the SD-forecast clarification in the report.

Validation for this report-only change: 51 CLI tests passed, and pre-commit passed. A fresh run of the checked-in benchmark example produced identical numerical JSON; only the Markdown explanation changed.

@AdamRajfer AdamRajfer 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.

🤖 Adam’s AI assistant

I reviewed this again for Adam. The SD-forecast note in the report helps, and with the docs now saying plainly there's no simultaneous guarantee, marginal power per comparison is fine. Joint power and a sensitivity table can come in a follow-up. Failing visibly on the search caps is OK for now; worth revisiting if a real suite hits them. Approving.

@mpatel31415
mpatel31415 added this pull request to the merge queue Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

Merged via the queue into NVIDIA-NeMo:main with commit 1ca6226 Nov 17, 2026
73 of 77 checks passed
@mpatel31415
mpatel31415 deleted the mpatelka/eval-repeat-planning branch November 17, 2026 16:23
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 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