Trillion-Parameter LLM Training Adaptation: A Practical Guide to Native FSDP on AI Accelerators
This article examines the engineering challenges of training trillion-parameter MoE models and the key steps for adapting them to domestic AI accelerators. Taking the recent open-sourcing of a 2.8-trillion-parameter flagship MoE model as a starting point, it breaks down the three major pressures of trillion-scale training—memory, communication, and precision/stability—and explains a three-layer adaptation approach spanning the operator, parallelism, and framework layers. It then details the three core stages of a native FSDP path—model loading, shard scheduling, and gradient synchronization—along with a four-level validation roadmap from single-machine smoke tests to thousand-card stability and the operational support needed for long training runs.
A Chinese AI team recently open-sourced a flagship MoE (Mixture of Experts) large model with 2.8 trillion parameters. According to media reports, a domestic chip vendor completed training adaptation for this model using its flagship training-and-inference accelerator card and a self-developed software stack. The vendor built a native full-shard data parallel (FSDP) multimodal training path, connecting the full training pipeline from model loading and shard scheduling to gradient synchronization.
This news drew attention for more than just the model itself. As publicly reported, open-source models are typically released under permissive licenses that allow commercial use. For enterprises and research institutions, this means they can get their hands on a set of trillion-parameter model weights and use them for fine-tuning, distillation, or continued pre-training. But “having the weights” is not the same as “getting training to run.” Training it stably and efficiently on domestic AI accelerators tests the depth of adaptation across the entire hardware-software stack.
Using this event as a starting point, this article reviews the engineering challenges of training trillion-parameter models and the key steps for adapting to domestic accelerators. It then breaks down the implementation essentials of the three parts of a native FSDP path: model loading, shard scheduling, and gradient synchronization.
1. The Three Engineering Pressures of Trillion-Parameter Scale
Scaling from tens of billions to trillions of parameters brings a change in resource demand by orders of magnitude, not just more parameters.
1.1 Memory: the model state alone is a datacenter-scale load
Taking mixed-precision training, a common industry approach, as an example, the typical per-parameter overhead includes:
- BF16/FP16 parameters: 2 bytes;
- Gradients: 2 bytes;
- Optimizer states: for an Adam-type optimizer, this includes the fp32 master weights plus the first- and second-order moments, totaling 12 bytes.
That adds up to about 16 bytes per parameter. Roughly estimating for 2.8 trillion parameters:
- Parameters themselves: about 5.6 TB;
- Gradients: about 5.6 TB;
- Optimizer states: about 33.6 TB;
- Total for the three: about 44.8 TB.
This is only the model state, not counting activations, communication buffers, or memory fragmentation.
Assuming 80 GB of memory per card and one copy of the parameters per card, simply holding the model state would require about 560 accelerator cards (44,800 GB ÷ 80 GB ≈ 560). Factoring in the redundancy introduced by tensor parallelism and expert parallelism, the actual cluster would be even larger. Data parallelism alone clearly cannot support this; you must rely on full sharding of parameters and optimizer states, combined with strategies such as tensor parallelism and expert parallelism.
1.2 Communication: two high-overhead collective operations run through every step
Every iteration of a trillion-parameter model comes with large-scale collective communication:
- FSDP path: all-gather (parameter collection) and reduce-scatter (gradient reduction and scatter) for each layer;
- MoE path: all-to-all under expert parallelism (token routing distribution and collection);
- Tensor parallelism: all-reduce/all-gather within a layer;
- Pipeline parallelism: point-to-point transfers between adjacent stages.
The communication patterns are complex, the data volumes are large, and they contend for link bandwidth with each other. Once communication becomes the bottleneck, no amount of compute can be converted into effective throughput.
1.3 Precision and stability: the invisible threshold of long training runs
Trillion-parameter training often runs for weeks or even months, and any hidden problem gets amplified:
- Precision issues: hard to detect early in training, yet they may evolve into loss spikes or even divergence after thousands of steps. For example, if a normalization layer accumulates statistics in low precision, error accumulates easily in long-sequence scenarios.
- Hardware issues: in a large-scale cluster, “sub-healthy” states such as individual nodes downclocking or link bit errors are hard to detect.
- Data issues: anomalies in the training data itself can be mistaken for model problems.
In addition, saving one full checkpoint requires writing tens of TB of data; saving too frequently slows training, while saving too rarely loses a lot of compute when a failure occurs.
2. Adapting to Domestic AI Accelerators: Systems Engineering Across Three Layers
“Completing the adaptation” does not just mean getting the model to run—it means running it correctly, stably, and fast. Achieving this goal requires coordination across three layers.
2.1 The operator layer: determines whether it can run
Every module of a large model eventually comes down to specific operators: attention computation, normalization, matrix multiplication, MoE routing and dispatch, and so on. Early in adapting to a new platform, common situations include:
- Some operators are missing;
- Custom operators need to be recompiled;
- Support for special data types (such as fp8) is incomplete.
The typical response is to provide compatible operator implementations or high-level interfaces, combined with an automatic differentiation mechanism to ensure that backpropagation connects seamlessly with ordinary modules. For operators not yet covered, a compiler can generate code, or you can fall back to a general implementation to ensure correctness first.
2.2 The parallelism layer: determines whether it can run fast
Once the operators are in place and a single card can run, trillions of parameters still will not fit on one card. This layer must answer three questions at once:
- Parallelism strategy combination: how to combine data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism, and how to align each communication domain with the cluster topology. For example, keep tensor parallelism within a single machine’s high-speed interconnect as much as possible, and deploy pipeline parallelism across machines.
- Compute and communication overlap: hide parameter collection and gradient reduction behind computation so that communication does not block the compute stream.
- Collective communication library optimization: for high-frequency primitives such as all-gather, reduce-scatter, and all-to-all, optimize topology awareness and multi-stream scheduling.
2.3 The framework layer: determines whether it can run stably over the long term
The parallelism modules of mainstream training frameworks are often deeply coupled to a specific hardware backend. If new hardware provides only a “compatibility layer,” it may run in the short term but run into performance degradation, precision inconsistency, or breakage after framework upgrades over the long term.
So native support means that logic such as sharding, communication, and optimizer updates is fully implemented directly in the software stack, rather than relying on translation or simulation. Only by connecting the full chain of model loading, shard scheduling, and gradient synchronization can trillion-parameter training move from “demo” to “reproducible and operable.”
3. Three Key Aspects of the Native FSDP Path
The adaptation described in this report builds a native full-shard data parallel (FSDP) multimodal training path. Its core idea is that parameters, gradients, and optimizer states are all stored sharded by rank, and the full parameters are temporarily gathered only when needed for computation. It has three key aspects.
3.1 Model loading: from a large file to distributed shards
Trillion-parameter models are often hundreds of GB, and the loading stage commonly has two problems: a single process loading all the weights causes host memory to overflow; and initializing everything to GPU memory at once causes the memory peak to spike too high. A robust approach is as follows:
- Sharded reading: load weights by file shard or tensor slice, with each rank handling only the part it is responsible for.
- Metadata initialization: first build the model structure on a “meta device” without allocating real GPU memory, and determine the parameter-to-shard mapping for each layer.
- Layer-by-layer loading and transfer: use hooks to copy the local shard to GPU memory as each module loads, then release host memory, keeping the peak within what a single card can handle.
- Compatibility checks: verify key-name mappings, shapes, dtypes, and device information. Multimodal models have heterogeneous submodules for text, vision, and so on, each with very different parameter counts and parallelism needs, so they must be configured separately, and the loading order must respect module dependencies.
A simplified illustration:
# Illustration: sharded loading; untyped_storage allocates GPU memory without immediately filling it with datadef load_sharded(checkpoint_dir, build_model_fn, mesh):# mesh: parallelism topology, including data-parallel, tensor-parallel, expert-parallel dimensionsmeta_model = build_model_fn(device="meta") # build structure onlyplan = build_shard_plan(meta_model, mesh) # mapping from parameters to owning ranksfor rank in mesh.data_parallel_group():state = safe_load_slice(checkpoint_dir, rank, plan) # read shards on demandfor name, tensor in state.items():# write the local shard directly into the parameter's storage, avoiding materializing the full parameter in GPU memoryparam = meta_model.get_parameter(name)param.untyped_storage().resize_(tensor.numel() * tensor.element_size())param.copy_(tensor, non_blocking=True)return meta_model
3.2 Shard scheduling: a pipeline of compute and communication
FSDP runtimes typically pack several adjacent layers into a shard unit and organize communication around it:
- Forward pass: when it is a unit’s turn, all-gather its parameters → run that unit’s computation → release the temporary parameters immediately after the computation.
- Backward pass: before backpropagation reaches a unit, all-gather its parameters in advance (forward prefetch); once a unit’s gradient computation completes, reduce-scatter immediately and start prefetching the next unit (backward prefetch).
- Un-sharded unit test: only the parameters of the current and prefetched units remain resident in memory.
The key to scheduling is balancing “granularity” and “prefetch depth”:
- If shard units are too small, communication happens more often with smaller single messages, and latency overhead takes a larger share;
- If shard units are too large, there are more temporary parameters, the memory peak is high, and it is hard to overlap communication with computation.
A tuning approach in practice:
- With the memory peak as a constraint, first determine the maximum granularity of a shard unit.
- Estimate message size based on a single parameter’s size, and adjust unit boundaries if necessary.
- Configure forward and backward prefetch strategies separately to avoid multiple units’ parameters being resident at the same time.
- Use profiling to inspect the timeline of communication and computation, and confirm that communication is largely covered by computation.
Pseudo-code:
# Illustration: scheduling flow for shard units; real implementations split this into separate communication and compute streamsdef fsdp_forward(unit, all_params):shard = all_params[unit.rank] # hold only this rank's shardfull = all_gather_into_tensor(shard, unit.group) # temporarily gather the full parameterout = unit.module(full) # run this unit's forward computationfree(full) # free immediately after use to control peak memoryreturn outdef fsdp_backward(unit, grad_out, all_params):if prefetch_enabled:launch_async_prefetch(next_unit) # launch the next unit's parameter gather in advancefull = all_gather_into_tensor(all_params[unit.rank], unit.group)grads = autograd_backward(unit.module, grad_out) # backward computationreduce_scatter_into_tensor(all_params[unit.rank].grad,grads,unit.group,) # reduce gradients and scatter them in place back to each rankfree(full)
3.3 Gradient synchronization: consistency, mixed precision, and optimizer updates
Gradient synchronization determines whether all ranks ultimately update to the same model.
Semantic essentials
- Parameters exist in sharded form; during backpropagation each rank computes gradients only for the shard it holds. reduce-scatter sums and averages the gradients across ranks, then writes the result scattered back into each rank’s shard buffer—numerically equivalent to a regular data-parallel all-reduce.
- Gradient updates happen only on the local shard, and optimizer states are sharded the same way. So as the data-parallel dimension grows, per-card optimizer-state overhead stays basically unchanged; only the communication frequency and the way data is organized per communication differ.
- Operations such as gradient clipping, gradient accumulation, and loss scaling must be performed under “correct sharded semantics,” otherwise ranks may end up with inconsistent clipping coefficients or deviated effective step sizes.
Mixed precision
- The common approach is “low-precision computation, high-precision reduction”: use bf16/fp16 for the forward and backward passes, and accumulate in fp32 during reduce-scatter, to reduce the rounding error of gradient summation at large scale.
- With fp16, loss scaling amplifies gradients, and the scaling factor should stay consistent across ranks.
- The optimizer updates on fp32 master weights, then converts back to low-precision parameters after the update.
Checkpoints
Trillion-parameter models should not save synchronously at every step. A more robust approach is to write gradient/optimizer-state deltas asynchronously to disk while training continues, with a background thread handling persistence. Related metadata can be coordinated through a distributed key-value store to avoid all ranks writing to the same file at once.
4. A Practical Roadmap: From Single-Machine Smoke Test to Thousand-Card Stability
A single “successful adaptation” is not enough to prove a solution is usable. It is recommended to proceed in a four-level progression:
| Level | Validation focus | Main approach | Passing criterion |
|---|---|---|---|
| Level 1: Functionality | Operator and precision correctness | Run a small model on a single card, comparing forward outputs and gradients layer by layer | Error within tolerance, loss decreasing normally |
| Level 2: Parallelism | Multi-card, multi-machine training correctness | Enable FSDP and compare loss curves across different data-parallel degrees | Curves basically overlap, memory peak controllable |
| Level 3: Efficiency | Throughput and scalability | Use profiling to locate bottlenecks and track how MFU changes with cluster size | Communication largely hidden by compute, stable scaling efficiency |
| Level 4: Stability | Long-run reliability | Continuous training on hundreds to thousands of cards, with fault-injection drills | Checkpoints recoverable, faults quickly isolated |
Here, MFU (Model FLOPs Utilization) reflects the ratio of effective compute to theoretical peak compute, and is a core metric for measuring training efficiency.
- Large language models: training FLOPs are approximately 6 × number of parameters × number of training tokens. This formula corresponds to the compute of “2 multiply-accumulates in the forward pass + 4 in the backward pass.”
- MoE models: each token passes through only the experts it is routed to, so compute is estimated based on the number of activated parameters.
MFU = (6 × activated parameters × number of tokens / training time) / (number of accelerator cards × single-card peak compute)
Note that metrics such as AFU and HFU count extra computation like recomputation into the numerator. When comparing across the board, use a consistent metric and note the precision type.
Before entering Level 2 validation, you can use the equivalence-checking capabilities provided by a compiler to verify that custom operators and graph-level fusion preserve numerical equivalence:
# Illustration: equivalence check between a custom implementation and a compiled implementationimport torchdef check_equivalence(compiled_fn, reference_fn, inputs, rtol=1e-2, atol=1e-2):ref = reference_fn(*inputs)act = compiled_fn(*inputs)# the custom operator / compiled output should be element-wise approximately equal to the referencetorch.testing.assert_close(act, ref, rtol=rtol, atol=atol)
Tolerances need to be determined based on data type and operator type:
- Operators with large-scale accumulation, such as matrix multiplication and attention, usually have larger accumulation error, so tolerances can be relaxed appropriately;
- Operators sensitive to numerical stability, such as softmax and normalization, should use stricter tolerances.
5. Operational Support for Long Training Runs
- Observability: collect metrics such as per-step time, communication share, memory watermark, and hardware health, feed them into a unified logging and monitoring/alerting service, and set threshold alerts and automatic anomaly isolation.
- Elastic scheduling: use a container platform for task orchestration, combined with topology-aware scheduling, so that the same parallel communication domain stays within high-speed interconnect as much as possible.
- Fault-tolerant training: save checkpoints at fixed step intervals and write them asynchronously to object storage; on node failure, automatically rebuild the training environment and resume from the latest checkpoint.
- Data governance: version the training data and make data loading reproducible, so data problems are not mistaken for model problems.
- Cloud solutions: cloud platforms such as Baidu AI Cloud can combine general-purpose capabilities like container platforms, object storage, log services, and monitoring/alerting into a complete solution, providing the infrastructure foundation for large-scale training.
Conclusion
From the open-sourcing of a 2.8-trillion-parameter flagship model to a domestic accelerator completing training adaptation, the story is one of systems-level coordination across three layers—operators, parallelism strategies, and the training framework—with the core being to make the loading, scheduling, and synchronization chain of full-shard data parallelism deep and thorough. For enterprises and teams preparing to run ultra-large-model training, three points are recommended:
- Prioritize a hardware-software stack with native parallelism capabilities;
- Advance validation along the four-level roadmap of functionality—parallelism—efficiency—stability;
- Pair it with a complete operational support system.
Open-source weights lower the barrier to obtaining a model, but training adaptation capability determines whether this dividend can truly be turned into business value.
