異步隨機梯度下降算法是訓練模型的好方法,在實際使用中也被證明有效,只要控制好梯度過時的問題。有些實現方法是介于異步SGD和同步實現之間,取決于超參數的使用。
帶有中心參數服務器的異步SGD可能存在通訊的瓶頸(而同步的方法可以采用tree-reduce或是類似的算法來避免這類通訊瓶頸),使用N個參數服務器,每個參數服務器負責一部分參數,這是一種直截了當的解決方式。
最后,去中心化異步隨機梯度下降法是一個好方向,但是還需要進一步研究的支持用它替代‘標準’的異步SGD。
何時使用分布式深度學習
分布式的深度學習并不總是最佳的選擇,需要視情況而定。
分布式訓練并不是免費 —— 由于同步、數據和參數的網絡傳輸等,分布式系統(tǒng)相比單機訓練要多不少額外的必要開銷。若要采用分布式系統(tǒng),我們則希望增添機器帶來的收益能夠抵消那些必要開銷。而且,分布式系統(tǒng)的初始化(比如搭建系統(tǒng)和加載數據)和超參數調優(yōu)也比較耗時。因此,我們的建議非常簡單:繼續(xù)用單機訓練網絡模型,直到訓練時間過長。

有兩種原因可能導致網絡模型的訓練時間過長:網絡規(guī)模太大或是數據量太大。事實上,若這兩者不匹配(大模型配小數據,小模型配大數據)這可能導致欠擬合和過擬合 —— 都將導致最終訓練得到的模型缺少泛化能力。
在某些情況下,應該首先考慮多GPU系統(tǒng)(如Deeplearning4j的Parallel-Wrapper就能很方便地在單機上實現以數據并行化方式訓練模型)。
另一個需要考慮的因素是網絡傳輸與計算量的比值。當傳輸與計算的比值較低時,分布式訓練的效率往往較高。小的、淺層的網絡由于每次迭代的計算量較小,并不適合分布式訓練。帶有參數共享的網絡(比如CNN和RNN)是分布式訓練的理想對象:因為它們每個參數的計算機遠遠大于多層感知機或是自編碼器。
第二篇提要:在Apache Spark上使用Deeplearning4j進行分布式深度學習
在我們分布式深度學習系列文章的第二、第三篇中,我們會介紹使用Apache Spark的Deeplearning4j的參數平均法實現,以及借用一個端到端的例子講解如何用它在Spark集群上訓練神經網絡模型。
參考文獻
[1] Kai Chen and Qiang Huo. Scalable training of deep learning machines by incremental block training with intra-block parallel optimization and blockwise model-update filtering. In 2016 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5880–5884. IEEE, 2016.
[2] Jeffrey Dean, Greg Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Mark Mao, Andrew Senior, Paul Tucker, Ke Yang, Quoc V Le, et al. Large scale distributed deep networks. In Advances in Neural Information Processing Systems, pages 1223–1231, 2012.
[3] Suyog Gupta, Wei Zhang, and Josh Milthrope. Model accuracy and runtime tradeoff in distributed deep learning. arXiv preprint arXiv:1509.04210, 2015.
[4] Qirong Ho, James Cipar, Henggang Cui, Seunghak Lee, Jin Kyu Kim, Phillip B. Gibbons, Garth A Gibson, Greg Ganger, and Eric P Xing. More effective distributed ml via a stale synchronous parallel parameter server. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 26, pages 1223–1231. Curran Associates, Inc., 2013.
[5] Forrest N Iandola, Khalid Ashraf, Mattthew W Moskewicz, and Kurt Keutzer. Firecaffe: near-linear acceleration of deep neural network training on compute clusters. arXiv preprint arXiv:1511.00175, 2015.
[6] Augustus Odena. Faster asynchronous sgd. arXiv preprint arXiv:1601.04033, 2016.
[7] Nikko Strom. Scalable distributed dnn training using commodity gpu cloud computing. In Sixteenth Annual Conference of the International Speech Communication Association, 2015. http://nikkostrom.com/publications/interspeech2015/strom_interspeech2015.pdf .
[8] Hang Su and Haoyu Chen. Experiments on parallel training of deep neural network using model averaging. arXiv preprint arXiv:1507.01239, 2015.
[9] Wei Zhang, Suyog Gupta, Xiangru Lian, and Ji Liu. Staleness-aware async-sgd for distributed deep learning. IJCAI, 2016.