Large Model Training Adaptation on Domestic AI Compute: A Technical Path Analysis
This article explains how a domestically developed AI accelerator and its unified software stack completed training adaptation for an open-source model with 2.8 trillion parameters. It covers the shift from inference to training, memory sharding with native FSDP2, multimodal data pipelines, gradient synchronization and checkpointing, and a methodology for validating large model training on domestic compute platforms.
1. Background: From Inference Readiness to Training Adaptation
Recently, a team announced that it had completed training adaptation for an open-source flagship model with 2.8 trillion parameters. The work used a domestically developed flagship AI accelerator that supports both training and inference, together with the team’s in-house unified software stack. The team built a native FSDP2 multimodal training path and connected the full training pipeline, from model loading and shard scheduling to gradient synchronization.
This may look like a single adaptation test, but it marks a key step in the evolution of the domestic compute ecosystem. Inference adaptation only needs to cover the forward pass and common operators. Training adaptation requires end-to-end support for backpropagation, gradient synchronization, optimizer state management, and mixed-precision scheduling. The requirements for operator coverage, communication efficiency, and numerical stability rise by orders of magnitude.
For developers, the case provides a complete sample of a methodology for large model training adaptation. The sections below break it down layer by layer, following the training pipeline.
2. The Memory Challenge at Trillion-Parameter Scale: Why Sharding Is Required
For a 2.8-trillion-parameter model, storing the weights in BF16 alone requires about 5.6 TB of memory. Adding the first and second moments of AdamW and the master weight copy (usually stored in FP32) brings the full training state to tens of terabytes. A single accelerator typically has 64 GB to 128 GB of memory, a gap of up to several hundred times.
The common solution is fully sharded data parallelism, which splits the training state across all devices:
- Parameter sharding: When the forward pass reaches a layer, the parameters for that layer are gathered on demand and released after use.
- Gradient sharding: Gradients are gathered only briefly during the reduction after backpropagation.
- Optimizer state sharding: Each device keeps the optimizer states only for the parameters it owns.
The native FSDP2 path mentioned in the case means the software stack implements DeviceMesh-based parameter management directly, rather than achieving compatibility through an emulation or translation layer. A key improvement of FSDP2 over earlier implementations is that it shards each parameter independently as a DTensor, instead of flattening and concatenating the whole module. This brings several benefits:
- More precise memory utilization: Parameters with different shapes and precisions can each use their best sharding strategy, which avoids padding waste.
- Cleaner separation from mixed precision: Precision policies can be set for specific modules, such as embedding and normalization layers.
- Flexible combination of CPU offload and recomputation: Teams can trade off memory, bandwidth, and compute as needed.
The following illustrative sharding configuration is shown as pseudocode:
mesh = DeviceMesh("gpu", [world_size])model = shard_model(model,mesh=mesh,shard_strategy="fully_shard",mixed_precision={"param": "bf16", "reduce": "fp32"},offload_policy={"optimizer": "cpu", "param": "none"},)
3. The Multimodal Training Path: Challenges in Data Pipelines and Heterogeneous Branches
Modern flagship models are generally multimodal. A vision encoder and a language backbone are aligned through a projection layer. This adds requirements for training adaptation.
1. Data-side complexity
Sequence lengths in multimodal samples vary widely. An image-text pair may contain only a few hundred tokens, while a long-document understanding sample may reach tens of thousands of tokens. Without handling, the load across devices becomes severely unbalanced, and gradient synchronization suffers from long-tail waiting. Common approaches include:
- Sequence packing, which concatenates short samples and pads them to a unified bucket length;
- Token-based dynamic batch scheduling, which replaces sample-count-based scheduling;
- Prefetching and overlap in the data loading layer to hide I/O latency.
2. Compute-side branch management
The vision and language branches have very different operator profiles. The vision branch relies mainly on convolution and attention blocks, while the language branch relies mainly on large matrix multiplications. Training adaptation must ensure that both branches have efficient backward implementations, and that gradients pass correctly through the cross-modal projection layer. This is the step in completing the full training pipeline that is most prone to failure. Many adaptation efforts run correctly in the forward pass but produce silent errors in backward gradients.
Validation relies on gradient comparison against a reference implementation. On small-scale data, engineers compare the relative error of backward gradients layer by layer. Once the gradients agree within numerical tolerance, they scale up to full training.
4. Gradient Synchronization and Communication Optimization: The Key to Training Efficiency
In clusters below 10,000 accelerators, communication often takes 20% to 40% of training time. Gradient synchronization in the full pipeline involves several typical optimizations:
- Overlap of computation and communication: Backpropagation produces gradients layer by layer. Reduction can start on each shard as soon as it is ready, running in parallel with the computation of later layers.
- Bucketing and priority scheduling: Gradients are grouped into buckets by size, and large buckets are communicated first to extend the overlap window.
- Topology-aware collective communication: Intra-node traffic uses high-bandwidth interconnects, while inter-node traffic uses the network. The reduction algorithm selects a different strategy for each.
- Communication precision control: Gradient reduction can use FP32 for numerical stability. Once convergence is confirmed to be unaffected, precision can be lowered to halve communication volume.
Periodic checkpointing of training state is also a sign of pipeline completeness. Checkpoints for trillion-parameter models are very large. They usually require asynchronous snapshots, sharded saving, and fast recovery to keep failure recovery time within minutes.
5. An Engineering Methodology for Adapting Domestic Software Stacks
Cases like this one suggest a general methodology for adapting large model training to domestic compute platforms:
- Verify operator completeness first: Check the model architecture inventory, then confirm forward and backward operator coverage and precision one by one.
- Align communication libraries with collective semantics: Ensure that reduce, broadcast, and all-gather operations meet their targets in both semantics and performance.
- Validate in layers: Progress from single-device, single-step tests and multi-device, multi-step tests to small-scale convergence experiments. Then align the loss curve with the reference implementation, scaling up at each stage.
- Set numerical consistency acceptance criteria: Over long training runs, the correlation coefficient and deviation of the loss curve against the reference implementation should meet defined thresholds. Single-step alignment is not enough.
- Establish performance baselines: Record metrics such as model FLOPs utilization as anchors for later optimization.
6. Conclusion: Training Adaptation as a Milestone in Ecosystem Maturity
Inference readiness shows that a platform can run models. Training adaptation shows that it can train stably, compute correctly, and scale out. When a domestic accelerator and its unified software stack can natively support trillion-parameter multimodal training workloads, covering model loading, shard scheduling, multimodal data pipelines, gradient synchronization, and fault recovery, its software ecosystem has moved from translation-layer compatibility to native support. For developers, this lowers the cost of moving large model development onto domestic compute. The core training frameworks and parallelism methods are reusable, and most of the differences lie in the underlying operator and communication implementations. As more open-source models complete similar adaptation validation, large model training on heterogeneous compute is expected to become routine in engineering practice.
