Skip to content

CP towers gloo test: compare in float64 so CPU kernel rounding cannot flake it - #17980

Merged
danielhanchen merged 1 commit into
mainfrom
ci-towers-gloo-f64
Nov 16, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-towers-gloo-f64

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

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.

@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-16T13:34:59.687053Z 1d8307a 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 1d8307ab7d

ℹ️ 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 971c16b into main Nov 16, 2026
@danielhanchen
danielhanchen deleted the ci-towers-gloo-f64 branch November 16, 2026 13:35
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