A Deep Learning Dataloader with Shared Data Preparation

Jian Xie, Jingwei Xu, Guochang Wang, Yuan Yao, Zenan Li, Chun Cao, Hanghang TongNeurIPS 2022

TL;DR

This paper introduces JOADER, a novel data loading system for parallel deep learning training that significantly speeds up training by sharing data preparation work across multiple jobs. It achieves this by introducing a "dependent sampling algorithm" (DSA) and a domain-specific cache policy, allowing for more flexible training constraints like varying job speeds and partially overlapping datasets.

What Problem Does This Paper Address?

Training deep neural networks (DNNs) is often a time-consuming process, especially when researchers need to train multiple models in parallel for tasks like hyperparameter tuning or model selection. A major bottleneck is the data preparation phase (loading and preprocessing data), which is typically done independently by each training job. This leads to redundant computation and I/O, wasting valuable CPU and storage resources. While caching can help reuse prepared data, standard caching mechanisms struggle with the random data shuffling inherent in DNN training, leading to "cache thrashing" where frequently needed data is evicted. Existing solutions that try to mitigate this often impose strict constraints, such as requiring all jobs to start simultaneously and process data in lockstep, which are not always practical.

Methods

The core of JOADER lies in two main innovations:

  • Dependent Sampling Algorithm (DSA): This algorithm aims to improve "sampling locality" by making data sampling decisions for different jobs dependent on each other. Instead of each job randomly picking data independently, DSA strategically schedules sampling to increase the probability that multiple jobs request the same data within a short period. It achieves this by dividing datasets into intersection (shared) and difference (unique) sets and correlating sampling decisions. This is inspired by "correlated sampling" theory.
  • RefCnt Cache Policy: This is a domain-specific cache policy designed for DNN training. Unlike traditional policies like LRU (Least Recently Used), RefCnt leverages the fact that in DNN training, data is typically accessed only once per epoch. It maintains a reference count for each data element, tracking how many jobs are expected to access it. Data with fewer expected future accesses is prioritized for eviction, making the cache more effective for the specific access patterns of DNN training.

To efficiently implement DSA, the authors also designed a Dependent Sampling Tree, a novel data structure that organizes dataset intersections and differences to speed up the sampling process.

Datasets

The paper evaluates JOADER on ImageNet, a widely used large-scale dataset for computer vision tasks. They specifically use the ResNet family of models (ResNet18, ResNet34, ResNet50, ResNet101, and ResNet152) for their experiments. No new benchmarks were introduced; instead, they compared their system against existing methods on standard tasks.

Key Insights and Ideas

  • Shared data preparation is crucial for parallel DNN training efficiency: The paper strongly emphasizes that redundant data loading and preprocessing are significant bottlenecks, and sharing this work is key to accelerating training.
  • Random shuffling is the enemy of efficient caching: The inherent randomness in data shuffling for DNNs makes it difficult for standard caches to be effective. JOADER's approach of improving sampling locality directly addresses this.
  • Relaxing constraints unlocks broader applicability: By moving beyond strict lockstep synchronization, JOADER makes shared data preparation feasible in more realistic asynchronous scenarios with varying job speeds and partially overlapping datasets.
  • Domain-specific solutions matter: The RefCnt cache policy highlights how tailoring caching strategies to the specific access patterns of DNN training can yield significant improvements over general-purpose policies.

Key Results

JOADER demonstrates substantial improvements in training speed across various scenarios:

  • Synchronous Training: JOADER achieves significant reductions in CPU utilization and training time. For instance, with 6 training jobs, JOADER saves 44.8% of training time and reduces CPU utilization by over 40% compared to the PyTorch baseline.
  • Asynchronous Training (Different Speeds): JOADER allows faster jobs to proceed at their own pace without waiting for slower jobs, unlike CoorDL, which enforces lockstep. This leads to better overall training efficiency.
  • Asynchronous Training (Different Arrival Times): JOADER reuses prepared data from previous jobs, resulting in lower CPU load and faster training times (e.g., 17.1% training time saving).
  • Asynchronous Training (Partially Overlapping Datasets): JOADER effectively utilizes shared data when datasets have partial overlap, showing reduced CPU utilization as the overlap increases.
  • Speedup: The paper reports speedups of up to 200% on ResNet18 in flexible scenarios, and even up to 500% in some cases (as mentioned in the metadata). Crucially, these speedups are achieved without affecting model accuracy.

Limitations and Future Work

  • Correlated Workloads: The paper acknowledges that DSA's strength in improving locality by breaking strict independence might not be as effective for highly correlated workloads, such as those used for variance reduction in ensemble methods.
  • Task Dependency: The benefits of JOADER are more pronounced for tasks with significant data reading and processing costs, like computer vision. For tasks with smaller data samples (e.g., some NLP tasks), the gains might be less substantial.
  • Disk I/O Bottleneck: While JOADER aims to reduce CPU bottlenecks, the paper notes that if disk I/O speed is below a certain threshold (around 350MB/s), it could become the new bottleneck.
  • Future Work: The paper doesn't explicitly detail future work, but the limitations suggest potential avenues for research, such as exploring how to adapt DSA for ensemble training or further optimizing for scenarios with slower storage. The efficiency of the dependent sampling tree operations (deletion, insertion) is also an area where further optimization might be beneficial.

Summary updated

BibTeX
@inproceedings{xie2022deep,
  author = {Jian Xie and Jingwei Xu and Guochang Wang and Yuan Yao and Zenan Li and Chun Cao and Hanghang Tong},
  title = {{A Deep Learning Dataloader with Shared Data Preparation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=tZUOiVGO6jN},
}
Figure