Skip to content

Relax tolerances in DiLoCo test to fix TPU7x failure - #4413

Closed
hsuan-lun-chiang wants to merge 3 commits into
AI-Hypercomputer:mainfrom
CIeNET-International:tpu7x-test-fix
Closed

Relax tolerances in DiLoCo test to fix TPU7x failure#4413
hsuan-lun-chiang wants to merge 3 commits into
AI-Hypercomputer:mainfrom
CIeNET-International:tpu7x-test-fix

Conversation

@hsuan-lun-chiang

@hsuan-lun-chiang hsuan-lun-chiang commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Relax tolerances in DiLoCoTest to fix TPU7x integration test failure caused by numerical divergence.

Root Cause Analysis

The integration test tests/integration/diloco_test.py::DiLoCoTest::test_diloco_training_simulation_with_mesh was failing on TPU7x CI. Investigation showed that TPU7x exhibits a small numerical divergence (~0.38% relative difference in loss: 0.647502 actual vs 0.65 expected) during DiLoCo training simulation. The default tolerance of assert_trees_all_close (1e-6) was too strict for this hardware-specific divergence, leading to test failures. TPUv6e did not exhibit this divergence (yielding 0.65000009).

Resolution

Relaxed the tolerance parameters (rtol=1e-2, atol=1e-2) for all three assert_trees_all_close checks in diloco_test.py. This allows the test to pass on TPU7x while still verifying the correctness of the training simulation.

Verification

  1. Local Verification: Ran the test locally on TPUv6e to ensure it still passes (loss: 0.65000009).
  2. CI Verification: Temporarily modified the CI workflow to run TPU7x tests on the PR branch. Verified that tpu7x-integration job successfully passed with the relaxed tolerances.
  3. Workflow Restored: Restored the CI workflow to skip TPU7x tests on PRs to conserve resources.

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hsuan-lun-chiang
hsuan-lun-chiang marked this pull request as draft July 10, 2026 05:36
@hsuan-lun-chiang hsuan-lun-chiang changed the title TEMPORARY: Test TPU7X DiLoCo tolerance fix Relax tolerances in DiLoCo test to fix TPU7x failure Jul 10, 2026
@hsuan-lun-chiang
hsuan-lun-chiang force-pushed the tpu7x-test-fix branch 5 times, most recently from f76b312 to 452fa07 Compare July 10, 2026 07:59
@hsuan-lun-chiang
hsuan-lun-chiang force-pushed the tpu7x-test-fix branch 6 times, most recently from 8108d58 to 94053af Compare July 14, 2026 02:44
@hsuan-lun-chiang
hsuan-lun-chiang marked this pull request as ready for review July 14, 2026 11:04
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