Abstract
The increasing complexity of deep neural networks (DNNs) has made it challenging to exploit existing large-scale data processing pipelines for handling massive data and parameters involved in DNN training. Distributed computing platforms and GPGPU-based acceleration provide a mainstream solution to this computational challenge. In this paper, we propose DeepSpark, a distributed and parallel deep learning framework that exploits Apache Spark on commodity clusters. To support parallel operations, DeepSpark automatically distributes workloads and parameters to Caffe/Tensorflow-running nodes using Spark, and iteratively aggregates training results by a novel lock-free asynchronous variant of the popular elastic averaging stochastic gradient descent based update scheme, effectively complementing the synchronized processing capabilities of Spark.
Introduction
Training Deep Neural Networks (DNNs) is a computationally intensive task, often requiring days of processing even on high-end GPUs. While scaling out to clusters is a natural solution, it introduces significant challenges. Standard distributed systems like Apache Spark are excellent for data preprocessing but struggle with the low-latency, high-frequency communication required for DNN training. Furthermore, Spark's synchronous execution model is highly sensitive to "stragglers"—slow nodes that can bottleneck the entire cluster. Existing solutions like CaffeOnSpark often fail to achieve optimal performance on commodity hardware due to these synchronization overheads.
Methodology
DeepSpark addresses these challenges by integrating high-performance deep learning engines (Caffe and TensorFlow) with the Spark ecosystem through several key innovations.
Asynchronous Elastic Averaging SGD
The core of DeepSpark is a lock-free, asynchronous implementation of Elastic Averaging Stochastic Gradient Descent (EASGD). Unlike standard SGD, where nodes must synchronize updates, EASGD allows worker nodes to maintain local weights. These weights are periodically "pulled" toward the master node's weights via an "elastic force." By making this process asynchronous, DeepSpark ensures that workers never wait for one another, effectively eliminating the straggler problem.
Architectural Optimizations
To bypass Spark's task-scheduling overhead, DeepSpark employs a "Dummy RDD" technique to launch long-lived worker threads. This allows for continuous training without the latency of re-scheduling tasks. Additionally, the framework uses an adaptive communication period ($\tau$). By monitoring training loss, DeepSpark synchronizes more frequently during early training (high loss) to establish direction and less frequently as the model converges, reducing network congestion. Framework compatibility is achieved using Java Native Access (JNA), allowing the JVM-based Spark to communicate directly with C++ engines.
Experimental Results
The framework was evaluated using the ILSVRC 2012 ImageNet dataset and the GoogLeNet architecture on a cluster of 16 executors. DeepSpark was compared against a single-node Caffe setup and Yahoo’s CaffeOnSpark.
DeepSpark demonstrated superior performance across all metrics:
- Speed: DeepSpark reached a target accuracy of 0.6 approximately 6.0x faster than CaffeOnSpark and 2.5x faster than a single-node GPU setup for 0.7 accuracy.
- Communication Efficiency: Parameter exchange overhead was reduced from nearly an hour in CaffeOnSpark to just ~250 seconds in DeepSpark for 1,000 iterations.
- Accuracy: Interestingly, DeepSpark achieved a 9% higher final test accuracy than the single-node version. This is attributed to the ensemble-like effect of EASGD, where multiple workers explore different regions of the loss landscape simultaneously.
Conclusion and Future Work
DeepSpark successfully bridges the gap between large-scale data processing and deep learning. By embracing asynchronous updates and architectural "drifts," it achieves significant speedups on commodity clusters. However, challenges remain regarding scalability ceilings due to "discrepancy penalties" and fault tolerance, as the current implementation's reliance on local disk storage bypasses Spark's native lineage-based recovery. Future work will focus on refining these trade-offs and improving hardware-agnostic performance.
Summary updated