Trillion-Parameter Multimodal Training: A Practical Guide to Adapting China-Based AI Accelerators
This article examines the engineering work behind adapting an approximately 2.8-trillion-parameter multimodal model for training on China-based AI accelerator platforms. It explains why adaptation is more than a compatibility fix, breaking it into four layers—operator, framework, parallelism, and data—plus cross-cutting concerns such as numerical stability, memory, communication, and fault tolerance. It then focuses on a native FSDP2 training path: why it is chosen, how model loading, shard scheduling, and gradient synchronization are implemented, and how it combines with tensor, pipeline, expert, and sequence parallelism. The article also covers multimodal data pipelines, numerical stability, long-running fault tolerance, performance metrics, and a reusable five-step adaptation workflow.
Recently, a multimodal flagship model with about 2.8 trillion total parameters was open-sourced. A China-based AI accelerator vendor quickly announced that it had completed training adaptation for the model and had built a native FSDP2 multimodal training path on its training-and-inference integrated smart card and self-developed software stack. This path covers the full chain from model loading and sharding/scheduling to gradient synchronization.
If you only read the headline, this looks like an ordinary industry update. But unpacking the word “adaptation” reveals a system engineering effort: software stack compatibility, large-scale parallel strategy, mixed-precision numerical stability, multimodal data throughput, and fault tolerance for long training runs. Each of these can become a bottleneck. This article reconstructs the core difficulties and general methods of this kind of adaptation from an engineering perspective, for developers working on large-model training and China-based AI compute tuning.
I. Why “completing adaptation” is itself a hard problem
1. Trillion parameters plus multimodal inputs: difficulty does not grow linearly
The difficulty of a trillion-parameter model is not simply that it has more layers. It must rely on a sparse mixture-of-experts (MoE) structure to be practical: each expert processes only part of the input, so total model capacity increases while each forward pass activates only a small subset of parameters. This creates new burdens: global routing and token dispatch under expert parallelism, expert load imbalance, and high-overhead communication such as All-to-All.
Multimodal inputs add two more classes of problems:
- More modalities mean multiple tensor conversions between the vision encoder, projection alignment, and the language backbone.
- Resolution, frame count, and image-text dialogue cause large differences in sequence length across samples, making it hard to regularize computation graphs.
Combined, the result is longer dependency chains, more fragmented communication patterns, and harder-to-predict memory peaks.
2. The software stack ecosystem for China-based AI accelerators is still maturing
Most China-based AI chips use vendor-specific programming models, operator libraries, and collective communication libraries. Their API shapes, supported operator sets, and communication primitive implementations differ from mainstream community solutions. When model developers reuse existing code, they commonly encounter three situations:
- Missing operators or no corresponding high-performance implementation.
- Incomplete hardware backend support in advanced parallelism components.
- Performance fallback, for example, a communication primitive degrading into “all-gather plus local compute.”
3. “It runs” and “it can support large-scale, long, stable training” are different things
Normal convergence at small card counts and short step counts only proves that the functional path works. Production readiness requires three additional conditions:
- Numerical results match the reference implementation.
- Communication overhead remains controllable across thousands of cards.
- Training can run for weeks without interruption and can resume precisely after an interruption.
II. Four-layer structure of training adaptation
From an engineering practice perspective, a complete trillion-parameter model adaptation can be split into four layers, plus one cross-cutting constraint.
| Layer | Core question | Typical work |
|---|---|---|
| Operator layer | Is a single operation correct and fast? | Gap inventory, composite implementation, mixed-precision handling, graph-level fusion |
| Framework layer | Are distributed components aligned with the hardware backend? | Sharding parallel components, collective communication backend, checkpoint read/write |
| Parallel layer | Can memory fit and communication be sustained? | Combining and partitioning TP/PP/EP/DP and sequence parallelism |
| Data layer | Can multimodal data keep compute fed? | Sequence packing, dynamic batching, preprocessing and scheduling |
| Cross-cutting constraint | Are numerical, memory, and communication behaviors stable? | Precision policy, gradient clipping, resume from checkpoint, monitoring and alerting |
It is worth emphasizing that these layers do not unfold in a strict order. They iterate repeatedly: performance results from the operator layer affect partitioning choices in the parallel layer, while memory pressure in the parallel layer pushes the operator layer to introduce recomputation or fused implementations.
III. The native FSDP2 path: why choose it, and how to connect it
3.1 The evolution of sharded data parallelism
The core idea of data parallelism is that each card holds a full model replica and only splits the data. This is simple and effective for small models, but it hits a memory wall as models grow. Take a 2.8-trillion-parameter model as an example. With a common mixed-precision configuration of “BF16 compute + FP32 master weights + Adam momentum,” parameters, gradients, FP32 master weights, and two optimizer momentum groups total approximately:
2.8 × 10^12 × (2 + 2 + 4 + 4 + 4) ≈ 44.8 TB
This does not yet include activations. Even with 1,024 data-parallel shards, each card would still carry about 43.7 GB for model state alone. Add activations, communication buffers, and memory fragmentation, and pure “replicated” data parallelism becomes completely infeasible.
Fully-Sharded Data Parallel (FSDP) works as follows:
- Each card keeps only one shard of the parameters.
- When forward or backward computation reaches a layer, the full parameters for that layer are temporarily aggregated.
- After computation completes, they are immediately released.
This changes memory usage from being independent of card count to being approximately inversely proportional to card count.
Early implementations sharded and communicated at the parameter-group level, such as FlatParameter. Newer implementations, often called the FSDP2 paradigm, shard individual parameters and use a tensor layout abstraction such as DTensor to describe “along which dimension and over which process group” the sharding occurs. This brings several improvements:
- Stronger native composition, allowing combination with tensor parallelism and expert parallelism into multi-dimensional parallelism.
- Parameter-level sharding makes precision policies and selective activation recomputation easier.
- Finer communication granularity makes overlap with computation easier.
- Saving and loading weights does not require first restoring full parameters.
3.2 What “native” means
“Native” means that the training framework’s sharding parallelism, mixed precision, communication overlap, and checkpoint components can directly act on a China-based hardware backend without external patches or invasive modifications. The comparison is as follows:
| Aspect | Patch-based adaptation | Native adaptation path |
|---|---|---|
| Dependency shape | Source changes, patches | Framework-native components directly support the hardware backend |
| Upgrade and maintenance | Patches are prone to failure after framework upgrades | Smooth evolution with framework versions |
| Composition | Limited combination with other parallelism methods | Can combine into multi-dimensional parallelism |
| Checkpoint | Format coupling, difficult migration | Sharded state saving, elastic resume across scales |
3.3 Three stages: model loading, shard scheduling, gradient synchronization
Stage 1: Model loading
A trillion-parameter model cannot be loaded into a single card and then sharded; CPU memory and disk would become bottlenecks first. In practice:
- Weights are saved as shards, and each process reads only its own shard. Startup memory and I/O pressure are approximately balanced.
- First build a “shell” model that records only metadata such as parameter names, shapes, and data types.
- Load parameters one by one and validate shapes, data types, and file shard metadata.
- Optional practice: use BF16 for training and FP32 for optimizer states, and complete precision conversion during weight conversion.
Stage 2: Shard scheduling
Shard scheduling decides when to aggregate parameters, when to release them, and when to communicate. The key point is overlap:
# Training loop sketch (exact API depends on the framework)for batch in dataloader: # Data layer: dynamic batching + sequence packingwith fsdp.summon_full_params(recurse=False): # Forward: aggregate parameters layer by layer...
When computing layer N in the forward pass, the background can prefetch and aggregate parameters for layer N+1. When computing layer N+1 in the backward pass, reduce-scatter for its gradients can be issued early. Aggregated parameters usually participate in computation at lower precision such as BF16; parameter shards themselves are converted between BF16 and FP32 and retain FP32 master weights, which represent higher precision.
Engineering considerations include:
- Prefetch and bucketing: Prefetching too early increases memory peak; prefetching too late fails to hide communication.
- Communication algorithm selection: Batch small messages and send them together; use point-to-point communication directly for large messages.
- Mapping communication domains to compute topology: Keep tensor-parallel groups within the high-speed interconnect range of the same compute unit; let shard groups communicate across units to reduce cross-node traffic.
Stage 3: Gradient synchronization
During the backward pass, after the gradient for a parameter shard is reduced, it is immediately handed to the local optimizer for update. Communication for that shard overlaps with the backward computation of subsequent layers. Details include:
- Reduction precision: Gradient reduction defaults to FP32 accumulation to avoid cumulative error from large numbers of low-precision additions.
- Gradient clipping: First obtain the global gradient norm through cross-card reduction, then scale by a unified threshold. Otherwise, per-card scaling coefficients will be inconsistent, effectively adding noise to the gradients.
- Shared and tied parameters: If shared or tied weights exist between the vision encoder and the language backbone, explicitly assign them to the same shard group to avoid updating the same parameter twice.
- Gradient checkpointing: Save gradients every fixed number of steps. If a loss spike occurs during a long run, this allows quick rollback.
3.4 Combining with other parallelism methods
FSDP solves “how to place model state,” but trillion-scale multimodal models often require other parallelism dimensions:
- Tensor parallelism (TP): Splits matrix operations within a single layer to relieve per-layer memory pressure. It is communication-intensive and should be kept within the high-speed interconnect domain.
- Pipeline parallelism (PP): Splits layers across stages and uses micro-batches to fill pipeline bubbles.
- Expert parallelism (EP): Places different experts on different cards and uses a capacity factor to limit the number of tokens processed by a single card.
- Sequence parallelism: Splits activations and computation along the sequence dimension to reduce activation peaks caused by long contexts and high-resolution vision inputs.
These dimensions ultimately form a 2D or 3D device mesh. Each parameter is split differently along each dimension, unified by a sharding layout abstraction. This is also the biggest value of the native sharding path compared with patch-based approaches: it makes “composition” a routine framework capability rather than a patch added dimension by dimension.
IV. What still needs polishing after the path is connected
4.1 Multimodal data pipeline
The performance ceiling of multimodal training is often determined by data supply. Typical issues include:
- Highly uneven sequence lengths: Image-text dialogue may have only a few hundred tokens, while high-resolution images or long videos may expand to tens of thousands or more.
- High vision decoding overhead: Image decoding and resizing are CPU-intensive operations and can easily become bottlenecks.
- Inconsistent preprocessing formats: Images, OCR data, and dialogue templates need to be unified into the input format expected by the model.
Common countermeasures include:
- Perform sequence packing at document boundaries, packing multiple short samples into the same sequence to reduce padding waste.
- Compose dynamic batches by total token count rather than number of samples, so computation per step is more balanced.
- Move CPU-intensive operations such as decoding and resizing into independent worker processes, decoupled from data loading.
- Version data formats to avoid changing the data definition in the middle of training.
4.2 Numerical stability
In large-model training, sudden loss jumps or NaNs usually originate from numerical issues rather than algorithm design. Practical points include:
- Keep master weights and optimizer states in FP32; parameter and gradient communication can use BF16.
- Use FP32 accumulation for gradient reduction.
- Keep the logits computation in cross-entropy at higher precision.
- Enable a skip-anomalous-step mechanism: when gradient norm or loss exceeds a threshold, skip that update to avoid contaminating optimizer state.
- Build a reference-implementation comparison mechanism: under the same input, compare single-layer outputs between the China-based backend and the reference implementation to gradually locate error sources.
4.3 Fault tolerance and long stable training
At tens of thousands of cards, hardware failures are the norm rather than the exception. Plan ahead:
- Save sharded checkpoints periodically and asynchronously to avoid compute idle time during saving.
- The metadata saved by the training framework must include the current parallel topology; only then can the checkpoint be resharded and resumed after scale changes.
- Use monitoring and alerting metrics such as inter-card communication latency, memory watermark, temperature, and ECC error counts to identify suspect nodes early.
- Configure automatic restart and failure re-entry for training jobs to reduce manual intervention.
V. Performance evaluation: do not look only at peak compute
Adaptation completion does not equal performance readiness. Common metrics for evaluating large-model training efficiency include:
- Effective throughput (tokens/s): The number of tokens actually processed per unit time, affected by data, compute, and communication.
- Model FLOPs Utilization (MFU): Actual achieved floating-point operations divided by theoretical peak operations. Dense models often estimate compute per token as 6N (where N is the parameter count); MoE models estimate it using the actually activated parameter count. It removes hardware peak differences and is a more meaningful way to compare across platforms.
- Communication share: The fraction of single-step time spent on parameter aggregation and gradient reduction.
- Single-step time breakdown: How much time is spent on data loading, forward, backward, and optimizer update.
A rule of thumb: if communication share exceeds 30%, the sharding group partition or prefetch strategy needs optimization; if data loading takes more than 10% of step time, the problem is likely in multimodal preprocessing.
VI. A reusable five-step adaptation method
Step 1: Align the environment and dependencies. Freeze the base image, driver, communication library, and training framework versions. Record a reproducible environment list.
Step 2: Inventory and complete operators. Use static analysis plus runtime logs to list all operators used by the model. Mark them as “unsupported / performance below target / numerical uncertainty” and prioritize high-frequency operators.
Step 3: Compare precision at the single-layer level. Use one card and one layer as the minimum unit. Compare forward outputs and backward gradients with the reference implementation. Expand scale only after the error is within a reasonable range.
Step 4: Scale parallelism level by level. First enable FSDP, then add TP/EP/PP. At each level, remeasure memory and throughput and locate the new bottleneck.
Step 5: Validate with short steps and long runs. Run hundreds of steps at thousand-card scale and observe whether the loss curve, gradient norm, and memory curve are stable. Then push to larger scale.
VII. Conclusion
This adaptation of a trillion-parameter multimodal model to China-based AI compute sends a clear signal: capability building on China-based AI compute platforms is moving from “can a single card compute?” to “can a large cluster train stably for a long time?” The value of the native FSDP2 path is not only that it got one specific model running, but that it provides a composable, portable, and maintainable parallelism foundation. For developers, understanding sharding scheduling, gradient synchronization, and the composition of multi-dimensional parallelism has more long-term value than memorizing the adaptation result for one specific model.
If a team does not have its own large training cluster, it can use cloud platforms such as Baidu AI Cloud for validation. Elastic compute, object storage, and monitoring/alerting capabilities can support operator comparisons and parallelism-strategy validation before large-scale training, reducing trial-and-error costs.
