Trillion-Parameter Multimodal Model Training: Adaptation Practices on Domestic AI Accelerators
Trillion-parameter multimodal models push training beyond simple compute scaling into a systems problem of memory, communication, and stability. This article explains why FSDP is a common sharding choice, then describes a three-stage training pipeline: meta-device model construction, sharding and heterogeneous module scheduling, and reduce-scatter gradient synchronization. It also covers engineering essentials for domestic AI accelerators—operator coverage, collective communication tuning, mixed-precision compatibility, and numerical stability—alongside production practices such as activation recomputation, fault-tolerant checkpointing, observability, and cloud resource orchestration.
1. Why Trillion-Parameter Multimodal Training Is a Hard Problem
When model scale crosses into the trillion-parameter range, training is no longer just a matter of stacking more compute. It becomes a systems problem where memory, communication, and stability constrain one another.
The first challenge is the memory wall. Under mixed-precision training, a trillion-parameter model can require several terabytes of memory just for parameters, gradients, and optimizer states combined—far beyond the capacity of a single GPU or even a single node. The problem is compounded by modern flagship models that combine a Mixture-of-Experts (MoE) structure with a Transformer backbone. Sparse activation increases the parameter count, so memory pressure rises rather than falls.
The second challenge is heterogeneous scheduling in multimodal models. A typical multimodal model consists of a vision encoder, projection alignment layers, and a language backbone. These components differ greatly in operator types, tensor shapes, and compute density. Reusing a single-modality training configuration can leave some modules as bottlenecks while others wait on frequent communication, creating bubbles and lowering overall utilization.
Therefore, the key to adapting such models on limited domestic AI compute is not simply “filling up the cards.” It is designing a native training pipeline that can simultaneously address memory sharding, heterogeneous scheduling, and stable synchronization.
2. Why FSDP Has Become a Common Choice
To address the memory wall, the industry commonly uses parameter-sharding parallelism. Fully Sharded Data Parallel (FSDP) is widely adopted because it is relatively simple to implement and scales well. Its core idea is to shard parameters, gradients, and optimizer states evenly across the data-parallel group. Each card keeps only a portion resident, reducing memory usage from “one full copy per card” to “one shard per card.”
Compared with traditional replication-based data parallelism, FSDP introduces two key collective communication operations:
- Before forward or backward computation, it uses all-gather to temporarily reconstruct the full parameters needed for the current layer.
- After backward computation, it uses reduce-scatter to reduce gradients and scatter them back to each card.
Because each card holds only the full parameters for the layer currently being computed and releases them immediately afterward, peak memory usage is significantly flattened. More importantly, FSDP supports overlap between communication and computation: while one layer participates in all-gather, the current layer can perform matrix operations, hiding communication overhead beneath computation. This is especially important for large-scale cross-node training.
It is worth emphasizing that FSDP is a general industry paradigm. Its concrete implementation should be combined with the operator support and communication library capabilities of the software stack in use. This article discusses only the general methodology and does not involve any proprietary interface of a specific framework.
3. Building the Full Training Pipeline in Three Stages
Adapting on domestic accelerators requires natively connecting three stages: model loading, sharding and scheduling, and gradient synchronization.
1. Model Loading: From Meta Device to Weight Materialization
Loading a trillion-parameter model all at once onto a single card will immediately cause out-of-memory errors. A general approach is to first build a skeleton model on the meta device of each card. At this stage, only tensor shapes and data types are recorded; no real memory is allocated. Then, according to the sharding rule, pretrained weights are loaded layer by layer, with each shard read directly into the memory of its corresponding device.
A schematic flow is as follows (pseudocode, for illustration only):
# 1) Build the model skeleton on the meta device to avoid full materializationwith meta_device():model = build_model(config)# 2) Shard and load weights according to the sharding strategysharded_model = fsdp_wrap(model, sharding="full")# 3) Load checkpoints shard by shard in a streaming manner, releasing as you gofor shard_id, shard in load_checkpoint(path, sharded=sharded_model):load_into_shard(sharded_model, shard_id, shard)del shard # release intermediate tensors promptly
The key engineering points at the loading stage are streaming and laziness: temporary buffers should be released as soon as a weight shard is loaded, avoiding peak memory stacking.
2. Sharding and Scheduling: Wrap Strategy and Heterogeneous Modules
Sharding and scheduling determine how the model is split and wrapped. A general strategy is to use the Transformer decoder layer as the minimum wrap unit and combine it with an auto-wrap mechanism that recursively shards by layer. For multimodal models, extra attention is needed:
- The vision encoder usually has high compute density and relatively concentrated parameters. It can be sharded as a separate group to avoid bubbles caused by mixing it with the language backbone.
- Projection alignment layers are small and can be merged into adjacent groups to reduce communication.
- Through reasonable sharding group partitioning, modules that interact frequently should be placed in the same communication group to reduce cross-group synchronization costs.
3. Gradient Synchronization: Reduce-Scatter and Precision Management
After backward propagation, each card uses reduce-scatter to reduce gradients. The sharded optimizer then updates the parameter shards each card is responsible for. Three points must be guaranteed in this stage:
- Mixed-precision management: Forward and backward passes commonly use lower precision (such as FP16/BF16) to save memory and bandwidth, while the optimizer keeps master weights at higher precision. Loss scaling is used to prevent gradient underflow.
- Gradient accumulation: With small batches, multiple steps can be accumulated to effectively enlarge the global batch. However, reduce-scatter should be triggered only at the end of the accumulation window to avoid frequent synchronization.
- Numerical consistency: The accumulation order of cross-card reductions can affect the final result. For large-scale training, deterministic algorithms and a fixed communication order should be used to ensure reproducibility.
4. Key Engineering Points for Adapting to Domestic AI Accelerators
Bringing the above pipeline to domestic accelerators requires additional attention to four types of issues:
- Operator coverage: Multimodal models involve operators such as attention, normalization, and MoE routing. It is necessary to confirm that the underlying software stack fully supports them. Missing operators should be filled in through equivalent combinations or custom implementations.
- Collective communication tuning: The performance of all-gather and reduce-scatter depends directly on the communication library. The appropriate communication primitives and buffer sizes should be selected based on the actual topology, including intra-node interconnects and inter-node networks.
- Mixed-precision compatibility: Different hardware supports low-precision formats to different degrees. Prefer precision types that the hardware natively and efficiently supports.
- Numerical stability: MoE structures can easily suffer numerical drift during long-sequence training. General techniques such as gradient clipping and parameter initialization constraints should be introduced to ensure convergence.
5. General Best Practices for Large-Scale Training
For production-grade large-scale training, engineering support must be added on top of the pipeline:
- Continuous memory optimization: Combine techniques such as activation recomputation and optimizer state offloading to free memory for larger batches or longer sequences.
- Fault tolerance and checkpoint resume: A trillion-parameter training run can last for weeks. High-frequency asynchronous checkpointing and automatic resume are essential so that training can recover quickly after node failures.
- Observability: Real-time monitoring of memory, throughput (tokens/s), communication share, and loss curves is the prerequisite for locating bubbles and bottlenecks.
- Cloud resource orchestration: Cloud platforms can manage massive training data and checkpoints through object storage, orchestrate large-scale distributed jobs through container platforms, and track training health through monitoring and alerting services. These general capabilities can be combined as needed in cloud environments such as Baidu AI Cloud, helping teams focus on the model and algorithms themselves.
6. Conclusion
Training adaptation for trillion-parameter multimodal models is essentially a balancing act among memory, communication, and stability. With FSDP as the core, natively connecting the three stages of model loading, sharding and scheduling, and gradient synchronization, and adding operator compatibility, communication tuning, and engineering support, large models can run stably and scalably on domestic AI compute. For developers, mastering this general methodology is more valuable in the long run than binding to any single tool or platform.
