TECHNOLOGY

How can you verify sampler RNG restoration after a DeepSpeed resume?

In this article
THE QUICK TAKE

Compare the sample IDs consumed immediately after the checkpoint and then inspect training metrics.

DeepSpeed v0.20.2 includes a fix that restores the data sampler’s own random number generator when training resumes. Saving a process-level seed is insufficient when a sampler owns a generator that has advanced while yielding batches. A run can restart with valid model weights and still see different data.

What a clean resume preserves

The sampler orders examples and may partition them among distributed ranks. Its generator state is one part of the checkpoint contract. The position within an epoch, worker prefetch queues and rank assignment can also influence which examples reach the optimizer. A test should state the expected guarantees of each layer before comparing runs.

Record consumed sample identities

Train on a fixture whose examples carry stable identifiers. Record what each rank actually consumes at committed steps. Save midway through the epoch and keep an uninterrupted run as the control. Restart another run from that checkpoint with the same worker layout. Compare the suffix of committed batches on each rank and check across the end of the epoch as well.

Separate repetition from harmless prefetch

A loader may read samples before a checkpoint without training on them. Counting fetched examples can therefore suggest a duplicate even when the consumed order is correct. Record sample IDs close to the optimizer boundary. Inspect missing or repeated samples, shard membership and the first point where the resumed trace diverges. Compare the loss trace after establishing data parity. A useful control deliberately restores the model but creates a fresh sampler generator. This should change the suffix in a fixture with shuffled input, showing that the test can detect the failure it claims to cover. Keep checkpoint metadata and a sample trace, rather than retaining real training examples in diagnostic logs.

Pass the recovery contract

Require the intended sequence of consumed examples under the supported restart configuration. When worker counts can change, document that different contract and test it separately. Keep a small resume fixture near deployment checks so a loader or sampler upgrade cannot silently change the recovery semantics.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles