Mesh-TensorFlow: Deep Learning for Supercomputers
Paper · 2018 · Noam Shazeer, Youlong Cheng, Niki Parmar et al.
Summary
Data-parallel training, which splits only the batch across devices, cannot handle models whose parameters exceed a single device's memory. It also scales poorly when batches are small. Model-parallel schemes avoid these limits, but they are usually hard to design and code by hand. The authors present Mesh-TensorFlow, a TensorFlow-like Python library in which every tensor dimension carries a name. Hardware is treated as a logical n-dimensional grid of processors. A single "computation layout" assigns chosen tensor dimensions to grid dimensions, so data parallelism, model parallelism, or a mix of both can be selected without changing model code. The library lowers the graph to an SPMD program in which each processor runs local operations and communicates through collectives such as Allreduce, allgather and alltoall. Using this approach, the team trained Transformer models with up to roughly 5B parameters on TPUv2 clusters of up to 512 cores. These models set new records on WMT14 En-Fr and the One Billion Word benchmark. The work shows that scaling model size, not only data, can be made practical.
Key points
- The main abstraction is a mapping from named tensor dimensions to named mesh dimensions. Einsum and reductions are implemented as local operations followed by an Allreduce, and reshapes may require allgather or alltoall.
- On the One Billion Word benchmark, a 4.9B-parameter decoder trained for 13 hours on a 512-core TPUv2 cluster. It reached a dev perplexity of 24.0, which fell to 23.5 when the logits were scaled by 0.9. The previous best single DNN scored 28.0.
- On WMT14 En-Fr, a 2.9B-parameter model trained for 3 epochs, taking 22 hours on 128 cores. It scored 43.9 BLEU, measured with sacrebleu. Gains on WMT14 En-De were smaller, likely because its training data is limited.
- On the Tensor2Tensor dataset languagemodel_wiki_noref_v128k_l1k, which contains about 5B tokens of Wikipedia text, subword perplexity kept improving with model size, reaching 6.01 at 4.9B parameters.
- The code is released at github.com/tensorflow/mesh. Planned future work includes automatic layout search, spatially partitioned convolutions, and SPMD support for CPU/GPU clusters.
Institutions
Fields, topics and concepts
Shelves 4The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksComputer Vision and Pattern Recognition · 3,621 worksHardware and Architecture · 183 worksComputer Networks and Communications · 115 works
Cite
Cite as Noam Shazeer, Youlong Cheng, Niki Parmar, Dustin Tran, Ashish Vaswani, Penporn Koanantakool, Peter Hawkins, HyoukJoong Lee, Mingsheng Hong, Cliff Young, Ryan Sepassi and Blake Hechtman. 2018. Mesh-TensorFlow: Deep Learning for Supercomputers. arXiv:1811.02084.
@misc{shazeer2018mesh,
title = {{Mesh-TensorFlow: Deep Learning for Supercomputers}},
author = {Noam Shazeer, Youlong Cheng, Niki Parmar, Dustin Tran, Ashish Vaswani, Penporn Koanantakool, Peter Hawkins, HyoukJoong Lee, Mingsheng Hong, Cliff Young, Ryan Sepassi and Blake Hechtman},
year = {2018},
doi = {10.48550/arxiv.1811.02084},
eprint = {1811.02084},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.1811.02084}
}References
- Jarle Berntsen. 1989. Communication efficient matrix multiplication on hypercubes. Parallel computing. OpenAlex ↗ · Scholar ↗
- M. Wolfe. 1989. More Iteration Space Tiling. Proceedings of the 1989 ACM/IEEE Conference on Supercomputing. doi:10.1145/76263.76337. OpenAlex ↗ · Scholar ↗
- Alok Aggarwal, Ashok\bibnamedelima K. Chandra, Marc Snir. 1990. Communication Complexity of PRAMs. Theor. Comput. Sci.. doi:10.1016/0304-3975(90)90188-N. OpenAlex ↗ · Scholar ↗
- Dror Irony, Sivan Toledo, Alexander Tiskin. 2004. Communication lower bounds for distributed-memory matrix multiplication. Journal of Parallel and Distributed Computing. OpenAlex ↗ · Scholar ↗
- Pitch Patarasuk, Xin Yuan. 2009. Bandwidth optimal all-reduce algorithms for clusters of workstations. Journal of Parallel and Distributed Computing. OpenAlex ↗ · Scholar ↗
- Nikhil Jain, Yogish Sabharwal. 2010. Y.: Optimal bucket algorithms for large mpi collectives on torus interconnects. In: Proceedings of the 24th ACM International Conference on Supercomputing. OpenAlex ↗ · Scholar ↗
- Grey Ballard, James Demmel, Olga Holtz, Oded Schwartz. 2011. Minimizing communication in numerical linear algebra. SIAM Journal on Matrix Analysis and Applications. OpenAlex ↗ · Scholar ↗
- Edgar Solomonik, James Demmel. 2011. Communication-Optimal Parallel 2.5D Matrix Multiplication and LU Factorization Algorithms. Euro-Par. OpenAlex ↗ · Scholar ↗
- Jeffrey Dean, Greg\bibnamedelima S. Corrado, Rajat Monga, Kai Chen, Matthieu Devin, Quoc\bibnamedelima V. Le, Mark\bibnamedelima Z. Mao, Marc'Aurelio Ranzato, Andrew Senior, Paul Tucker, Ke Yang, Andrew\bibnamedelima Y. Ng. 2012. Large Scale Distributed Deep Networks. Proceedings of the 25th International Conference on Neural Information Processing Systems - Volume 1. http://dl.acm.org/citation.cfm?id=2999134.2999271 OpenAlex ↗ · Scholar ↗
- Alex Krizhevsky, Ilya Sutskever, Geoffrey\bibnamedelima E Hinton. 2012. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems. our card
- Grey Ballard, Aydin Buluc, James Demmel, Laura Grigori, Benjamin Lipshitz, Oded Schwartz, Sivan Toledo. 2013. Communication optimal parallel multiplication of sparse random matrices. Proceedings of the twenty-fifth annual ACM symposium on Parallelism in algorithms and architectures. OpenAlex ↗ · Scholar ↗
- Michael Christ, James Demmel, Nicholas Knight, Thomas Scanlon, Katherine\bibnamedelima A. Yelick. 2013. Communication Lower Bounds and Optimal Algorithms for Programs That Reference Arrays - Part 1. http://www.eecs.berkeley.edu/Pubs/TechRpts/2013/EECS-2013-61.html OpenAlex ↗ · Scholar ↗
- James Demmel, David Eliahu, Armando Fox, Shoaib Kamil, Benjamin Lipshitz, Oded Schwartz, Omer Spillinger. 2013. Communication-optimal parallel recursive rectangular matrix multiplication. Parallel \& Distributed Processing (IPDPS), 2013 IEEE 27th International Symposium on. OpenAlex ↗ · Scholar ↗
- Edgar Solomonik, Devin Matthews, Jeff\bibnamedelima R Hammond, John\bibnamedelima F Stanton, James Demmel. 2014. A massively parallel tensor contraction framework for coupled-cluster computations. Journal of Parallel and Distributed Computing. OpenAlex ↗ · Scholar ↗
- Justus\bibnamedelima A. Calvin, Cannada\bibnamedelima A. Lewis, Edward\bibnamedelima F. Valeev. 2015. Scalable Task-based Algorithm for Multiplication of Block-rank-sparse Matrices. Proceedings of the 5th Workshop on Irregular Applications: Architectures and Algorithms. doi:10.1145/2833179.2833186. OpenAlex ↗ · Scholar ↗
- Martin\bibnamedelima Abadi, Ashish\bibnamedelima Agarwal, Paul\bibnamedelima Barham, Eugene\bibnamedelima Brevdo, Zhifeng\bibnamedelima Chen, Craig\bibnamedelima Citro, Greg\bibnamedelima S.\bibnamedelimi Corrado, Andy\bibnamedelima Davis, Jeffrey\bibnamedelima Dean, Matthieu\bibnamedelima Devin, Sanjay\bibnamedelima Ghemawat, Ian\bibnamedelima Goodfellow, Andrew\bibnamedelima Harp, Geoffrey\bibnamedelima Irving, Michael\bibnamedelima Isard, Yangqing Jia, Rafal\bibnamedelima Jozefowicz, Lukasz\bibnamedelima Kaiser, Manjunath\bibnamedelima Kudlur, Josh\bibnamedelima Levenberg, Dandelion\bibnamedelima Mané, Rajat\bibnamedelima Monga, Sherry\bibnamedelima Moore, Derek\bibnamedelima Murray, Chris\bibnamedelima Olah, Mike\bibnamedelima Schuster, Jonathon\bibnamedelima Shlens, Benoit\bibnamedelima Steiner, Ilya\bibnamedelima Sutskever, Kunal\bibnamedelima Talwar, Paul\bibnamedelima Tucker, Vincent\bibnamedelima Vanhoucke, Vijay\bibnamedelima Vasudevan, Fernanda\bibnamedelima Viégas, Oriol\bibnamedelima Vinyals, Pete\bibnamedelima Warden, Martin\bibnamedelima Wattenberg, Martin\bibnamedelima Wicke, Yuan\bibnamedelima Yu, Xiaoqiang\bibnamedelima Zheng. 2015. TensorFlow: Large-Scale Machine Learning on Heterogeneous Systems. https://www.tensorflow.org/ OpenAlex ↗ · Scholar ↗
- Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, Yonghui Wu. 2016. Exploring the Limits of Language Modeling. CoRR. http://arxiv.org/abs/1602.02410 our card
- Penporn Koanantakool, Ariful Azad, Aydın Buluç, Dmitriy Morozov, Sang-Yun Oh, Leonid Oliker, Katherine Yelick. 2016. Communication-Avoiding Parallel Sparse-Dense Matrix-Matrix Multiplication. 2016 IEEE International Parallel and Distributed Processing Symposium (IPDPS). doi:10.1109/IPDPS.2016.117. OpenAlex ↗ · Scholar ↗
- Amir Gholami, Ariful Azad, Kurt Keutzer, Aydin Buluc. 2017. Integrated Model and Data Parallelism in Training Neural Networks. arXiv preprint arXiv:1712.04432. OpenAlex ↗ · Scholar ↗
- Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc\bibnamedelima V. Le, Geoffrey\bibnamedelima E. Hinton, Jeff Dean. 2017. Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer. CoRR. http://arxiv.org/abs/1701.06538 OpenAlex ↗ · Scholar ↗
- Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan\bibnamedelima N. Gomez, Lukasz Kaiser, Illia Polosukhin. 2017. Attention Is All You Need. CoRR. http://arxiv.org/abs/1706.03762 our card
- James Demmel, Grace Dinh. 2018. Communication-Optimal Convolutional Neural Nets. arXiv preprint arXiv:1802.06905. OpenAlex ↗ · Scholar ↗
- Zhihao Jia, Matei Zaharia, Alex Aiken. 2018. Beyond Data and Model Parallelism for Deep Neural Networks. arXiv preprint arXiv:1807.05358. our card
- Zhihao Jia, Sina Lin, Charles\bibnamedelima R Qi, Alex Aiken. 2018. Exploring Hidden Dimensions in Parallelizing Convolutional Neural Networks. arXiv preprint arXiv:1802.04924. OpenAlex ↗ · Scholar ↗
- Peter Jin, Boris Ginsburg, Kurt Keutzer. 2018. Spatially Parallel Convolutions. https://openreview.net/forum?id=S1Yt0d1vG OpenAlex ↗ · Scholar ↗
- Penporn Koanantakool, Alnur Ali, Ariful Azad, Aydin Buluc, Dmitriy Morozov, Leonid Oliker, Katherine Yelick, Sang-Yun Oh. 2018. Communication-Avoiding Optimization Methods for Distributed Massive-Scale Sparse Inverse Covariance Estimation. Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics. http://proceedings.mlr.press/v84/koanantakool18a.html OpenAlex ↗ · Scholar ↗
This page in Markdown https://md.research.elamur.ai/free/en/papers/shazeer-2018-mesh-tensorflow-deep-learning-supercomputers/