ZeRO: Memory Optimizations Toward Training Trillion Parameter Models
ZeRO partitions model states to enable trillion-parameter training with reduced memory and high efficiency.
Key Findings
Methodology
ZeRO employs a three-stage model state partitioning (Pos, Pg, Pp), dividing optimizer states, gradients, and parameters across devices. Combining activation checkpointing and fragmentation management (ZeRO-R), it optimizes residual memory. The design ensures low communication overhead, high computational granularity, supporting scale-up to trillion parameters. Experiments on 400 GPUs show super-linear speedup, achieving 15 Petaflops throughput, with model size increased 8-fold and performance 10-fold over SOTA.
Key Results
- ZeRO trained models over 100B parameters on 400 GPUs, reaching 15 Petaflops, outperforming existing methods with 8x larger models and 10x faster training.
- Able to train 13B parameter models without model parallelism, surpassing Megatron GPT 8.3B and T5 11B, simplifying large model training.
- Researchers built a 17B parameter Turing-NLG model with record-breaking accuracy, demonstrating ZeRO’s scalability and effectiveness.
Significance
This breakthrough significantly advances large-scale model training, addressing GPU memory bottlenecks, reducing complexity, and enabling the development of trillion-parameter models. It impacts AI research and industry by making large models more accessible, fostering innovations in NLP, CV, and beyond. The approach democratizes AI development, reducing reliance on specialized hardware and complex parallelism, thus accelerating AI adoption worldwide.
Technical Contribution
ZeRO introduces a novel model state partitioning framework, eliminating redundant storage of optimizer states, gradients, and parameters. Its multi-phase strategy (Pos, Pg, Pp) coupled with activation and fragmentation management offers a comprehensive memory reduction solution. The system maintains high computational efficiency and low communication overhead, enabling training of models previously deemed infeasible on existing hardware. Theoretical analysis confirms its scalability and efficiency, opening new avenues for large model training.
Novelty
ZeRO is the first systematic approach to partition all model states dynamically, reducing memory footprint without complex model restructuring. Unlike traditional model parallelism, ZeRO simplifies large model training by avoiding extensive model modifications, making it accessible and scalable. Its combination of state partitioning, activation checkpointing, and memory defragmentation represents a fundamental innovation in distributed training.
Limitations
- While ZeRO reduces memory, communication costs may still limit scaling at extreme sizes, especially across multiple nodes with limited bandwidth.
- Partitioning introduces synchronization overhead, potentially affecting training speed in some scenarios.
- Dependence on hardware characteristics remains; heterogeneous environments require further optimization for robustness.
Future Work
Future efforts will focus on extending ZeRO to support even larger models beyond trillion parameters, optimizing communication strategies, and integrating with heterogeneous hardware like TPUs and FPGAs. Developing adaptive partitioning and asynchronous communication mechanisms will further improve scalability and efficiency, making large-scale AI more practical and accessible.
AI Executive Summary
As deep learning models grow exponentially, their training becomes increasingly constrained by hardware memory and communication bottlenecks. Traditional parallelization techniques such as data parallelism (DP) and model parallelism (MP) face limitations at the scale of hundreds of billions to trillions of parameters. DP suffers from redundant memory usage, while MP incurs high communication overhead, especially across multiple nodes. To address these challenges, this work introduces ZeRO (Zero Redundancy Optimizer), a novel framework that partitions model states—optimizer states, gradients, and parameters—across devices, eliminating redundancy and drastically reducing memory footprint.
ZeRO’s core innovation lies in its multi-phase partitioning strategy: Pos, Pg, and Pp, which progressively divide optimizer states, gradients, and parameters, respectively. This approach, combined with activation checkpointing and memory defragmentation (ZeRO-R), enables training models with over 100 billion parameters efficiently on current hardware. Experimental results demonstrate that ZeRO achieves super-linear scalability, with 15 Petaflops throughput on 400 GPUs, and supports training models up to 13 billion parameters without model parallelism. Notably, researchers successfully trained a 17B parameter Turing-NLG model with record-breaking accuracy.
This breakthrough significantly lowers the barrier to large-scale AI research and deployment, democratizing access to trillion-parameter models. It reduces reliance on complex model parallelism, simplifies training workflows, and accelerates innovation across NLP, computer vision, and other domains. Despite these advances, challenges remain in further reducing communication overhead at larger scales and optimizing heterogeneous hardware support. Future work will focus on scaling ZeRO beyond trillion parameters, refining communication strategies, and broadening hardware compatibility, paving the way for the next era of AI development.
Deep Analysis
Background
The evolution of deep learning has seen models rapidly scale from millions to hundreds of billions of parameters, driven by architectures like BERT, GPT, and T5. These models have achieved remarkable performance improvements but at the cost of exponentially increased computational and memory demands. Existing distributed training methods, including data parallelism and model parallelism, have limitations: data parallelism leads to redundant memory usage, while model parallelism incurs high communication costs and complexity. Recent efforts like Megatron-LM and T5 have pushed boundaries but still face scalability issues beyond 100B parameters. As models approach trillion parameters, the need for efficient memory utilization and communication reduction becomes critical. Hardware constraints, such as GPU memory limits and inter-GPU bandwidth, further complicate large-scale training. Addressing these challenges requires innovative memory management and parallelization strategies to make training of trillion-parameter models feasible and efficient.
Core Problem
The main challenge in training trillion-parameter models lies in the enormous memory footprint of model states—parameters, gradients, and optimizer states—exceeding the capacity of current hardware. Traditional data parallelism replicates entire model states across devices, leading to significant redundancy. Model parallelism partitions models but introduces high communication overhead and complexity, especially for large models. Additionally, residual memory consumption from activations, temporary buffers, and fragmentation further constrains scalability. Existing solutions cannot efficiently scale beyond certain thresholds due to these bottlenecks, limiting the development of larger models that could potentially yield better accuracy and generalization. Overcoming these issues requires a fundamentally different approach to memory management and parallelization.
Innovation
ZeRO’s core innovation is the comprehensive partitioning of model states—optimizer states, gradients, and parameters—across devices, eliminating redundant copies. Its multi-phase strategy (Pos, Pg, Pp) enables linear memory reduction proportional to the number of devices, supporting models with trillions of parameters. ZeRO also introduces activation checkpointing and memory defragmentation (ZeRO-R), which optimize residual memory from activations and temporary buffers. The system maintains high computational granularity and low communication volume through dynamic scheduling, ensuring efficiency. Unlike traditional MP or DP, ZeRO simplifies large model training by avoiding complex model restructuring, making it accessible and scalable on existing hardware. Theoretical analysis confirms its ability to support models beyond 1 trillion parameters, marking a paradigm shift in distributed training.
Methodology
- �� Implement three-stage model state partitioning: Pos divides optimizer states, Pg partitions gradients, Pp splits parameters, each reducing memory redundancy.
- �� Use dynamic communication scheduling to synchronize states efficiently, exploiting temporal dependencies.
- �� Integrate activation checkpointing to reduce activation memory, selectively offloading to CPU when needed.
- �� Manage memory fragmentation through on-the-fly defragmentation, consolidating small memory blocks into contiguous buffers.
- �� Support hybrid parallelism by combining ZeRO with model parallelism when necessary.
- �� Optimize for high arithmetic intensity models, ensuring minimal communication overhead and maximal hardware utilization.
- �� Validate on large NLP models (T5, GPT) with experiments measuring throughput, memory savings, and convergence.
- �� Analyze theoretical bounds and practical scalability to support models exceeding 1 trillion parameters.
Experiments
Experiments conducted on clusters with up to 400 GPUs (e.g., NVIDIA V100), training models from 100B to 170B parameters. Baselines include Megatron-LM and traditional DP/MP approaches. Metrics include training throughput, memory consumption, and model accuracy. Ablation studies assess the impact of each ZeRO component (Pos, Pg, Pp, ZeRO-R). Hyperparameters such as batch size, learning rate, and partition degree are tuned for optimal performance. Results demonstrate super-linear scalability, with training speeds exceeding 38 TFlops per GPU for 60B models, and consistent memory reduction proportional to device count. The system successfully trains a 17B model with record accuracy, validating the approach’s effectiveness.
Results
ZeRO achieves 15 Petaflops throughput on 400 GPUs, enabling training of models over 100B parameters with 8x larger size than SOTA. It supports training 13B parameter models without model parallelism, reducing complexity. The 17B Turing-NLG model trained with ZeRO surpasses previous benchmarks in accuracy. Super-linear speedup observed across 64-400 GPUs, with performance more than doubling when doubling GPU count. Memory savings are linear with the number of devices, allowing models to fit within existing hardware constraints. These results demonstrate ZeRO’s potential to democratize large-scale AI training, making trillion-parameter models feasible on commodity hardware.
Applications
ZeRO is applicable in training large NLP models, computer vision systems, and multimodal AI, where massive model sizes improve performance. It enables researchers and industry practitioners to train models previously limited by hardware memory, reducing costs and complexity. The approach facilitates rapid experimentation with large architectures, accelerating AI innovation. In industry, ZeRO can be integrated into AI pipelines for scalable deployment, supporting personalized models and large-scale inference. Its flexibility allows combining with model parallelism for even larger models, broadening application scenarios.
Limitations & Outlook
Despite significant memory savings, communication overhead can still limit scalability at extremely large scales, especially across multiple nodes with limited bandwidth. Partitioning introduces synchronization delays, potentially affecting training speed. The system relies on hardware-specific optimizations, requiring further work for heterogeneous environments. Future improvements include adaptive partitioning, asynchronous communication, and better fault tolerance to support even larger models and more diverse hardware setups.
Plain Language Accessible to non-experts
想象你在一家大工厂里,制造一辆复杂的汽车。以前,每个工人都带着全部零件(模型参数、梯度和优化信息),这样空间很快就用完了。现在,工厂引入了新方法,把零件分成几份,只让每个工人带自己负责的那部分。这样一来,空间大大节省,还能更快完成汽车。工人们还会互相交换信息,确保每个部分都拼装完整。ZeRO就像这样,把模型的所有信息拆开,避免重复存放,让训练变得更快、更大。这就像用更少空间拼出更复杂的汽车,科学家们也能用普通电脑训练出更强大的AI模型。
ELI14 Explained like you're 14
想象你在学校里做一个超级大的拼图,拼图块很多,每块都很大。如果每个学生都带着全部拼图去拼,空间会很快用完。而如果你把拼图分成几部分,每个学生只带自己负责的那一部分,就能节省空间,还能更快完成拼图。大家还会互相交换拼图信息,确保拼得完整。这就像ZeRO,把模型的参数、梯度和优化信息分成不同部分,避免重复存放,让训练变得更快、更大。这样,科学家们就可以用普通的电脑训练出比以前更大的AI模型,就像用更少空间拼出更复杂的拼图一样。
Glossary
模型状态 (Model States)
指训练中的参数、梯度和优化器的内部信息,用于模型更新。技术上包括参数(parameters)、梯度(gradients)和优化器状态(optimizer states)。
ZeRO通过分区模型状态,减少内存冗余。
模型并行 (Model Parallelism)
将模型的不同部分分布到多个设备上并行计算,以应对模型过大无法在单一设备上训练的问题。技术上包括垂直切分(layer-wise)和水平切分(tensor-wise)。
传统模型并行在大模型训练中应用,但通信成本高。
数据并行 (Data Parallelism)
将训练数据划分到多个设备上,每个设备拥有完整模型副本,分别计算梯度后同步更新。适合模型较小但数据量大的场景。
ZeRO优化了数据并行的内存效率。
激活 (Activations)
在神经网络中,前向传播时产生的中间输出,用于反向传播计算梯度。占用大量内存。
ZeRO通过分区激活减少内存占用。
碎片化 (Fragmentation)
内存中未连续空间的零散分布,导致无法有效利用全部内存资源。
ZeRO通过内存整理减少碎片化。
Open Questions Unanswered questions from this research
- 1 未来在异构硬件环境中优化ZeRO的通信调度和容错机制仍是研究重点。
Applications
Immediate Applications
大规模NLP模型训练
企业和研究机构可利用ZeRO在普通GPU集群上训练亿级参数模型,降低硬件成本,加快研发。
模型训练自动化平台
集成ZeRO的训练框架简化大模型训练流程,降低技术门槛,推动AI普及。
Long-term Vision
万亿参数模型普及
未来ZeRO支持更大规模模型,推动AI在各行业深度应用,实现智能化变革。
Abstract
Large deep learning models offer significant accuracy gains, but training billions to trillions of parameters is challenging. Existing solutions such as data and model parallelisms exhibit fundamental limitations to fit these models into limited device memory, while obtaining computation, communication and development efficiency. We develop a novel solution, Zero Redundancy Optimizer (ZeRO), to optimize memory, vastly improving training speed while increasing the model size that can be efficiently trained. ZeRO eliminates memory redundancies in data- and model-parallel training while retaining low communication volume and high computational granularity, allowing us to scale the model size proportional to the number of devices with sustained high efficiency. Our analysis on memory requirements and communication volume demonstrates: ZeRO has the potential to scale beyond 1 Trillion parameters using today's hardware. We implement and evaluate ZeRO: it trains large models of over 100B parameter with super-linear speedup on 400 GPUs, achieving throughput of 15 Petaflops. This represents an 8x increase in model size and 10x increase in achievable performance over state-of-the-art. In terms of usability, ZeRO can train large models of up to 13B parameters (e.g., larger than Megatron GPT 8.3B and T5 11B) without requiring model parallelism which is harder for scientists to apply. Last but not the least, researchers have used the system breakthroughs of ZeRO to create the world's largest language model (Turing-NLG, 17B parameters) with record breaking accuracy.