TL;DR
Researchers have developed CorgiPile, a hierarchical data shuffling strategy that allows Stochastic Gradient Descent (SGD) to converge as quickly as a full data shuffle while avoiding massive I/O overhead. By shuffling data at both the block and tuple levels, CorgiPile achieves up to a 12.8x speedup in database machine learning and a 1.5x speedup in deep learning workflows without sacrificing model accuracy.
The Challenge: The I/O Bottleneck in SGD
Stochastic Gradient Descent (SGD) is the engine behind modern machine learning, requiring data to be presented in a random order to work effectively. However, there is a fundamental "impedance mismatch" between algorithmic needs and hardware reality. Modern datasets are often too large for RAM and must reside on secondary storage (HDDs or SSDs), which are optimized for sequential access.
Performing a full global shuffle requires random access across the entire storage device, which is incredibly slow. Existing workarounds, like "sliding window" shuffling, often fail when data is clustered (e.g., sorted by labels), leading to poor convergence. The goal of CorgiPile is to provide the statistical benefits of a full shuffle with the hardware efficiency of a sequential scan.
The CorgiPile Approach
The authors propose a two-level hierarchical shuffling strategy called CorgiPile, inspired by card-shuffling techniques:
- Block-Level Shuffle: The system randomly selects a set of contiguous "blocks" of data (e.g., 10MB chunks). Because these blocks are large, the I/O cost of jumping between them is negligible compared to the speed of reading the block itself.
- Tuple-Level Shuffle: Once these blocks are loaded into an in-memory buffer, the system performs a fine-grained shuffle of the individual rows (tuples) before feeding them to the SGD optimizer.
This method was implemented in PyTorch via a new CorgiPileDataSet API and in PostgreSQL by introducing new physical operators that allow for "double-buffering" to hide I/O latency.
Key Results and Performance
CorgiPile was evaluated across a wide range of tasks, including Deep Learning (ImageNet, CIFAR-10) and Generalized Linear Models (HIGGS, Criteo).
Deep Learning Convergence
On the massive ImageNet dataset, CorgiPile was 1.5x faster than the standard PyTorch implementation with a full shuffle. Crucially, it reached the same final accuracy, proving that a perfect global shuffle is not necessary for convergence in deep learning.
In-Database Machine Learning Dominance
When compared to state-of-the-art in-database systems like Apache MADlib and Bismarck, CorgiPile was 1.6x to 12.8x faster on both HDD and SSD setups. By moving the shuffling logic into the physical operator layer of the database, the authors could implement optimizations like double-buffering that are impossible at the higher User-Defined Aggregate (UDA) level.
As shown in Figure 2(b), the "Data Shuffling Time"—which typically dominates training on secondary storage—is drastically reduced, allowing the system to spend more time on actual computation.
Conclusion
CorgiPile demonstrates that hierarchical shuffling is a robust and efficient alternative to full data shuffling. By aligning the data access patterns of SGD with the physical characteristics of storage hardware, it enables high-performance machine learning on massive datasets without requiring expensive memory upgrades or sacrificing model quality.
Summary updated