Gradient descent at scale

Practical implementation of large optimisations

July 14, 2021 — September 28, 2021

functional analysis
machine learning
model selection
optimization
premature optimization
statmech
Figure 1

There are many ways we can try to expand a neural model beyond the limits of a single GPU. Obviously the details are complicated. But Lilian Weng has explained it all for us. See How to Train Really Large Models on Many GPUs?.

1 General compute node provisioning

See practical cloud ml.

2 Basic multi-GPU

DDP and other multi-GPU techniques.

Various frameworks have different solutions for this, e.g. pytorch-lighting brings basic DDP to pytorch. There are also generic ones. Prominently, Horovod.

2.1 Horovod

Horovod is a distributed deep learning training framework for TensorFlow, Keras, PyTorch, and Apache MXNet. (source.).

With Horovod, an existing training script can be scaled up to run on hundreds of GPUs in just a few lines of Python code. Horovod can be installed on-premise or run out-of-the-box in cloud platforms, including AWS, Azure, and Databricks. Horovod can additionally run on top of Apache Spark, making it possible to unify data processing and model training into a single pipeline. Once Horovod has been configured, the same infrastructure can be used to train models with any framework, making it easy to switch between TensorFlow, PyTorch, MXNet, and future frameworks as machine learning tech stacks continue to evolve.

3 Extremely large models

Little to say here for now but I need to remember various terms for later use. ZeRO and other methods of efficient parallel/sharded gradient descent to enable much larger models for a fixed GPU memory budget.

4 Incoming

  • How to Train Really Large Models on Many GPUs?

  • Colossal-AI Overview

    Colossal-AI is designed to be a unified system to provide an integrated set of training skills and utilities to the user. You can find the common training utilities such as mixed precision training and gradient accumulation. Besides, we provide an array of parallelism including data, tensor and pipeline parallelism. We optimize tensor parallelism with different multi-dimensional distributed matrix-matrix multiplication algorithm. We also provided different pipeline parallelism methods to allow the user to scale their model across nodes efficiently. More advanced features such as offloading can be found in this tutorial documentation in detail as well.

5 References

Kumar, Bradbury, Young, et al. 2020. Exploring the Limits of Concurrency in ML Training on Google TPUs.” arXiv:2011.03641 [Cs].
Rajbhandari, Rasley, Ruwase, et al. 2020. ZeRO: Memory Optimizations Toward Training Trillion Parameter Models.” arXiv:1910.02054 [Cs, Stat].
Rajbhandari, Ruwase, Rasley, et al. 2021. ZeRO-Infinity: Breaking the GPU Memory Wall for Extreme Scale Deep Learning.” arXiv:2104.07857 [Cs].
Rasley, Rajbhandari, Ruwase, et al. 2020. DeepSpeed: System Optimizations Enable Training Deep Learning Models with Over 100 Billion Parameters.” In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. KDD ’20.
Ren, Rajbhandari, Aminabadi, et al. 2021. ZeRO-Offload: Democratizing Billion-Scale Model Training.” arXiv:2101.06840 [Cs].
Tang, Gan, Awan, et al. 2021. 1-Bit Adam: Communication Efficient Large-Scale Training with Adam’s Convergence Speed.” arXiv:2102.02888 [Cs].
Zhang, and He. 2020. Accelerating Training of Transformer-Based Language Models with Progressive Layer Dropping.” Advances in Neural Information Processing Systems.