ZeRO - memory optimizations toward training trillion parameter models
并行理论的黑称 Vertical Split: 竖切, PP Horizontal Split: 横切, TP 消耗显存的模块分类 Part Category Included Items Description 1 Model states optimizer states, gradients, parameters For large models, the majority of the memory is occupied by model states. 2 Residual states activation, temporary buffers, unusable fragmented memory The remaining memory is consumed by residual states. Model State 不足分析 + ZeRO-DP 性能 Parallelism Method Why Compute Efficiency Is High / Low Why Memory Efficiency Is High / Low Core Mechanism Main Problem Data Parallelism (DP) High compute efficiency because each GPU runs the full model independently on its own mini-batch, so computation is large-grained and continuous, and communication is mainly limited to gradient synchronization. Low memory efficiency because each GPU stores a full copy of all model states, including parameters, gradients, and optimizer states. Replicate the full model on every GPU, split data across GPUs, then synchronize gradients. Heavy memory redundancy across GPUs. Model Parallelism (MP) Low compute efficiency because one model computation is split across multiple GPUs, which introduces fine-grained coordination, frequent synchronization, and expensive communication on the critical path. High memory efficiency because each GPU stores only a partition of the model states instead of the full model. Partition the model itself across GPUs so each GPU holds only part of the parameters / states. Communication overhead, synchronization cost, and reduced scalability. ZeRO-DP Tries to retain the high compute efficiency of DP by preserving DP-style computation granularity and communication pattern as much as possible. Tries to achieve the high memory efficiency of MP by partitioning model states across data-parallel processes instead of fully replicating them. Keep DP-style training flow, but partition optimizer states, gradients, and eventually parameters to remove redundancy. More complex state management and dynamic communication scheduling. ...