In this article
Distributing training across ranks does not automatically partition every iterable worker; verify both layers of example assignment.
Several consumers can read the same record
A distributed training rank and a data-loader worker are different consumers. Each rank can create several workers, and each worker can receive its own iterable dataset replica. If every replica starts the same unpartitioned stream, adding workers can repeat the input instead of extending coverage.
The PyTorch data documentation distinguishes map-style sampling from iterable-style loading. Do not apply a fix designed for one access model without checking which object the application actually uses. A list of file paths and an iterator over their contents can have different assignment behavior.
Partition at both required levels
For iterable datasets, worker information can configure each replica’s portion. Distributed node or rank partitioning is an additional boundary. Hugging Face documents distributed dataset splitting and the assignment of an iterable dataset’s shards to loader workers.
Choose one coherent ownership scheme. Applying independent split operations twice can omit examples; omitting a level can duplicate them. Write down whether a shard belongs to a rank first and then to one worker, or whether another supported mechanism performs the full assignment.
Sampler padding is intentional duplication
For map-style data, PyTorch DistributedSampler documents a constant-size, stable-order dataset assumption. Its drop_last setting either drops the tail or adds indices to make assignment divisible across replicas. Extra indices can therefore be expected behavior rather than evidence that the source files contain duplicate records.
Keep sampler-level repeats separate from source-level duplicates. For evaluation, reconcile repeated identifiers before interpreting counts or metrics. For training, describe the effective exposure policy instead of reporting that every source record is necessarily consumed exactly once.
Epoch coordination affects the next assignment
DistributedSampler requires epoch coordination for shuffling across epochs, and the documentation expects the shuffle seed to agree across processes. Giving each process an unrelated permutation can break the intended common partitioning plan.
Iterable pipelines have their own documented epoch and shard rules. Record the loader and dataset configuration together. A change in worker count can alter traversal behavior even when model batch size stays unchanged, so inspect the resulting assignments rather than reasoning only from GPU count.
Audit identities on a small distributed run
A proposed diagnostic records source identifier, rank, worker and epoch for a bounded synthetic dataset. Compare the union and intersections of assigned identifiers against the expected padding or dropping policy. Check the end of each worker’s stream as well as the start.
This reveals whether a throughput change also changed which examples were seen. Successful collective training steps do not prove correct data partitioning. The data assignment needs its own evidence before unique-example counts or held-out evaluation results can be trusted.
Primary references
Hugging Face distributed dataset interfaces.
Related explanations: Exposure and repeated examples; Independent evaluation splits.
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.