Skip to main content
Vantaige
DeepSpeed screenshot
D

DeepSpeed

Free

DeepSpeed is Microsoft's open-source deep learning optimization library for training and running large language models across multiple GPUs. It powers BLOOM 176B, Megatron-Turing 530B, and countless fine-tuning pipelines via its ZeRO memory optimizer.

Features:Open SourceAPI

DeepSpeed is a deep learning optimization library built on top of PyTorch, developed by Microsoft and released publicly in 2020 under the Apache 2.0 license. It solves one specific, hard problem: making it possible to train and run language models that are too large to fit on any single GPU, or any single node, without requiring teams to build custom distributed systems from scratch. With 42,000+ GitHub stars and a version history extending to v0.18.9 (March 2026), it is the most widely adopted general-purpose distributed training framework in open-source ML.

DeepSpeed's flagship technology is the ZeRO optimizer (Zero Redundancy Optimizer), which eliminates the memory redundancy that normally occurs when model states are duplicated across data-parallel GPUs. ZeRO Stage 1 shards optimizer states across GPUs, Stage 2 adds gradient sharding, and Stage 3 shards model parameters themselves. ZeRO-Infinity extends this by offloading to CPU RAM and NVMe SSD, enabling fine-tuning of trillion-parameter models on hardware that would otherwise fall far short. Beyond ZeRO, DeepSpeed provides pipeline parallelism, automatic tensor parallelism (AutoTP, launched March 2025), Mixture of Experts training, sequence parallelism for multi-million token contexts, and an inference engine with kernel fusion and quantization. It integrates natively with Hugging Face Transformers and Accelerate, PyTorch Lightning, and the EleutherAI GPT-NeoX stack.

What DeepSpeed actually does in May 2026

DeepSpeed is a Python library you install alongside PyTorch. You pass it a JSON configuration file (ds_config.json) specifying which ZeRO stage to use, whether to offload optimizer states or parameters to CPU, whether to use mixed precision, and dozens of other tuning parameters. You then wrap your training loop with the DeepSpeed engine. At that point, DeepSpeed handles parameter sharding across GPUs, gradient communication, memory management, and checkpoint saving automatically.

The ZeRO optimizer is the heart of the system. Before ZeRO, training a 13B model in float16 required approximately 26GB per GPU just for model weights, plus optimizer states (Adam's moment estimates add roughly 3x the model size) and gradients, pushing total per-GPU memory requirements to 80GB or more for a single replica. ZeRO Stage 3 shards all of this across N GPUs, so a 13B model across 8 x 40GB A100s needs roughly 5GB per GPU for parameters, making headroom for batch size and activations. This is the mechanism that enabled teams with modest GPU budgets to run pre-training and fine-tuning jobs that previously required specialized infrastructure.

ZeRO-Infinity, announced in May 2021, demonstrated training a 32 trillion parameter model on 32 GPUs by offloading to NVMe. That remains the theoretical ceiling for what the system can coordinate. In practice, most production users run ZeRO-2 or ZeRO-3 with CPU offloading on clusters of 8 to 256 GPUs for models in the 7B-70B range.

Recent additions include DeepCompile (April 2025), which applies compiler-level optimizations to distributed training graphs; Arctic Long Sequence Training (June 2025) for multi-million token sequence support; AutoTP for automatic tensor parallelism with Hugging Face models (March 2025); and the ZenFlow stall-free offloading engine (August 2025). The SuperOffload work received an Honorable Mention at ASPLOS 2026, the top systems conference.

DeepSpeed-Chat, released April 12, 2023, was a landmark: an end-to-end RLHF pipeline covering supervised fine-tuning, reward model training, and PPO, all in a single script. The system trained a 13B model in 1.25 hours on a single A6000 GPU and a 175B model in one day on 64 GPUs, claiming 15x throughput over trlX and trl. The April 2023 Hacker News launch thread drew hundreds of comments debating whether open-source RLHF could realistically reach GPT-4 quality:

"Fine-tuning won't reach GPT-4 quality without larger base models and extensive optimization." -- valine, Hacker News, April 12, 2023

That debate was prescient. DeepSpeed-Chat lowered the barrier to RLHF training enough that teams previously priced out of the space could iterate. The gap to frontier models has narrowed substantially since 2023, partly because of infrastructure tools like this one.

Where DeepSpeed sits versus PyTorch FSDP and Megatron-LM

DeepSpeed does not exist in a vacuum. Two frameworks compete for the same training workloads, and the honest answer about which to use depends heavily on model size, hardware, and team familiarity.

PyTorch FSDP (Fully Sharded Data Parallel) is built into PyTorch core as of version 1.12 and implements ZeRO-style parameter sharding natively inside the runtime. FSDP's advantage is simplicity and raw throughput at mid-scale. Independent benchmarks show FSDP running up to 5x faster per iteration than DeepSpeed ZeRO-3 for models in the 100M-1B range, because native PyTorch integration avoids Python-level overhead and uses optimized fused reduce-scatter paths. FSDP configuration lives in Python code with no external JSON file. The practical tradeoff: FSDP cannot offload to NVMe, so it is limited by total GPU+CPU RAM. For models that fit within that envelope (under roughly 30B at float16 on a well-equipped node), FSDP is increasingly the default choice in Hugging Face Trainer and TorchTitan. DeepSpeed wins when NVMe offloading or ZeRO-Infinity-class memory is needed, and at 10B+ parameters where its mature ZeRO-3 implementation and pipeline parallelism become competitive again.

Megatron-LM is NVIDIA's research framework for training transformer models at extreme scale with hand-tuned tensor parallelism kernels. Megatron-LM's tensor-parallel (TP) implementation is the most thoroughly optimized for NVIDIA A100/H100 hardware with NVLink. Its model architectures (GPT, BERT, T5) are specifically built for TP; every attention head and MLP weight matrix is split across GPUs with custom CUDA kernels. The limitation is tight architecture coupling: running a novel model architecture through Megatron requires significant engineering effort. DeepSpeed's AutoTP, by contrast, handles tensor parallelism more automatically for Hugging Face models. Critically, Megatron-LM and DeepSpeed are not strict competitors: the Megatron-Turing NLG 530B model (the largest publicly documented dense model training run) used Megatron-LM for tensor parallelism within nodes and DeepSpeed ZeRO for data parallelism across nodes. Users who need the absolute ceiling of NVIDIA-specific throughput often combine both.

If you are using Anyscale or Ray Train for distributed workloads, DeepSpeed integrates via the Ray-DeepSpeed interface, which the teams demoed at a joint meetup in October 2025. For experiment tracking and model versioning alongside training, teams pair DeepSpeed with MLflow. For inference serving of the trained models, vLLM is the dominant choice, though DeepSpeed's own inference engine remains competitive for offline batch processing. Fine-tuned LLaMA-series models are one of the most common DeepSpeed workloads in the open-source community.

What the training workflow reality looks like

The gap between the documentation and the day-to-day experience of running DeepSpeed is real, and anyone writing about this tool honestly has to address it.

Setting up a ZeRO-3 training run from scratch involves writing a ds_config.json file with dozens of parameters: ZeRO stage, offload device (CPU or NVMe), allgather bucket size, reduce bucket size, stage3_gather_16bit_weights_on_model_save, overlap_comm, and so on. The parameter names are not always intuitive. A misplaced comma, a misspelled field, or a mismatch between the optimizer type in the config and the optimizer instantiated in Python will silently prevent training from starting or, worse, will start training and then crash mid-epoch. This is the most common category of support request in the DeepSpeed GitHub issues.

Performance regression across library versions is a documented concern. GitHub issue #7499 records a 10% training throughput regression in ZeRO-3 between v0.13.1 and v0.15.4 through v0.16.9 on 8x A100 setups, with the ZeRO-1 and ZeRO-2 configurations unaffected:

"After upgrading DeepSpeed, when using the DeepSpeed Zero3 configuration, the training performance deteriorated by about 10% compared to version 0.13.1." -- frozenleaves, GitHub deepspeedai/DeepSpeed issue #7499, 2024

This kind of regression is a serious problem for production pipelines that depend on stable throughput. The mitigation most teams use is dependency pinning, but that creates its own maintenance burden.

Pipeline parallelism (PP) in DeepSpeed requires modifying model architecture code to define layer boundaries explicitly. This is nontrivial for anything that is not a standard GPT-style transformer. ZeRO-3, by contrast, is architecture-agnostic, which is why most teams reach for ZeRO-3 + data parallelism before considering PP.

GPU utilization with ZeRO-3 on small models or small clusters can be poor. GitHub discussion #5488 documents fragmented all-gathers failing to overlap with compute on multi-node runs with smaller models. The remedy is typically to use ZeRO-2 or switch to FSDP for that scale, but diagnosing the utilization problem in the first place requires profiling tools (Nsight, PyTorch Profiler) that have their own learning curves.

When it works well, it is genuinely transformative. Running a 70B parameter model on 8 A100-80GB GPUs with ZeRO-3 is a qualitatively different capability than anything available to researchers five years ago. The friction exists, but it is proportional to the scale of what the tool enables.

Who DeepSpeed is built for

DeepSpeed is built for ML engineers and researchers who need to train or fine-tune large language models (7B+) on multi-GPU infrastructure. The typical user has working knowledge of PyTorch, has hit GPU memory limits with naive data-parallel training, and is willing to invest 1-2 days in configuration and debugging to unlock training at a scale that was otherwise impossible.

Teams at research institutions (EleutherAI used it for GPT-NeoX, BigScience for BLOOM), large tech companies (LinkedIn documented using ZeRO++ for LLM distillation for recommendation systems in November 2025), and well-funded startups doing instruction-tuning, RLHF, or pre-training all land in this bucket. The Hugging Face Accelerate integration means you can add DeepSpeed to many existing training scripts with minimal code changes, which broadens accessibility somewhat.

What DeepSpeed is not

DeepSpeed is not a good fit for models under 1B parameters. At that scale, FSDP is simpler to configure, faster in practice, and built into PyTorch. The overhead of setting up ds_config.json and the risk of version-related regressions is not justified when the model fits on two or three standard GPUs already.

It is not a hosted service or a cloud platform. There is no DeepSpeed SaaS. You bring your own compute. Azure, AWS, GCP, or on-premise clusters all work, but operational responsibility is entirely yours.

It is not an inference serving system for live API traffic. DeepSpeed's inference engine is designed for throughput-optimized batch inference, not for low-latency request serving. For production inference APIs, vLLM is the dominant choice. DeepSpeed Inference is useful for offline batch jobs where the cost of continuous batching infrastructure is not justified.

It is not a beginner-friendly tool. The documentation is thorough but assumes familiarity with distributed systems concepts (NCCL, collective operations, memory hierarchies). Researchers new to distributed training are better served starting with Hugging Face Accelerate's simpler interface, then adding DeepSpeed configuration once they understand what the parameters mean.

It is also not a drop-in replacement for Megatron-LM on NVIDIA hardware at extreme scale. For 500B+ dense models where FLOP throughput is the binding constraint, Megatron-LM's tensor-parallel kernels are hard to beat. DeepSpeed wins when memory flexibility and cross-hardware portability matter more than peak throughput.

User Reviews

No reviews yet. Be the first to share your experience!

Sign in to write a review.

Featured in collections

Curated lists that include DeepSpeed.

Related articles

Guides and articles related to DeepSpeed.