Abstract
Training deep networks is expensive and time-consuming, with training periods increasing alongside data size and model parameters. This paper introduces a framework for distributed training of deep networks over a cluster of CPUs using Apache Spark. By implementing both Data Parallelism and Model Parallelism, the framework supports massive training datasets and models too large for a single machine's memory. The system scales across commodity hardware, achieving significant speedups (up to 11X for CNNs) and providing an economical alternative to GPU farms. We propose a new algorithm for training partitioned networks, accompanied by cost analysis and a proof of convergence.
Introduction
State-of-the-art deep learning models require immense computational resources. While Data Parallelism—distributing data across machines—is common, Model Parallelism—splitting the network architecture itself—is significantly more challenging to implement efficiently. Most high-performance solutions rely on expensive GPUs and specialized networking. This work addresses the gap for a generic, scalable framework for complex architectures like CNNs, RNNs, and LSTMs on commodity CPU clusters using Apache Spark.
Methodology
The framework combines two primary strategies to handle large-scale training:
Distributed Optimization
The system employs Downpour SGD, an asynchronous variant of Stochastic Gradient Descent. Multiple model replicas compute gradients on distinct data subsets and update a central parameter server, mitigating the synchronization bottlenecks of standard SGD.
Model Parallelism via Vertical Weight Partitioning
To accommodate models exceeding single-node memory, the authors implement Vertical Weight Partitioning. Weight matrices are split across different processes (machines).
- Forward Pass: The master process broadcasts the input vector. Each slave process computes its specific subset of the output based on its local weight partition. The master then gathers these partial results to form the complete layer output.
- Backward Pass: The master broadcasts the error vector. Slaves compute weight updates for their specific partitions and contribute to the error calculation for the preceding layer.
The implementation leverages Apache Spark's RDDs for data management and the Akka framework for low-latency communication between nodes during these parallel operations.
Experimental Evaluation
The framework was tested using the Extended MNIST dataset (8.1 million samples) for FC and CNN architectures, and the Project Gutenberg corpus (Shakespeare's works) for RNN and LSTM character-level prediction.
Key Results
- Speedup: The system achieved an 11X speedup for CNNs with 5 million samples and a 7.2X speedup for Fully-Connected networks.
- Scale: A model with 4 billion parameters was successfully trained on a cluster of five machines (88 CPU cores), reaching a 5.6X speedup.
- Scalability: LSTM implementations showed near-linear scalability as worker nodes increased.
Discussion
A critical insight is the "CPU Advantage": while GPUs offer raw speed, CPU clusters with model parallelism can handle far larger parameter sets (e.g., >100 million) that exceed GPU memory. The authors' cost analysis shows that larger models benefit more from distribution, as the computation-to-communication ratio improves. CNNs specifically showed better speedups than FC nets due to local connectivity, which reduces inter-machine communication overhead. Furthermore, the work includes a formal proof of convergence for their delayed stochastic gradient descent algorithm using Bregman divergence and regret bounds.
Conclusion
This framework provides a scalable, mathematically rigorous approach to training deep networks on commodity hardware. By integrating model and data parallelism within Apache Spark, it democratizes large-scale deep learning for organizations without access to specialized supercomputing resources. Future work includes further optimizing communication overhead and exploring automated hyperparameter tuning within the Spark ecosystem.
Summary updated