Skip to content

fix(nightly): check nano35 logprob-error tails at every step - #4593

Draft
fujial-code wants to merge 3 commits into
mainfrom
fujial/nano35-per-step-logprob-checks
Draft

fujial-code wants to merge 3 commits into
mainfrom
fujial/nano35-per-step-logprob-checks

Conversation

@fujial-code

@fujial-code fujial-code commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Check logprob-error tails at every step of the Nano 3.5 DAPO nightly. A few finite outliers dominate the existing mean of exp(abs(logprob error)), making the final-step and median-of-step-means assertions unreliable. Adapt Jonas Yang's metrics from #4459 to require both conditions at each of steps 1–20:

Metric Per-step limit Purpose
num_tokens_logprob_error_above_10_nats ≤3 Limit severely mismatched loss tokens. Exactly 10 nats is excluded from the count.
token_mult_prob_error_p999 <1.55 Detect broader mismatch below the severe cutoff. This probability multiplier corresponds to a nearest-rank logprob-error percentile below ln(1.55) ≈ 0.4383 nats.

Check all steps together after training, requiring both metrics at exactly steps 1–20 and finite values. Any NaN/Inf error on a valid loss token now makes the percentile infinite: a single non-finite token must not disappear into the excluded 0.1% tail or fit under the severe-token allowance. Masked-out values remain excluded. This does not introduce a training-time abort.

Keep 20 training steps, the 240-minute limit, step-20 accuracy >0.4, and mean generation KL <0.001. Retain #4459's correction to the worst-sample plot, which previously selected samples with no loss tokens.

Threshold evidence

#4459 reports P99.9 of 1.407–1.501 and 0–2 severe tokens per step in two 20-step runs. I additionally reconstructed both metrics from all 60 saved training batches of the three complete 4×8 H100 Nano runs used for #4569 validation:

Configuration Training job Steps P99.9 range Maximum severe tokens/step Step-20 accuracy
Eager control 19905486 20 1.402301–1.489507 1 0.453125
PIECEWISE 19898229 20 1.403050–1.463649 1 0.433594
PIECEWISE repeat 19905487 20 1.394521–1.496258 2 0.449219

These are new offline measurements of existing GPU runs, not newly launched training runs of this PR. The runs used rl.72105789.sqsh; the eager source was 8bf6bd4bafc05ca29cf34981ad9c378fa38db72d and PIECEWISE source was 70ebabebad4817bf532bee4244b964d7e9080d72. The eager recipe differs from this PR's recipe only in the dtensor_cfg → automodel_cfg rename, but source/dependency revisions differ. Treat the modes separately; they are not three identical repeats of the current PR.

Reconstruction uses float32 subtraction, the serialized token_loss_mask * sample_loss_mask, and nearest-rank P99.9. It covers 77,400,772 valid tokens, with 1,069,905–1,612,237 per step. Reconstructed mean probability error agrees with the original logged metric within 2.52e-7 relative error, independently checking masking/alignment. All eight actual nightly expressions pass on each reconstructed run.

The severe-token counts were zero at 50 steps, one at nine steps, and two at one step. A cap of one rejects an observed step; caps of two, three, five, and ten all pass these observations. Keep three as the existing proposal: the observed maximum of two plus one token of headroom. There is no measured need to loosen it to ten. Likewise, 1.55 leaves margin above both the reconstructed maximum (1.4963) and #4459's reported maximum (1.501); a 1.50 gate would reject the latter. These are empirical recipe-specific bounds, not a statistical guarantee of a nightly failure rate. Recalibrate if token volume, runtime, or model configuration changes.

Both PIECEWISE runs failed the old final-step mean gate and pass these tail gates. This is the intended tolerance for a small number of finite spikes; it does not establish numerical equivalence of eager and graph execution or prove the spikes harmless.

Validation

  • Current head 233f48cc44b59dad2ce55b75c64b1dae8ad3cd7c merges main d8b376aa. Fresh CI run: branch freshness, lint, documentation build/linkcheck, and automatic test approval pass. H100 image build is queued awaiting the nemo-ci-aws-gpu-x2 runner; the full CI result is pending.

  • Current-head CPU preflight: 466 passed, 1 skipped (CUDA unavailable), job 19952832. Image rl.72628646.sqsh matches this checkout’s uv.lock, pyproject.toml, and Automodel submodule (72daceffa54d77783e1f73a5ac165eb39b6b5ea1).

  • Full 4×8 H100, 20-step nightly submitted as job 19952844, with a 240-minute allocation. Its preflight completed successfully; the job is pending Slurm resource scheduling (Priority). It uses the unchanged recipe and all eight nightly gate expressions; only external W&B upload is disabled. GPU results remain pending.

  • Existing head 437be364393a731e22624331122635c10d6e350d: latest CI run has 42 successful and 10 skipped jobs, including all 27 L0 unit-test jobs, lint, docs, and the CI quality check. The earlier cancelled run is superseded.

  • Reconstructed all 60 steps from preserved token-level logs and applied the nightly script's actual expressions, including original accuracy and KL gates: all three runs pass. Source-file SHA256 digests and per-step results are retained with local validation artifacts.

  • Added regression coverage for a single NaN/+Inf/-Inf among 2,000 valid tokens, exclusion of masked non-finite values, and the strict >10-nat boundary.

  • Local CPU validation: 461 passed, 1 skipped (CUDA unavailable), covering the complete GRPO, utility, logger, metric-checker, and recipe/suite test files; no test-fixture bypass. Job 19950980 used rl.72126403.sqsh, which provides nemo.lens. This convenience image is not lockfile/submodule-identical to the checkout, so this does not replace target-runtime GPU validation.

  • Ruff 0.9.9 lint and format checks, shell syntax, and whitespace checks pass.

Related work and remaining validation

Split from #4459 and adapted from Jonas Yang's implementation. The release-only minimum fix #4592 has merged. This PR targets main, independently of router replay (#4458).

Keep this PR in Draft until the final code passes CI and a fresh 20-step GPU nightly validates logging/collection end to end on the target runtime. The threshold evidence above supports retaining ≤3 and <1.55; it does not replace that final runtime check.

Adapt the tail metrics and plotting fix from Jonas Yang in PR #4459. Keep the existing 20-step convergence schedule and require complete, finite per-step metrics with provisional P99.9 and severe-token-count limits.

Co-authored-by: Jonas Yang <[email protected]>
Signed-off-by: fujial <[email protected]>
@fujial-code fujial-code added the CI:L0 Run doctests and unit tests label Oct 8, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Oct 8, 2026
@fujial-code

Copy link
Copy Markdown
Contributor Author

/ok to test 437be36

Prevent rare NaN/Inf loss-token errors from escaping the percentile and count gates. Cover masked values and the strict 10-nat boundary. Retain the per-step limits with evidence from 60 reconstructed H100 training batches.

Signed-off-by: fujial <[email protected]>
@fujial-code

Copy link
Copy Markdown
Contributor Author

/ok to test 3130dad

@fujial-code

Copy link
Copy Markdown
Contributor Author

/ok to test 233f48c

@terrykong terrykong added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L0 Run doctests and unit tests labels Nov 5, 2026
@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026

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

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants