Repository navigation
CP Ulysses gloo tests: report the gradient mismatch, not just the parameter name - #17972
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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
added a commit
that referenced
this pull request
Nov 16, 2026
… flake it (#17980) ## Summary `tests/test_cp_ulysses_media_towers_gloo.py::test_gemma4_with_towers_matches_one_process` (added in #17930) fails intermittently in the `Repo tests (CPU, gloo)` job, always on a layer 0 attention projection. With the mismatch report from #17972 the latest failure reads: ``` model.language_model.layers.0.self_attn.k_proj.weight: Tensor-likes are not close! Mismatched elements: 2 / 512 (0.4%) Greatest absolute difference: 1.88e-05 at index (11, 31) (up to 1.42e-05 allowed) ``` That is float32 rounding, not a context parallel bug. Layer 0 gradients go through every layer of backprop and are summed in a different order on either side of the shard seam. Running the same versions as CI (torch 2.10.0+cpu, transformers 5.17.0), the worst parameter on this host is k_proj at 0.62x the tolerance on every run, and the runners whose CPU kernels round differently hit 1.33x. ## Change The test now builds the tiny Gemma 4 model in float64 instead of float32. It checks attention routing with the towers present, so precision is not what it measures. The tolerance is unchanged. In float64 the worst parameter (the same k_proj) is at 0.012x the tolerance, so there is about 80x headroom where float32 had very little. ## Verification - `tests/test_cp_ulysses_media_towers_gloo.py`: 2 passed. - Sabotage: skipping `manager.attach_attention_hooks(model)` in the worker fails at the same tolerance on `embed_tokens.weight` with 3047 / 3072 elements mismatched and a greatest absolute difference of 2.37. That means the tight tolerance still catches real routing errors.
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.
Summary
tests/test_cp_ulysses_media_towers_gloo.py::test_gemma4_with_towers_matches_one_process(from #17930) has failed in four of the last gloo shard runs on unrelated PRs (staging runs of #17957, #17960, #17831 and #17966), always as:and it passes locally every time (5 of 5 standalone, and 53 of 53 with all five
test_cp_*gloo*.pyfiles in one process, so it is not state left by an earlier test in the worker). The assertion passesmsg = name, which replaces torch's whole mismatch report with the parameter name, so the CI logs do not say how many elements are off or by how much. Without that there is no way to tell a float32 reduction-order difference on the CI runners' CPUs (a tolerance question) from a real context parallel gradient bug.Change
Test only. The gradient
assert_closecalls intest_cp_ulysses_media_towers_gloo.pyandtest_cp_ulysses_generic_gloo.pypassmsgas a callable that prefixes the parameter name to torch's report instead of replacing it:Tolerances are unchanged. The next CI failure will carry the numbers needed to decide whether the tolerance or the code is wrong.
Testing
torch.testing.assert_close(output above).