Adapting and Training Ultra-Large Multimodal Models: A Full-Link Practice with Native FSDP2

    As large language models evolve into multimodal systems with trillions of parameters, training them demands unprecedented coordination between hardware, software stacks, and distributed frameworks. This article explores the engineering practices for adapting ultra-large multimodal models (e.g., 2.8 trillion parameters) using native FSDP2. It covers compute adaptation challenges, the construction of the native FSDP2 multimodal training path, parameter sharding strategies, and full-link optimizations including memory management, dynamic scheduling, and fault tolerance, supported by cloud-native intelligent computing infrastructures.

    As Large Language Models (LLMs) evolve toward multimodal architectures, parameter counts are rapidly surpassing the trillion-level mark (e.g., open-source flagship multimodal models with 2.8 trillion parameters). This ultra-large scale not only demands massive computational power but also poses unprecedented challenges to the collaborative adaptation of underlying AI chips, software stacks, and distributed training frameworks. Building a complete training pipeline—from model loading to gradient synchronization—relying on heterogeneous computing and intelligent computing infrastructures has become a core technical imperative. This article delves into the full-link engineering practice by focusing on the construction of a native FSDP2 multimodal training path.

    1. Compute Adaptation Challenges for Trillion-Parameter Multimodal Models

    When a multimodal large model reaches the 2.8 trillion parameter level, its VRAM consumption far exceeds the physical limits of a single or even multiple AI accelerator cards. Model weights, optimizer states, gradients, and activations require tens to hundreds of terabytes of storage. Beyond massive storage needs, multimodal models integrate diverse structures such as visual encoders, language models, and decoders, resulting in highly complex computation graphs with significant differences in parameter distribution and compute density across modalities. Traditional Data Parallelism (DP) or Tensor Parallelism (TP) struggle to balance VRAM efficiency and communication overhead. Therefore, the underlying software stack must integrate deeply with hardware architecture to construct a native distributed training path, effectively addressing the training challenges of ultra-large multimodal models.

    2. Building the Native FSDP2 Multimodal Training Path

    Fully Sharded Data Parallel (FSDP) is a mainstream technology for training ultra-large models. It shards model parameters, gradients, and optimizer states across compute nodes, reassembling them on demand during computation to significantly reduce per-card VRAM usage.

    2.1 Evolution and Advantages of FSDP2

    Compared to the first-generation FSDP, native FSDP2 has been deeply optimized in sharding granularity, heterogeneous device compatibility, and communication masking. While FSDP1 primarily shards at the module level, FSDP2 delves into the tensor level, providing finer-grained control. This means that within a multimodal architecture, different sharding strategies can be applied to the bulky language model layers and the compute-intensive visual encoder layers. Native support implies that the underlying AI software stack can directly perceive FSDP2 operator calls, enabling operator fusion and memory reuse tailored to specific chip architectures, thereby avoiding the performance losses associated with black-box adaptation.

    2.2 Parameter Sharding Strategy for Multimodal Architectures

    In multimodal training, building a native FSDP2 path requires overcoming communication barriers between modalities. Typically, the output of the visual encoder needs to be transferred across nodes to the language model. Under the FSDP2 framework, developers can use custom Wrap strategies to encapsulate sub-networks of different modalities into independent FSDP units. During forward propagation, the system dynamically aggregates the full weights of the current layer via an All-Gather operation; after computing gradients in backpropagation, it synchronizes and shards the gradients using Reduce-Scatter. This mechanism ensures stable VRAM consumption while leaving room for subsequent communication optimizations.

    Adapting ultra-large models is not just about framework-level adaptation; it is an end-to-end engineering practice from data preparation to weight updates. Unblocking the complete training pipeline requires overcoming several key areas:

    3.1 Large-Scale Model Loading and VRAM Optimization

    Loading a 2.8 trillion parameter model using traditional single-process unified loading can easily trigger Out-Of-Memory (OOM) errors during initialization. In engineering practice, a “sharded loading + streaming initialization” strategy is typically adopted. The system first allocates and shards the weights in CPU memory, then loads the corresponding shards on-demand into the designated GPU VRAM based on the FSDP2 topology. Additionally, combining gradient checkpointing (recomputation) and CPU Offload technology allows inactive optimizer states to be temporarily offloaded to main memory, further alleviating VRAM pressure.

    3.2 Dynamic Shard Scheduling and Compute-Communication Overlap

    In multi-node training, network communication is often the bottleneck limiting scalability. The native FSDP2 path achieves maximum overlap of computation and communication through asynchronous communication mechanisms. While performing the forward computation for layer N, the system initiates the All-Gather request for layer N+1 weights in the background. To optimize scheduling, the underlying software stack must automatically select the optimal communication domain based on the network topology of heterogeneous chips (e.g., NVLink, PCIe Switch, and cross-node RDMA networks).

    1. # Generic FSDP distributed training pseudo-code example
    2. import torch
    3. import torch.distributed as dist
    4. from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
    5. def setup_model(model, rank):
    6. # Fine-grained FSDP wrapping for different modules of the multimodal model
    7. model.visual_encoder = FSDP(model.visual_encoder, device_id=rank)
    8. model.language_model = FSDP(model.language_model, device_id=rank)
    9. # Configure mixed precision training and VRAM optimization strategy
    10. model = FSDP(model,
    11. device_id=rank,
    12. use_orig_params=True,
    13. limit_all_gathers=True)
    14. return model

    3.3 Cross-Node Gradient Synchronization and Fault Tolerance

    During backpropagation, gradient synchronization must span hundreds or thousands of accelerator cards. Through the Reduce-Scatter operation, each card only retains the gradient accumulation result corresponding to its responsible shard, drastically reducing communication volume. Meanwhile, to address hardware jitter that may occur during long-term training, the training pipeline must possess elastic fault tolerance. The system needs to periodically save sharded Checkpoints; if a node disconnection is detected, it can quickly recover from the latest state, avoiding the waste of computational power associated with starting from scratch.

    4. Infrastructure Foundation: Empowerment of Cloud-Native Intelligent Computing Platforms

    In ultra-large model training, while the adaptation between underlying chips and software stacks is core, the scheduling and operations of the entire cluster are equally indispensable. Relying on mature cloud-native intelligent computing platforms, such as Baidu AI Cloud, can provide a solid engineering foundation for this full-link training.

    The high-performance computing clusters provided by Baidu AI Cloud feature lossless networks and high-bandwidth file storage (such as the Parallel File System, PFS), meeting the demands for ultra-low latency and high throughput during FSDP2’s All-Gather and Reduce-Scatter processes. Additionally, leveraging container platforms and efficient scheduling systems, developers can easily and rapidly launch multi-node distributed training environments. The monitoring, alerting, and logging services provided by the cloud platform enable real-time insights into the compute utilization and network congestion of underlying chips, assisting engineering teams in continuously optimizing sharding scheduling strategies.

    5. Summary and Outlook

    Adapting and training a flagship multimodal model at the 2.8 trillion parameter level is a comprehensive test of underlying compute, software stacks, and cloud-native infrastructure. By building a native FSDP2 multimodal training path and unblocking the complete pipeline from loading and scheduling to gradient synchronization, the industry has demonstrated the feasibility of heterogeneous computing in ultra-large model training. In the future, as compute chip architectures evolve and further integrate with distributed frameworks, relying on intelligent computing platforms like Baidu AI Cloud, we expect to drive the deployment of Artificial General Intelligence into broader application scenarios with lower engineering barriers and higher energy efficiency.