How to Validate a Multimodal MoE Training Pipeline on Chinese-Made AI Accelerators
This article explains how to validate a training pipeline for a 2.8-trillion-parameter native multimodal MoE model on Chinese-made AI accelerator cards before a full training run. It covers why end-to-end execution and loss reproducibility should be checked separately from model quality, the engineering challenges posed by expert routing, sparse attention, memory, and cross-node communication, and the gradient checks, metrics, reporting requirements, and monitoring checklist to use. It also describes how to read loss and memory data and where the validation results apply.
1. Why Validate the Training Pipeline
Training models with hundreds of billions to trillions of parameters often runs for several weeks. A problem in framework adaptation, operator implementation, the distributed parallelism strategy, or the communication layer can interrupt the job. Sometimes the failure appears only after several days of training. Peak compute of a single accelerator shows the hardware ceiling. It does not show whether the full training stack runs stably.
Teams therefore usually validate the pipeline before the formal training run. This validation answers two questions. First, can the training process run end to end? Second, does the loss curve match expectations, and can repeated runs be reproduced? Model quality requires a separate evaluation. Handling these two kinds of questions separately helps teams allocate resources and judge risk.
2. Engineering Challenges From the Model Architecture
The validated model is a 2.8-trillion-parameter native multimodal MoE model with dynamic sparse attention and expert routing. Both designs improve efficiency, and both make the engineering harder.
2.1 Expert Routing and Load Balancing
An MoE model activates only some experts for each token. Routing depends on the input, so the number of tokens each expert receives can vary widely. When the load is uneven, the devices that receive more data slow down the whole training step, and the other devices wait.
To investigate this, monitor the following metrics:
- Token count received by each expert in every training step. Calculate the ratio of the maximum to the average to measure load imbalance.
- Capacity factor and drop rate. When an expert has a capacity limit, tokens beyond that limit are dropped or bypassed. Record the drop rate separately. Otherwise, training behavior may change without anyone noticing.
- Cross-device wait time, meaning the idle time each device spends at communication synchronization points.
- All-to-all communication time, recorded separately for the forward and backward passes.
2.2 Operator Implementation for Sparse Attention
Dynamic sparse attention follows an irregular computation pattern, so mature dense attention kernels cannot be reused directly. The forward pass must organize data according to the sparse pattern. The backward pass must also propagate gradients correctly through the same sparse structure. Implementation errors usually do not raise explicit errors. Instead, the loss drifts away from the expected curve slowly. For this reason, these operators need separate gradient checks.
Use the following method:
- Fix the random seed, disable dropout, and enable deterministic computation options so that two runs are comparable.
- Use small inputs and compare numerical gradients computed in float32. For several randomly selected parameters, estimate the gradient with central differences and compare the result with the analytical gradient.
- The relative error must fall within a tolerance defined in advance. float32 can use a strict tolerance. bfloat16 has lower precision, so its tolerance must be looser, and float32 results should serve as the reference.
- Verify that the sparse mask is consistent. At positions outside the mask, both attention weights and gradients should be zero. The mask used in the forward and backward passes must be identical.
2.3 Memory and Optimizer States
At the trillion-parameter scale, the combined size of parameters, gradients, and optimizer states far exceeds the capacity of a single device. Sharding is required, but sharding adds gather and scatter overhead. Memory planning must also account for activations, communication buffers, and memory fragmentation.
2.4 Cross-Node Communication
When experts are distributed across multiple nodes, all-to-all communication crosses inter-node links. Their bandwidth and latency are usually worse than those of intra-node links. During validation, record intra-node and cross-node communication time separately. Confirm that the ratio between them matches the design expectations.
3. Designing the Validation Plan
This validation uses a reduced configuration. It keeps the main structure of the model but scales it down. When reproducing or reviewing the results, the report must include the following:
- Reduction ratio: how much the number of layers, the hidden dimension, and the number of experts are scaled down compared with the full model.
- Sequence length and batch size.
- Parallelism strategy: the size of data, tensor, pipeline, and expert parallelism.
- Accelerator model, number of accelerators per node, number of nodes, and the interconnect between nodes.
- Software versions: framework, operator library, communication library, and driver.
- Access requirements: whether exclusive node access is needed, and whether specific memory or network configurations are required.
These conditions limit where the conclusions apply. A validation that passes at small scale with a fixed parallelism strategy does not show that full-scale training will be equally stable with more devices, longer sequences, or different interconnect conditions.
4. Reading Loss and Memory Data
Define the loss data first:
- Sampling: record the training loss at every step. Also record the average at fixed step intervals to avoid judging from single-step noise.
- Baseline: compare against a reference run with the same configuration, or against a dense model curve already validated at the same reduced scale.
- Anomalies: non-finite values (NaN or Inf), single-step jumps above a preset threshold, or consecutive increases over several steps. Record the step numbers and trace the cause.
Memory data also needs clear definitions:
- Peak memory: the maximum allocated memory on each device during one training step.
- Difference between reserved and allocated memory: use it to judge fragmentation. If the difference keeps growing, fragmentation in the allocator is usually accumulating.
- Sampling points: sample at three fixed points, the end of the forward pass, the end of the backward pass, and the end of the optimizer update, to locate the stage where the peak occurs.
Thresholds differ between teams. Write thresholds into the plan before validation starts, rather than adjusting them after seeing the results.
5. Checklist and Monitoring Approach
Before validation starts, confirm each item:
- The training process runs from start to the planned step count without unexpected process exits.
- Loss curves stay continuous after checkpoint saving and restoring.
- Sparse attention gradient checks have passed.
- Scripts for collecting expert load, drop rate, communication time, and peak memory are ready.
- The reproduction plan is set. The same configuration runs at least several times, and the range of variation in the results is recorded.
During monitoring, cover at least expert load, all-to-all communication time, peak memory and fragmentation, loss anomalies, and reproduction count. Set a stop condition for each item in advance. For example, if non-finite losses appear continuously, fragmentation keeps growing beyond a threshold, or communication timeout retries exceed a limit, stop the run, save the state, and investigate. Meeting any one of these conditions is enough to stop.
Teams should set specific numeric thresholds based on their own configuration. This article does not give fixed thresholds, because the right values depend on model scale, accelerator model, and interconnect.
6. Risks and Recommended Actions
- Out-of-memory errors: reduce batch size or sequence length first, then consider changing the sharding strategy. Change one variable at a time to isolate the cause.
- Communication timeouts: check the network configuration and process mapping. Determine whether a single node is failing or the problem is global.
- Abnormal sparse operator gradients: return to small-scale gradient checks and determine whether the problem comes from an implementation error or from numerical precision.
- Results that cannot be reproduced: first fix the seed and deterministic options, then compare software versions and hardware state. Do not attribute reproduction failures to randomness by default.
7. Limits of the Conclusions
The conclusions in this article apply only to the reduced configuration and the software and hardware environment described here. They show that the training pipeline can run under these conditions and that the loss trend matches expectations under these conditions. They cannot be directly extrapolated to full-scale training, and they do not indicate the model’s final quality. To apply the conclusions at a larger scale, validate again with the new configuration.
