Skip to content

Make batched vs list-model training test platform-robust - #450

Merged
nikitakuklev merged 2 commits into
xopt-org:mainfrom
gian21391:fix/batched-training-test
Jul 25, 2026
Merged

Make batched vs list-model training test platform-robust#450
nikitakuklev merged 2 commits into
xopt-org:mainfrom
gian21391:fix/batched-training-test

Conversation

@gian21391

Copy link
Copy Markdown

test_train_model_batch_compare_adam fails on macOS/ARM: tiny float64 reduction-order differences between the batched and per-model kernels (~1e-10) get amplified by Adam's adaptive normalization, exceeding the 1e-5 tolerance within a few steps.

Rather than loosening the tolerance, this rewrites the test to check the invariant directly:

  • Compare loss and per-parameter gradients before any optimizer step (tight, 1e-9) — this is the actual batched-vs-independent equivalence.
  • Use plain SGD for the 10-step trajectory comparison; without adaptive normalization the divergence stays at float64 noise level, so the tolerance is tightened from 1e-5 to 1e-8.
  • Keep the final lengthscale comparison, tightened to 1e-8.

Measured on the previously failing platform: worst per-step loss difference 9e-16, max gradient difference 6e-17 (vs 2.7e-4 under Adam).

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@nikitakuklev
nikitakuklev merged commit 39d5e3f into xopt-org:main Jul 25, 2026
13 checks passed
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.

2 participants