Adapting Ultra-Large Model Training on Domestic Compute Platforms
As large language models scale beyond a trillion parameters, training them requires massive distributed clusters and specialized hardware. This article explores the engineering practices of adapting ultra-large models—such as 2.8-trillion-parameter Mixture of Experts architectures—to domestic, training-inference integrated compute platforms. It details the construction of native FSDP2 training pipelines, including weight sharding, computation-communication overlap, gradient synchronization consistency, and the critical role of software stack synergy. The piece provides a methodology for developers undertaking similar large-scale model migrations to emerging hardware platforms.
Adapting Ultra-Large Model Training on Domestic Compute Platforms
1. Background: Training Challenges in the Trillion-Parameter Era
As large language model (LLM) parameter scales grow from tens of billions and hundreds of billions to the trillion level, model training places unprecedented demands on the underlying compute infrastructure. Recently, flagship open-source models in the industry have reached a scale of 2.8 trillion parameters. These models typically adopt a Mixture of Experts (MoE) architecture, activating only a portion of the expert sub-networks during a single forward pass. However, the storage, loading, and gradient updates of the full parameters still require massive memory and compute support.
In this context, relying solely on single cards or single-node multi-card setups is no longer sufficient to carry complete training tasks; large-scale distributed training clusters are essential. Furthermore, training cluster hardware is no longer limited to traditional solutions. Domestic training-inference integrated compute cards are gradually entering the core scenarios of large model training. Adapting ultra-large open-source models to new hardware platforms—building a complete training pipeline from model loading and shard scheduling to gradient synchronization—has become a representative systems engineering effort.
This article uses this adaptation practice as a blueprint to break down the key phases and methodology of ultra-large model training adaptation from a general technical perspective.
2. Why a “Training-Inference Integrated” Hardware Foundation is Needed
In traditional AI infrastructure, training and inference chips are often designed separately: training cards emphasize high-bandwidth memory, double-precision or mixed-precision compute capabilities, and high-speed interconnects; inference cards focus on energy efficiency and deployment costs. The emergence of training-inference integrated compute cards attempts to balance both workloads on the same hardware architecture, which imposes higher demands on the software stack:
- Unified Programming Model: Training frameworks and inference engines need to share the same underlying operator libraries, memory management, and communication primitives, avoiding the maintenance costs of a fragmented dual-software system.
- Flexible Precision Support: Capabilities commonly used in training, such as BF16 mixed precision and FP8 quantized training, must be seamlessly integrated at both the hardware instruction set and compiler levels.
- Peer-to-Peer High-Speed Interconnect: In large-scale training, inter-card communication bandwidth often becomes the throughput bottleneck. Training-inference integrated cards must provide interconnect capabilities comparable to dedicated training cards.
For developers, evaluating whether a training-inference integrated platform is suitable for large model training focuses not on single-card peak compute figures, but on whether its software stack can fully support mainstream distributed training paradigms and maintain effective compute utilization as the cluster scales.
3. Constructing a Native FSDP2 Multimodal Training Path
Fully Sharded Data Parallel (FSDP) is currently the mainstream approach for ultra-large model training. Its second-generation implementation (FSDP2) has made systematic improvements over early versions in terms of shard granularity, communication-computation overlap, and memory fragmentation control. Building a native FSDP2 training path on a new hardware platform requires the following layers of work:
3.1 Model Loading and Weight Sharding
For a 2.8-trillion-parameter model, even stored in BF16 precision, the weights alone approach 6TB. Add the optimizer states (for AdamW, typically more than double the weight size), and the overall memory requirement far exceeds any single-node capacity. Therefore, the first step in training is to partition parameters, gradients, and optimizer states along the device dimension:
# Example: Parameter sharding based on generic distributed interfacesfrom torch.distributed.fsdp import fully_shardfor layer in model.transformer.layers:fully_shard(layer, mesh=device_mesh) # Shard layer by layer to reduce peak memoryfully_shard(model, mesh=device_mesh)
When adapting to new hardware, it is crucial to ensure that the sharded tensor layout is fully compatible with the implementation of underlying communication primitives (all-gather, reduce-scatter) on the target platform, especially concerning unaligned memory access and asynchronous stream scheduling behaviors.
3.2 Shard Scheduling and Communication-Computation Overlap
The core benefit of FSDP2 comes from the fine-grained overlap of communication and computation: prefetching the parameter shards of the next layer during the forward computation of the current layer, and executing gradient reduction in parallel with subsequent computations during backpropagation. To make this mechanism effective on a new platform, it is necessary to:
- Verify that the asynchronous semantics of the underlying communication library align with the framework’s assumptions;
- Adjust the granularity of the sharding units (too fine increases scheduling overhead, too coarse diminishes overlap benefits);
- Perform topology-aware optimization separately for expert parallel communication (all-to-all) in MoE architectures to prevent bandwidth contention with data parallel communication.
3.3 Gradient Synchronization and Numerical Consistency
Gradient synchronization is the final checkpoint for training correctness. During adaptation, strict numerical validation must be performed: under small-scale configurations, compare the loss curves and gradient norms of the new platform against a reference platform to ensure consistency within an acceptable floating-point error margin. Common issues include floating-point accumulation errors caused by reduction order differences and implementation discrepancies in gradient scaling strategies under mixed precision. Only after numerical consistency is verified can subsequent throughput optimizations proceed.
3.4 Additional Considerations for Multimodal Training Paths
When a model possesses multimodal capabilities like vision and speech, the training data pipeline becomes more complex: input sizes vary significantly across modalities, requiring redesigns for batching strategies, sequence length distributions, and load balancing. The native FSDP2 path must be combined with technologies like dynamic shape support and variable-length sequence packing to ensure stable memory utilization in multimodal scenarios.
4. Software Stack Synergy: The Hidden Costs of Adaptation
The release of hardware capabilities ultimately depends on the maturity of the software stack. A complete training adaptation typically involves the following layers:
- Compilers and Operator Libraries: Do the hundreds of operators called in the framework all have high-performance implementations? Is there a fallback path for missing operators?
- Communication Libraries: What are the bandwidth and latency performances of collective communication across clusters of different scales, and is topology-aware scheduling supported?
- Memory Management: Fragmentation control, activation checkpointing, and memory pooling strategies.
- Fault Recovery: Hardware failures are the norm in large-scale training. The fast saving and loading of checkpoints, along with the ability to resume training from breakpoints, directly impact the effective training time.
For teams looking to undertake similar migrations, it is recommended to first run through the entire pipeline with a small-to-medium scale model before gradually scaling up to the target size, using numerical consistency and throughput metrics for regression validation at each step.
5. Conclusion
The training adaptation of ultra-large open-source models on domestic training-inference integrated platforms is essentially a comprehensive test of software-hardware synergy: from constructing the FSDP2 sharding path and tuning communication-computation overlap to verifying numerical consistency, each phase requires solid engineering expertise. As the software ecosystem for domestic compute continues to mature, the marginal costs of such adaptation work will decrease, leading to more diverse compute options for large model training. For enterprise users, combining these capabilities with the foundational services provided by general cloud platforms—such as container platforms, object storage, and monitoring alerts—can facilitate more efficient organization of training data, scheduling of training tasks, and maintenance of cluster stability, allowing focus to be placed firmly on the models and business logic themselves.
