Archive of AI

Source Snapshot / 2020-02-13-microsoft-deepspeed-zero-1

ZeRO & DeepSpeed: New system optimizations enable training models with over 100 billion parameters

Linked event: 2020-02-13 · Microsoft Open-Sources DeepSpeed and ZeRO Memory Optimization Framework, Breaking Barriers to Training 10B-to-Trillion-Parameter Models

Publisher
Microsoft Research Blog
Archived
2026-11-23
Capture Method
Direct page capture
HTTP / SHA-256
200 / 269ec52744f68480
Original URL
Open source ↗
Wayback Backup
Not archived
This page preserves a plain-text static snapshot against link rot. When citing figures, tables, or full legal terms, verify against the original URL and Wayback Machine archive.

[来源关键摘录] Microsoft introduces DeepSpeed and ZeRO, enabling efficient training of models with over 100 billion parameters while dramatically reducing memory footprint.

[正文前段节选] Publications

Code, datasets and models

Artificial intelligence

Audio & acoustics

Computer vision

Graphics & multimedia

Human-computer interaction

Human language technologies

Search & information retrieval

Data platforms and analytics

Hardware & devices

Programming languages & software engineering

Quantum computing

Security, privacy & cryptography

Systems & networking

Ecology & environment

Medical, health & genomics

Social sciences

Technology for emerging markets

Academic programs

Events & academic conferences

Microsoft Research Forum

Microsoft Research Blog

Microsoft Research Podcast

Microsoft Research Stories

About Microsoft Research

Careers & internships

News & awards

AI for Science

Asia-Pacific

Catalyst Lab

New York City

Register: Research Forum

Microsoft Security

Dynamics 365

Microsoft 365

Microsoft Teams

Microsoft AI

Mixed reality

Microsoft HoloLens

Microsoft Viva

Sustainability

Financial services

Manufacturing

Find a partner

Become a partner

Partner Network

Microsoft Marketplace

Software companies

Microsoft Advertising

Developer Center

Documentation

Microsoft Learn

Microsoft Research

View Sitemap

Return to Blog Home

ZeRO & DeepSpeed: New system optimizations enable training models with over 100 billion parameters

February 13, 2020

DeepSpeed Team

Rangan Majumder

Distinguished Engineer

Share this page

Share on Facebook

Share on LinkedIn

Share on Reddit

Subscribe to our RSS feed

The latest trend in AI is that larger natural language models provide better accuracy; however, larger models are difficult to train because of cost, time, and ease of code integration. Microsoft is releasing an open-source library called DeepSpeed (opens in new tab), which vastly advances large model training by improving scale, speed, cost, and usability, unlocking the ability to train 100-billion-parameter models. DeepSpeed is compatible with PyTorch (opens in new tab). One piece of that library, called ZeRO, is a new parallelized optimizer that greatly reduces the resources needed for model and data parallelism while massively increasing the number of parameters that can be trained. Researchers have used these breakthroughs to create Turing Natural Language Generation (Turing-NLG), the largest publicly known language model at 17 billion parameters, which you can learn more about in this accompanying blog post.

The Zero Redundancy Optimizer (abbreviated ZeRO) is a novel memory optimization technology for large-scale distributed deep learning. ZeRO can train deep learning models with 100 billion parameters on the current generation of GPU clusters at three to five times the throughput of the current best system. It also presents a clear path to training models with trillions of parameters, demonstrating an unprecedented leap in deep learning system technology. We are releasing ZeRO as part of DeepSpeed, our high-performance library for accelerating distributed deep learning training.

Challenges of training large deep learning models

Large models offer significant accuracy gains, but training billions to trillions of parameters frequently runs up against fundamental hardware limitations. To fit these models into memory, existing solutions make trade-offs between computation, communication, and development efficiency:

• Data parallelism does not help reduce memory footprint per device: a model with more than 1 billion parameters runs out of memory even on GPUs with 32GB of memory.

• Model parallelism does not scale efficiently beyond a single node due to fine-grained computation and expensive communication. Model parallelism frameworks frequently require extensive code integration that may be model architecture specific.  For example, the NVIDIA Megatron-LM (opens in new tab) set a new model size record of 8.3 billion parameters.  It scales very well for such a model that fits in multiple GPUs of a single node, but when scaling across nodes, its performance degrades. For example, we observe about five teraflops/GPU when running 40 billion parameters across NVIDIA DGX-2 nodes.

Overcoming limitations of data parallelism and model parallelism with ZeRO

We developed ZeRO to conquer the limitations of data parallelism and model parallelism while achieving the merits of both. ZeRO removes the memory redundancies across data-parallel processes by partitioning the model states—parameters, gradients, and optimizer state—across data parallel processes instead of replicating them. It uses a dynamic communication schedule during training to share the necessary state across distributed devices to retain the computational granularity and communication volume of data parallelism.

We call this ZeRO-powered data parallelism, which allows per-device memory usage to scale linearly with the degree of data parallelism and incurs similar communication volume as data parallelism. ZeRO-powered data parallelism can fit models of arbitrary size—as long as the aggregated device memory is large enough to share the model states.

The three stages of ZeRO and its benefits

ZeRO has three main optimization stages (as depicted in Figure 1), which correspond to the partitioning of optimizer states, gradients, and parameters. When enabled cumulatively:

1. Optimizer State Partitioning (Pos) – 4x memory reduction, same communication volume as data parallelism

2. Add Gradient Partitioning (Pos+g) – 8x memory reduction, same communication volume as data parallelism

3. Add Parameter Partitioning (Pos+g+p) – Memory reduction is linear with data parallelism degree Nd. For example, splitting across 64 GPUs (Nd = 64) will yield a 64x memory reduction. There is a modest 50% increase in communication volume.

ZeRO eliminates memory redundancies and makes the full aggregate memory capacity of a cluster available. With all three stages enabled, ZeRO can train a trillion-parameter model on just 1024 NVIDIA GPUs. A trillion-parameter model with an optimizer like Adam (opens in new tab) in 16-bit precision requires approximately 16 terabytes (TB) of memory to hold the optimizer states, gradients, and parameters. 16TB divided by 1024 is 16GB, which is well within a reasonable bound for a GPU.

Figure 1: Memory savings and communication volume for the three stages of ZeRO compared with standard data parallel baseline. In the memory consumption formula, Ψ refers to the number of parameters in a model and K is the optimizer specific constant term. As a specific example, we show the memory consumption for a 7.5B parameter model using Adam (opens in new tab) optimizer where K=12 on 64 GPUs. We also show the communication volume of ZeRO relative to the baseline.

The video below shows how ZeRO (with all three stages) performs a training step including forward pass, backward pass, and parameter update.

https://www.microsoft.com/en-us/research/wp-content/uploads/2020/02/Turing-Animation.mp4

DeepSpeed: PyTorch compatibility and system performance

We implemented ZeRO stage one — optimizer states partitioning (ZeRO-OS in short) — which has a demonstrated capability to support 100-billion-parameter models. The code is being released together with our training optimization library, DeepSpeed. DeepSpeed brings state-of-the-art training techniques, such as ZeRO, distributed training, mixed precision, and checkpointing, through lightweight APIs compatible with PyTorch (opens in new tab). With just a few lines of code changes to your PyTorch model, you can leverage DeepSpeed to address the underlying performance challenges and boost the speed and scale of your training.

DeepSpeed excels in four aspects (as visualized in Figure 2):

[...内容已截断,完整版请查看原文或 Wayback 快照]