talira

DeepSpeed

Deep learning optimization library for training and serving very large models

open sourceApache-2.0free

DeepSpeed is a deep learning optimization library for PyTorch that makes training and inference of very large models faster and cheaper. Its ZeRO family of optimizations (ZeRO, ZeRO-Offload, ZeRO-Infinity, ZeRO++) splits optimizer states, gradients and parameters across GPUs and offloads them to CPU and NVMe, alongside 3D parallelism, Ulysses sequence parallelism and mixture-of-experts training. It was used to train models such as Megatron-Turing NLG 530B and BLOOM, works with Hugging Face Accelerate and PyTorch Lightning, runs on NVIDIA and AMD GPUs with contributed support for Intel Gaudi and other accelerators, and began as part of Microsoft's AI at Scale initiative.

Problems it solves

  • my model doesn't fit in GPU memory when I fine-tune it
  • train a multi-billion-parameter LLM across many GPUs
  • cut GPU memory use during PyTorch training by offloading to CPU

Features

  • train models too big for one GPU with ZeRO sharding
  • offload optimizer states and parameters to CPU and NVMe
  • 3D, tensor and sequence parallelism
  • mixture-of-experts training
  • integrates with Hugging Face Transformers, Accelerate and Lightning

Limitations

  • PyTorch must be installed first, and its C++/CUDA extensions are compiled on first use, which needs a CUDA or ROCm compiler.1
  • Async I/O and GPUDirect Storage aren't supported on Windows.1

Alternatives

The same job

These do what DeepSpeed does.

  1. Colossal-AI PyTorch library for distributed training, fine-tuning and inference of large AI models
  2. Accelerate Hugging Face's library to run the same PyTorch code on any distributed setup
  3. PyTorch Lightning Organises PyTorch code and handles the training engineering, from one CPU to thousands of GPUs
  4. MiniMind Train a 64M-parameter language model from scratch in about two hours

Compare DeepSpeed with the top 3