Clairvoyant Prefetching for Distributed Machine Learning I/O

Roman Böhringer, Nikoli Dryden, Tal Ben-Nun, Torsten Hoefler · DOI

Abstract

I/O is emerging as a major bottleneck for machine learning training, especially in distributed environments. Indeed, at large scale, I/O takes as much as 85% of training time. Addressing this I/O bottleneck necessitates careful optimization, as optimal data ingestion pipelines differ between systems, and require a delicate balance between access to local storage, external filesystems, and remote nodes. We introduce NoPFS, a machine learning I/O middleware, which provides a scalable, flexible, and easy-to-use solution to the I/O bottleneck. NoPFS uses clairvoyance: Given the seed generating the random access pattern for training with SGD, it can exactly predict when and where a sample will be accessed. We combine this with an analysis of access patterns and a performance model to provide distributed caching policies that adapt to different datasets and storage hierarchies. NoPFS reduces I/O times and improves end-to-end training by up to 5.4x on the ImageNet-1k, ImageNet-22k, and CosmoFlow datasets.

The I/O Bottleneck in Distributed Training

Deep learning models are typically trained using mini-batch Stochastic Gradient Descent (SGD), a process that requires reading massive datasets in a randomized order every epoch. In modern distributed setups, such as supercomputers or large GPU clusters, thousands of workers simultaneously access a shared Parallel File System (PFS) to fetch these randomized batches. This creates massive contention, shifting the primary training bottleneck from compute to I/O.

The data loading pipeline and common sources of I/O stalls.

As illustrated in Figure 1, the training pipeline involves several stages: random reads, decoding, preprocessing, and collation before the data reaches the accelerator for training. Stalls can occur due to compute limitations, I/O throughput, or contention at the PFS level. Existing solutions, such as overlapping I/O with compute or sharding datasets, often fall short. Sharding can break the strict mathematical randomness required for optimal model convergence, while caching entire datasets in RAM is often impossible for terabyte-scale workloads.

Methodology: The NoPFS Approach

The authors introduce NoPFS (Near-optimal PreFetching System), a middleware designed to overcome these limitations through "clairvoyance." The core insight is that because SGD shuffling relies on a pseudorandom number generator (PRNG) with a known seed, the exact sequence of data accesses for every worker is deterministic and can be known before training begins.

NoPFS uses clairvoyance to map access frequencies to a multi-tiered storage hierarchy.

Core Techniques

  • Clairvoyance: By utilizing the PRNG seed, NoPFS implements optimal caching strategies akin to Bélády’s clairvoyant algorithm. It knows exactly which samples will be needed and when.
  • Probabilistic Access Analysis: While every sample is read once per epoch globally, specific workers may encounter the same sample multiple times across epochs. NoPFS pre-calculates these frequencies to prioritize caching.
  • Performance Model-Driven Caching: NoPFS builds a model of the cluster's I/O speeds, assigning the most frequently accessed samples to the fastest available storage (e.g., RAM or local SSD).
  • Distributed Fetching: If the performance model determines it is faster, workers can fetch data from the RAM of other remote workers over high-speed networks rather than hitting the contended PFS.

Evaluation and Results

NoPFS was evaluated on the Lassen supercomputer using datasets of varying scales, including ImageNet-1k (135 GB), ImageNet-22k (1.3 TB), and CosmoFlow (up to 10 TB).

Key Findings

  • Significant Speedups: NoPFS achieved up to a 5.4x speedup over PyTorch's native DataLoader on ImageNet-1k and outperformed high-performance HPC frameworks like LBANN by 1.7x.
  • Scalability: For datasets exceeding aggregate cluster memory, NoPFS maintained high performance, with a 2.4x speedup on ImageNet-22k and a 2.1x speedup on CosmoFlow.
  • Variance Reduction: Standard loaders often suffer from "tail latency" due to PFS contention. NoPFS drastically reduces this variance, ensuring consistent batch times.
  • End-to-End Impact: In a full ResNet-50 training run on 256 GPUs, NoPFS reduced total training time by 1.42x without sacrificing model accuracy.

Conclusion and Future Work

NoPFS demonstrates that the "stochastic" nature of ML training is actually predictable. By turning a reactive I/O problem into a proactive scheduling problem, NoPFS effectively utilizes complex storage hierarchies and high-speed networks.

Future research directions include making the system aware of NUMA and network topologies to further optimize remote fetches. Additionally, the authors propose exploring dedicated I/O cores to mitigate network noise generated during gradient synchronization, ensuring even greater scalability for the next generation of deep learning workloads.

Summary updated

BibTeX
@inproceedings{bohringer2021clairvoyant,
  author = {Roman Böhringer and Nikoli Dryden and Tal Ben-Nun and Torsten Hoefler},
  title = {{Clairvoyant Prefetching for Distributed Machine Learning I/O}},
  booktitle = {SC},
  year = {2021},
  doi = {10.1145/3458817.3476181},
}
Figure