PyTorch introduced Zephon, a data loading library for TorchTitan that makes training data order independent of the number of GPUs. With a standard loader, resuming a run on a different GPU count changes the sequence of samples, which can skew evaluation results. In tests with a 1B-parameter model trained from scratch for 20B tokens, the DCLM Core v1 score varied by up to 0.82 points and the FineWeb score by up to 0.64 points depending on GPU count, roughly four times the thresholds those benchmarks' authors used for data curation methods. With Zephon, the spread dropped to 0.05 and 0.011 points, respectively, and the SHA-256 hash of every global batch matched the baseline run when resuming from a 16-GPU checkpoint onto 8, 32, or 64 GPUs.
How Zephon Works
Zephon asks users to define three components: the Datasets to train on, a WorkSource that decides how datasets are mixed and ordered, and a Pipeline of operators that turn samples into tensors. The WorkSource plans the curriculum from dataset metadata and stays separate from the processing operators, so you can change the mixture without touching the pipeline. A TokenEstimation utility measures the token-to-byte ratio for a small sample of each dataset to hit mixing proportions on a token basis, even though samples are stored as raw strings.
Each operator can have its own parallelism level. In an example, tokenization gets four workers because it is the most expensive step. On a full vision-language pipeline that decodes images, tokenizes, packs, and batches samples, Zephon keeps pace with Google Grain, the fastest loader the team tested, while offering stronger elastic determinism guarantees.
Design for Elastic Determinism
Zephon achieves elastic determinism with three design decisions. First, every operator splits into a single-threaded accumulator that sees every record in order and makes stateful decisions, plus a stateless function that does the expensive work across parallel workers. Workers can finish in any order, so Zephon numbers each group of records before handing it out and puts results back in order. This makes parallelism a pure performance knob: doubling tokenization workers does not change the output.
Second, instead of dividing data among GPUs directly, Zephon divides it into a fixed number of logical streams called lanes. Each lane has its own ordered sequence of samples and its own copy of operator state, so a lane produces identical records regardless of which GPU it lands on. When the number of data-parallel ranks changes, Zephon redistributes lanes across ranks, and global batches stay the same. The catch is that you must choose the lane count up front, ideally a common multiple of the data-parallel sizes you expect to run on.
Third, Zephon checkpoints do not store the contents of packing bins or shuffle buffers. They only record which input chunks were still being worked on. Periodically, a flush sentinel tells every stateful operator to emit what it holds and start clean. On restore, Zephon replays input from the most recent flush, rebuilding state exactly, and discards anything already consumed. Checkpoints stay a few MiB regardless of run length.
TorchTitan Integration and Constraints
The TorchTitan integration replaces the default data loader with a Zephon Pipeline built from a data recipe, and everything else about the training run stays the same. Zephon's state goes into TorchTitan's checkpoint alongside the model, covering every lane, so you can resume on a different GPU count from the same checkpoint. The integration checks that lanes divide evenly across data-parallel replicas and that each optimizer step's batch splits evenly across lanes, so misconfigured runs fail immediately.
The repo includes a CPU-only demo that checkpoints a data stream, resumes it on a different number of replicas, and verifies every global step matches an uninterrupted run, plus a GPU smoke test with a tiny model. The README covers setup, configuration options, and example recipes.
When resuming on more or fewer ranks, keep the recipe fixed: data, tokenizer, seed, mixture, context length, and global batch size must stay the same. Performance settings like parallelism can change. Zephon guarantees identical global batches across GPU counts, but losses may differ slightly because floating-point reduction order in the training loop still depends on GPU count. The team also notes that Zephon does data prep on the fly, tokenizing, packing, shuffling, and mixing inside the training job, so there is no preprocessed copy of the corpus to create or discard.
Sources & references
PyTorch: Bringing Elastically Deterministic Data Loading to TorchTitan with Zephon ↗Source consulted: 2026-10-16



