NVIDIA Developer Blog→ original

NVIDIA demonstrates bit-wise determinism in Megatron Core for pretraining across thousands of GPUs

NVIDIA has published a write-up on bit-wise deterministic pretraining in Megatron Core. The idea is that two runs with identical inputs produce identical weights and gradients down to the last bit. For trillion-parameter models trained on thousands of GPUs, this simplifies debugging, fix validation and reproducible restarts from a checkpoint. Several factors make it hard: multiple dimensions of parallelism, low-precision computation and distributed checkpoints. • Bit-wise reproducibility turns rare failures into repeatable ones. • Validating a fix becomes an exact comparison rather than an eyeball estimate. • Restarting from a checkpoint continues exactly the same training trajectory.

AI-processed from NVIDIA Developer Blog; edited by Hamidun News
NVIDIA demonstrates bit-wise determinism in Megatron Core for pretraining across thousands of GPUs
Source: NVIDIA Developer Blog. Collage: Hamidun News.
◐ Listen to article

Training a trillion-parameter model on thousands of GPUs costs millions of dollars and takes weeks. If a loss spike or NaN appears midway through a run, it usually can't be reproduced: the order of operations changes from run to run, and the error doesn't show up again. NVIDIA has published a post on its Developer Blog about how to achieve bit-wise determinism in pretraining with Megatron Core. Two runs with the same data and configuration should produce identical results down to the last bit.

Why determinism in pretraining is so rare

The root of the problem is floating-point arithmetic: addition is not associative. Sum the same numbers in a different order and you get a slightly different result. On a single GPU the difference is barely noticeable. In a cluster, the order depends on many factors: atomic operations in kernels, the choice of reduction algorithm in collective communications, thread scheduling, and how work is distributed across devices.

The source lists several complicating factors:

  • multiple dimensions of parallelism at once (data, tensor, pipeline and others), each with its own reductions and exchanges;
  • low-precision computation, where rounding errors are larger and depend more heavily on the order of operations;
  • distributed checkpoints, which must be saved and loaded so that resuming training does not change the trajectory;
  • scale: trillions of parameters and thousands of GPUs, where the probability of a rare failure during a run approaches one.

The specific techniques Megatron Core uses to enforce operation order, and the speed cost of determinism, are not disclosed in the available excerpt. Those details have to be checked in the full version of the post.

What bit-wise reproducibility gives you

The announcement names three practical benefits: debugging, validation and reproducible training resumption.

The first is finding the cause of a failure. If a run is deterministic, you can restart it from the last checkpoint before the anomaly and get the same anomaly. That turns a "ghost" error into an ordinary bug, one you can set checks on and bisect by layer or step.

The second is validating fixes. With non-deterministic training, two runs always diverge, and you can only tell statistically whether a fix affected the result. With bit-wise reproducibility, any deviation from the reference means the change touched something. No deviation proves that a refactoring or optimization did not alter numerical behavior.

The third is restarts. On large clusters, hardware failures happen regularly. If training after loading a checkpoint follows exactly the same trajectory as it would have without stopping, engineers can be confident that the restart introduced no hidden drift.

The cost and where it pays off

Determinism usually costs performance: fast non-deterministic kernels and atomic reductions are often replaced with slower but predictable ones. So the key question is how much throughput drops on real configurations. The excerpt does not answer it, and without measurements it is too early to judge the trade-off.

The logic of when to use it is still clear. Keeping deterministic mode on permanently in the most expensive runs is not necessary. But it is useful in several scenarios:

  • reproducing and analyzing failures, when you need an exact replay;
  • validating new kernels, a change of precision (for example, a move to a lower one) or a change in the parallelism scheme;
  • regression testing of training code: a reference run over a small number of steps, against which every build is compared bit by bit.

Practical takeaways for teams

Teams that train their own models on Megatron Core should set up a short control run in deterministic mode and add it to CI. Any change to code, drivers or parallelism configuration is first compared against the reference using weight hashes after a fixed number of steps. A mismatch immediately shows that the change affected numerical behavior.

Before adopting it, measure the overhead on your own cluster and at your own precision. Also verify that a checkpoint restart really produces an identical trajectory on your topology. It makes sense to enable full determinism selectively: for debugging, validation and auditing runs. The main training can run in fast mode if measurements show a noticeable loss of speed.

ZK
Hamidun News
AI news without noise. Daily editorial selection from 50+ sources. A product by Zhemal Khamidun, Head of AI at Alpina Digital.
✦ Unified AI Workspace

Access Frontier LLMs & Multimodal AI in One Workspace

Discover NomadNet AI (nomadnet.ai) — unified access to frontier language models, research synthesis, and multimodal workflows.

Try NomadNet AI →Launch NomadNet Agent
What do you think?
Loading comments…