FSDP2 Training Adaptation and Optimization for Ultra-Large Multimodal Models

    This article examines the engineering challenges of training 2.8-trillion-parameter multimodal models and presents a native FSDP2 training path. It covers memory and communication bottlenecks, tensor-level sharding design, model loading and memory lifecycle management, fine-grained All-Gather and Reduce-Scatter scheduling, compute-communication overlap, and supporting infrastructure for orchestration, storage, monitoring, and fault recovery.

    In recent years, the parameter counts of large language models and multimodal models have grown exponentially, with flagship models at the 2.8-trillion-parameter scale becoming a new frontier of industry exploration. With such massive model structures, a single compute device can no longer hold the parameters, gradients, and optimizer states required for training. How to efficiently use large-scale AI computing clusters and connect the full training stack from underlying hardware to upper-layer frameworks has become a core technical challenge in AI infrastructure. This article focuses on training adaptation practices for ultra-large multimodal models and provides an in-depth analysis of building and optimizing a native FSDP2 training path.

    1. Underlying Adaptation Challenges for Ultra-Large Model Training

    At the 2.8-trillion-parameter scale, large model training faces dual constraints: a memory wall and a communication wall. First, model parameters alone require about 5.6 TB of memory in FP16/BF16, and when gradients and Adam optimizer states are included, overall memory demand exceeds 20 TB. Second, multimodal models contain vision encoders, language models, and modality alignment layers, and the tensor dimensions and compute characteristics of different modules vary significantly. This requires the underlying framework to provide a high degree of flexibility.

    In addition, to realize the flagship training-and-inference integrated compute potential of specific AI accelerator cards, a complete supporting software stack is required for deep adaptation. This involves precision alignment of operator libraries, bandwidth optimization of communication libraries, and seamless integration with mainstream deep learning frameworks. Only on the basis of hardware-software co-optimization can the training path be constructed.

    2. Design Principles of the Native FSDP2 Multimodal Training Path

    To address extremely large memory usage, Fully Sharded Data Parallel is commonly used in the industry. With the evolution to FSDP2, the core idea has moved from module-level sharding to tensor-level sharding, enabling finer-grained memory control and more efficient execution.

    The native FSDP2 path is designed to overcome the limitations of the original framework and provide customized optimization for a specific software stack. Its main logic is as follows:

    1. Unified tensor management: FSDP2 no longer relies on wrapping existing modules. Instead, it intercepts tensor allocation to implement on-demand sharding and reassembly of parameters directly on the device side.
    2. Modality-aware scheduling: For the different compute flows of visual and textual modalities in multimodal models, FSDP2 can dynamically prefetch required shards based on actual forward-pass needs, avoiding unnecessary memory usage.

    3. Engineering Practices and Optimization for the Full Training Pipeline

    Building a complete training pipeline from model loading to gradient synchronization is key to ensuring stable convergence of a 2.8-trillion-parameter model. The following are engineering practices for the core stages.

    3.1 Model Loading and Memory Lifecycle Management

    During initialization, loading full model weights directly would cause an immediate out-of-memory (OOM) error. Therefore, lazy loading and sharded initialization strategies are required.

    After downloading a checkpoint from general object storage to a local node, developers should stream-read it by layer or by tensor and directly distribute shards across compute nodes. Each node retains only its own parameter shard, reducing per-accelerator memory usage to 1/N of the original, where N is the data parallel degree.

    3.2 Fine-Grained Sharding Scheduling Strategy

    During the forward pass, when a layer needs to be computed, the system triggers All-Gather to collect the full parameters of that layer from other nodes. After computation completes, memory for non-local shards is released immediately. This “use on demand and release immediately after use” scheduling strategy means that at any given time, each accelerator only needs to hold the full parameters of a very small number of layers.

    During the backward pass, All-Gather is also triggered to restore parameters for gradient computation. Reduce-Scatter is then used to average gradients across nodes and store them in sharded form.

    The pseudocode is illustrated below:

    1. # Illustration of FSDP2 fine-grained sharding scheduling logic
    2. def forward_layer(layer, x):
    3. # Trigger All-Gather to obtain full parameters for this layer
    4. full_params = all_gather(layer.sharded_params)
    5. # Execute forward computation
    6. out = layer.compute(x, full_params)
    7. # Release full parameters, retain only the local shard, and reclaim memory
    8. layer.sharded_params = free_and_reshard(full_params)
    9. return out
    10. def backward_layer(layer, grad_output):
    11. # Re-run All-Gather to restore parameters
    12. full_params = all_gather(layer.sharded_params)
    13. # Compute gradients
    14. grad_params = layer.compute_grad(grad_output, full_params)
    15. # Trigger Reduce-Scatter to synchronize and shard gradients
    16. layer.sharded_grads = reduce_scatter(grad_params)

    3.3 Overlap Optimization of Computation and Communication

    In ultra-large clusters, communication overhead often becomes a training bottleneck. Through the native FSDP2 path, deep overlap between compute streams and communication streams can be achieved. For example, while the current layer is performing forward computation, a background communication stream has already begun prefetching the parameter shards for the next layer. This pipelining mechanism greatly hides network latency and improves the cluster’s model FLOPs utilization (MFU).

    4. Supporting Infrastructure and Cloud-Native Capabilities

    In an end-to-end large-scale training pipeline, in addition to optimization of underlying AI accelerator cards and the software stack, mature cloud-native infrastructure is often needed to ensure efficient operation of training jobs.

    1. Job orchestration and resource scheduling: A container platform can be used to uniformly schedule hundreds or thousands of AI accelerator cards, ensuring topology affinity between compute nodes and reducing cross-switch communication.
    2. Distributed storage acceleration: Checkpoint resumption during training requires frequent reads and writes of massive checkpoints. A combination of high-performance object storage and distributed file systems can provide high throughput bandwidth and avoid I/O blocking.
    3. Full-link monitoring and fault tolerance: Training a 2.8-trillion-parameter model takes a long time, and hardware failures are difficult to avoid. By integrating log services and monitoring and alerting systems, GPU utilization, memory watermarks, and NCCL communication latency can be tracked in real time. Once a node failure is detected, the system can automatically trigger an alert and perform elastic recovery from the latest checkpoint.

    5. Conclusion

    The successful training adaptation of a 2.8-trillion-parameter multimodal model marks a solid step forward for underlying compute infrastructure in handling extreme-scale models. By building a native FSDP2 multimodal training path, the full pipeline from model loading to fine-grained sharding scheduling and gradient synchronization is connected, effectively breaking the dual bottlenecks of memory and communication. In the future, with continued evolution of compute foundations and distributed training algorithms, the training efficiency of ultra-large models will reach a new level, providing a stronger technical foundation for the development of general artificial intelligence.