Skip to content

Widen the tensor-parallel eval predictions tolerance to cover all-reduce order noise - #17896

Merged
danielhanchen merged 1 commit into
mainfrom
fix-tp-eval-pred-tol
Nov 16, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-tp-eval-pred-tol

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

tests/test_tp_eval_gloo.py::test_trainer_evaluates_a_tensor_parallel_model_like_one_process[2-2] fails intermittently in the Repo tests (CPU, gloo) shard on unrelated PRs (seen on #17701 and #17840):

Mismatched elements: 1 / 2016000 (0.0%)
Greatest absolute difference: 1.07e-05 at index ... (up to 1e-05 allowed)

The predictions are logits after three training steps. Under tensor parallelism the row-parallel all-reduce sums partial products in a different order than the single-process reference, so an element close to zero can land just past atol = 1e-5 depending on the CPU and thread layout. The test was added in #15722 and the check itself is right, the absolute tolerance is just at the edge of float32 reduction noise.

Change

  • Predictions atol goes from 1e-5 to 5e-5 (rtol unchanged at 1e-4), with a comment saying why.
  • The training and eval losses are still compared at rel = 1e-5, and label_ids still has to match exactly, so a real sharding or gather bug (which moves logits and losses by orders of magnitude more) still fails the test.

Testing

  • pytest tests/test_tp_eval_gloo.py on CPU (torch 2.10, transformers 5.17): 3 passed.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T04:03:10.640656Z 21c08f0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 21c08f056b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 016f045 into main Nov 16, 2026
@danielhanchen
danielhanchen deleted the fix-tp-eval-pred-tol branch November 16, 2026 04:05
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.

1 participant