Training Adaptation for Trillion-Parameter Multimodal Models: Key Technical Challenges and Practices

    This article explains how to adapt a trillion-parameter multimodal model for training on domestically developed AI accelerators and their software stack. It covers memory limits and parameter sharding with FSDP2, the design of a native multimodal training path, the end-to-end loading and gradient synchronization workflow, and methods for verifying numerical correctness. It also describes how the software stack and cloud infrastructure support large-scale training.

    1. Background: Training Adaptation Challenges for Ultra-Large Open-Source Models

    The parameter counts of open-source large language models have kept growing, moving from tens of billions and hundreds of billions to the trillion-parameter scale. Recently, a research team open-sourced a flagship multimodal model with about 2.8 trillion parameters, which drew wide attention. Models at this scale are far larger than earlier ones and combine text and vision capabilities, which places new demands on the underlying training infrastructure.

    For teams that want to continue training, fine-tune for a specific domain, or train such a model from scratch on their own compute, “training adaptation” is the first required step. Training adaptation is the engineering work that lets a target model train correctly and efficiently on a specific hardware platform and software stack. It covers operator support, numerical alignment, distributed parallelism strategies, and memory optimization. When the target hardware is not the mainstream default accelerator, the complexity of adaptation rises considerably.

    At the same time, domestically developed AI training and inference accelerators and their software stacks have matured steadily, making it feasible to train very large models on this hardware. This article uses that setting to explain the complete path and key techniques for training adaptation of trillion-parameter multimodal models.

    2. Core Technical Challenges of Training Adaptation

    2.1 The Memory Wall and Parameter Sharding

    A 2.8 trillion-parameter model needs more than 5 TB of memory for its parameters alone, even when stored in half precision. Gradients, optimizer states (such as the first and second moments in Adam), and activations add to that total. No single device can hold this, so training must rely on parameter sharding in distributed training.

    Fully Sharded Data Parallel (FSDP) is a widely adopted approach. Its core idea is to split the model parameters, gradients, and optimizer states across all compute devices, so each device holds only one shard of the full state. During forward and backward passes, all-gather collective operations assemble the full parameters needed for each computation on demand. The gathered parameters are released immediately after use. This reduces per-device memory use from O(N) to O(N/P), where P is the number of devices.

    2.2 Engineering FSDP2 Adoption

    Compared with earlier versions, the newer FSDP2 restructures its API and internal implementation. It describes how parameters are sharded using a tensor sharding abstraction (DTensor), which makes sharding semantics more explicit and composable. The key tasks in adaptation are:

    • Sharding policy declaration: Each type of module, such as attention layers, feed-forward layers, embedding layers, and multimodal projection layers, needs an explicit sharding dimension and partitioning method.
    • Hybrid sharding: Large clusters typically use hybrid sharding, which applies full sharding within a node and replication across nodes (HSDP mode). This balances memory savings against communication overhead.
    • Combining with pipeline or expert parallelism: Trillion-scale models often use a mixture-of-experts (MoE) architecture. FSDP must work together with expert parallelism (EP), and expert parameters and non-expert parameters must be assigned to the correct sharding groups.

    2.3 Special Requirements of Multimodal Training Paths

    Besides the language backbone, multimodal models include heterogeneous components such as vision encoders and multimodal alignment projection layers. These components differ significantly from language modules in compute density and memory use, so applying one sharding strategy to all of them is often inefficient. A native multimodal training path therefore means:

    • The vision encoder and the language backbone can use different parallelism strategies and sharding groups.
    • Multimodal data preprocessing, such as image patching and feature extraction, must connect efficiently with the main training pipeline so that data loading does not become a throughput bottleneck.
    • Loss computation and gradient backpropagation for different modalities must stay numerically correct under unified scheduling.

    3. Building the Complete Training Pipeline

    A successful training adaptation must connect the full path from model loading to gradient synchronization. If any stage is missing or contains hidden errors, training may fail to converge or produce silent errors.

    3.1 Model Loading and Weight Sharding

    Weights for trillion-parameter models are usually published as hundreds of shard files. Loading has two requirements. First, weights should load on demand, so the full set is never read into one device’s memory. Second, the weight format must match the target shard layout. In other words, weights are split according to the FSDP sharding policy during loading. A common approach is deferred initialization (meta device initialization) combined with per-shard materialization. The model structure is built on a meta device first, and then weights are loaded and split layer by layer.

    Example code:

    1. # Example: deferred initialization + shard-by-shard materialization
    2. with init_empty_weights():
    3. model = build_multimodal_model(config) # Builds the structure only, no device memory used
    4. shard_loader = ShardedCheckpointLoader(ckpt_dir, layout=fsdp2_layout)
    5. for name, module in model.named_modules():
    6. shard_loader.materialize(module, device="accelerator")

    3.2 Shard Scheduling and Communication Optimization

    Shard scheduling involves arranging two core collective operations, all-gather and reduce-scatter. The key optimizations are:

    • Overlapping communication with computation: Prefetch the parameters for the next layer while computing the current layer. This hides communication latency behind computation.
    • Communication group optimization: Form communication groups according to the cluster topology. Intra-node interconnects are fast, while inter-node network bandwidth is lower, so large cross-node transfers should be reduced.
    • Memory fragmentation management: Frequent gathering and releasing of shards can fragment device memory. An expandable-segment memory allocation strategy helps mitigate this.

    3.3 Gradient Synchronization and Numerical Verification

    During gradient synchronization, reduce-scatter aggregates gradients from all devices and then splits them back into each device’s shard. After adaptation, the training must pass strict numerical verification. Common methods include:

    1. Loss alignment: Using the same data and random seed, compare the training loss over the first several steps on the target platform and on a reference platform. The difference should stay within an acceptable floating-point precision range.
    2. Gradient norm monitoring: Check that the global gradient norm curve stays stable. Sharp spikes often indicate problems in operator precision or communication implementation.
    3. Small-scale convergence testing: First verify that the model can overfit a small data subset. Scale up only after confirming that the training pipeline is correct end to end.

    4. Software Stack Coordination and Ecosystem Significance

    Training adaptation is not only a model engineering task. It requires coordination among hardware, drivers, compute libraries, communication libraries, and the deep learning framework. A mature domestically developed software stack needs to provide programming interfaces compatible with mainstream frameworks, broad operator coverage, and efficient collective communication. Only then can it natively support complex distributed strategies such as FSDP2.

    Enterprise users choosing compute for training can evaluate domestically developed AI compute hardware alongside the general capabilities of cloud platforms, based on their own requirements. For example, cloud platforms such as Baidu AI Cloud offer container platforms, object storage, and monitoring and alerting services. These services can support training job orchestration, data management, and stability.

    5. Summary and Outlook

    Training adaptation for trillion-parameter multimodal models is a systems engineering effort. Parameter sharding techniques such as FSDP2 address the memory wall. A native multimodal training path handles the scheduling complexity of heterogeneous components. A complete pipeline of loading, scheduling, and synchronization, combined with strict numerical verification, keeps training correct. As domestically developed training and inference hardware and software stacks continue to evolve, training very large models on this infrastructure is moving from feasible to efficient. This is expected to give large model technology a stronger compute foundation for broader adoption and industrial use.