2.8T-Parameter Model Training on Domestic AI Chips: Native FSDP2 Adaptation and Optimization

    This article analyzes the technical bottlenecks of training trillion-parameter models and describes how a 2.8-trillion-parameter multimodal model was adapted to a flagship AI training-and-inference compute card with the MUSA software stack. It covers native FSDP2 integration, sharded model loading, sharding scheduling, gradient synchronization, multimodal training optimizations, and the engineering value of a unified training-inference architecture, including measured throughput and memory results.

    1. Background and Challenges: Technical Bottlenecks in Trillion-Parameter Model Training

    As large language models grow from hundreds of billions of parameters to trillions, training places unprecedented demands on compute, memory capacity, communication bandwidth, and software-stack coordination. A flagship model with 2.8 trillion parameters has 28 times the parameter count of a typical hundred-billion-parameter model. This creates several challenges:

    • Sharply increased memory capacity requirements: Model parameters alone, stored in half precision, require about 5.6 TB of memory. Optimizer states such as AdamW momentum and variance typically require more than 3 times additional space, bringing total memory demand to more than 20 TB. This far exceeds the physical memory limit of a single GPU or even a single node.
    • Communication overhead becomes a bottleneck: Under hybrid parallelism strategies such as data parallelism, tensor parallelism, and pipeline parallelism, each training step introduces many collective communication operations for gradient synchronization, activation recomputation, and parameter broadcast. Communication latency and bandwidth utilization directly affect training throughput.
    • Scheduling complexity rises exponentially: Sharding strategies must balance computational efficiency and memory footprint while dynamically coordinating multiple parallelism dimensions. This places extremely high demands on software-stack abstraction and fault tolerance.

    To address these challenges, the industry commonly adopts a “large-scale cluster + distributed parallel framework” approach. In practice, however, implementation is often constrained by the maturity of the chip ecosystem. In the domestic AI chip field in particular, quickly building an efficient and stable training adaptation path without changing model source code has become a key measure of hardware-software co-design capability.

    2. Overall Training Adaptation Scheme: AI Training-and-Inference Compute Card and Native FSDP2 Path

    The core approach in this training adaptation was to deploy the 2.8-trillion-parameter flagship model on a cluster built with a flagship AI training-and-inference integrated compute card. The card provides high memory capacity, in the tens of GB range per card, and high-bandwidth interconnect. Together with the MUSA software stack, it forms a multimodal training path based on “native FSDP2.”

    “Native FSDP2” means direct integration with the iterative version of Fully Sharded Data Parallel in the PyTorch ecosystem, rather than implementation through later patches or rewrites. Compared with the earlier FSDP version, FSDP2 provides finer-grained sharding control, more efficient memory fragmentation management, and lower communication overhead. Its key design points include:

    • Unified sharding of parameters and gradients: Model parameters, gradients, and optimizer states are partitioned across multiple GPUs according to configurable units such as layers, modules, or tensor blocks. Each device stores only its local shard and dynamically gathers required parameters (All-Gather) during forward and backward propagation, releasing them after computation.
    • Hybrid parallelism coordination: FSDP2 can be seamlessly combined with Tensor Parallel and Pipeline Parallel, supporting flexible scaling from a few cards to thousands of cards.
    • Zero-overhead overlap mechanism: Computation and communication are overlapped, for example by running gradient computation and gradient-shard All-Reduce simultaneously, reducing synchronization wait time.

    Using this compute card and the MUSA software stack, the Moore Threads team implemented efficient conversion and memory-mapped loading of HuggingFace-format weights during model loading. Weight shard initialization can be completed without additional data copies. The entire adaptation process requires only a small number of configuration changes, while the model-side source code remains unchanged. This benefits from the MUSA software stack’s deep compatibility with native PyTorch logging interfaces and extension mechanisms.

    3. Key Stages: Model Loading, Sharding Scheduling, and Gradient Synchronization

    3.1 Model Loading: From Weight Files to Distributed Memory Layout

    The weight files of a 2.8-trillion-parameter model are usually stored in sharded formats such as safetensors or binary shards. Loading involves:

    • Parsing metadata to obtain the name, shape, and storage path of each tensor;
    • Splitting each large tensor into equal parts according to the FSDP2 sharding strategy and mapping them to the local index of the corresponding GPU;
    • Using zero-copy or memory-mapping techniques to avoid repeated allocation and reduce peak memory during startup.

    Implementation sketch (pseudocode):

    1. def load_sharded_model(model, shard_dir, device_mesh):
    2. for rank in range(device_mesh.size):
    3. local_shard = []
    4. for tensor_path in shard_dir.glob("*.tensor"):
    5. tensor = mmap_load(tensor_path)
    6. if is_parameter(tensor):
    7. # Split by global tensor index
    8. shard = split_for_fsdp2(tensor, rank, world_size)
    9. local_shard.append(shard)
    10. assign_local_params(model, local_shard)

    In the MUSA software stack, this process optimizes file-read parallelism through the underlying driver, significantly shortening the loading time for weights in the tens of GB range.

    3.2 Sharding Scheduling: Dynamically Balancing Computation and Memory

    The core sharding unit of FSDP2 is the “parameter module,” and each module can have an independent sharding strategy such as FULL_SHARD or SHARD_GRAD_OP. For a 2.8-trillion-parameter model, running forward and backward propagation within limited memory also requires Activation Checkpointing and Memory Offloading as supplements:

    • Activation checkpointing: Intermediate activations are discarded during forward propagation and recomputed during backward propagation, trading time for space and reducing peak memory by more than 60%.
    • Layered offloading: Parameters not involved in the current computation stage are temporarily migrated from GPU memory to CPU memory or NVMe storage, further expanding available capacity.

    The sharding scheduler automatically decides when to release parameters and when to gather them again based on the current computation graph topology, avoiding memory fragmentation. In the MUSA software stack, custom memory pools and asynchronous copy streams overlap parameter migration with computation.

    3.3 Gradient Synchronization: From All-Reduce to Sharded Reduce-Scatter

    Traditional data parallelism performs All-Reduce on full gradients after each backward propagation. The communication volume equals the model size, about 2.8 trillion × 2 bytes ≈ 5.6 TB, which is extremely inefficient. FSDP2 uses Reduce-Scatter: each GPU is responsible only for averaging the gradient portion in its own shard, so the communication volume is only 1/N of the full amount, where N is the number of GPUs. The optimizer update is then applied locally. For 2.8 trillion parameters with 1024 cards, the per-card communication volume is about 5.5 GB, greatly reducing bus pressure.

    To ensure correct gradient synchronization, cross-card statistical operations such as BatchNorm must be handled. Flagship models usually use LayerNorm instead, so no additional synchronization is required. In addition, gradient compression such as FP16 gradients and delayed synchronization strategies can further reduce communication latency without losing convergence accuracy.

    4. Building and Optimizing the Multimodal Training Path

    The 2.8-trillion-parameter model is defined as a multimodal flagship model covering text, images, audio, and other modalities. Its training data flow contains multiple modality encoders and decoders, and its forward propagation path has a hybrid serial-parallel structure. The native FSDP2 path needs to support:

    • Modality-sparse activation: Expert layers (MoE) or attention heads for different modalities may be activated only for specific inputs. Sharding granularity must therefore support on-demand weight loading and avoid keeping all modality parameters resident in memory at the same time.
    • Heterogeneous tensor shapes: Tensor dimensions for image patch embeddings and audio features differ from those of text. FSDP2 must automatically derive sharding rules from metadata rather than hard-coding them.
    • Gradient accumulation and mixed precision: Multimodal loss is usually a weighted sum of multiple subtask losses. Backward propagation must accumulate gradients from different modalities, and sharding scheduling must ensure that accumulation does not introduce additional communication.

    Specific optimization measures include:

    • Using auto_wrap_policy to automatically wrap modules by Transformer layer, so each module is sharded independently and modality isolation is easier;
    • Setting different communication priorities for encoders of different modalities and using communication streaming so that high-frequency inter-modality communication uses independent network channels;
    • Introducing a dynamic minimum sharding unit, such as 128 MB, to avoid excessive All-Gather operations caused by small parameter tensors.

    In convergence validation, compared with native FSDP1 under the same hardware conditions, the FSDP2 version improved training throughput by about 23% and reduced peak memory by 17%. Model accuracy fully aligned with the reference implementation, with identical loss curves. This demonstrates the technical advantages of the native FSDP2 path in trillion-parameter multimodal scenarios.

    5. From Training to Inference: Engineering Value of the Integrated Architecture

    The AI training-and-inference integrated compute card used in this adaptation was designed so that the same hardware platform can handle both training and inference tasks, avoiding the redundant construction of separate training clusters and inference clusters. After training adaptation is complete, the card can directly use the distributed weight format saved during training and dynamically load inference services through a lightweight scheduler:

    • Automatic weight merging: During inference, FSDP2 sharded weights can be merged into full weights, or the sharded mode can be retained for parallel inference such as pipeline parallelism.
    • Dynamic batching: The runtime based on the MUSA software stack supports dynamic adjustment of batch size according to request scale and automatically allocates tensor parallel groups.
    • Low-latency optimization: Operator fusion patterns learned during training, such as FlashAttention, can be directly applied to inference to avoid recompilation.

    For enterprise users, this integrated training-inference architecture means lower hardware procurement costs and lower operations complexity. It is especially suitable for mid-to-large business scenarios that require frequent model iteration. It also provides a seamless path for Continual Training: the model does not need to be reloaded, and fine-tuning tasks can be inserted between inference periods.

    6. Summary and Outlook

    For models at the 2.8-trillion-parameter scale, simply stacking hardware cannot solve training efficiency problems. The key is whether the software stack can deeply coordinate with the chip architecture. In this case, the native FSDP2 path built on the flagship AI training-and-inference integrated compute card and the MUSA software stack demonstrates three key capabilities:

    1. Deep compatibility with the community ecosystem: Adaptation requires no model source code changes, reducing migration costs;
    2. Fine-grained control over parallelism strategies: Sharding scheduling and communication optimization enable near-linear scaling;
    3. Integrated training-inference design: Shortens the cycle from training to deployment and improves resource utilization.

    In the future, as models continue to move toward 5 trillion and 10 trillion parameters, sharding scheduling, memory offloading, and communication optimization will continue to face challenges. It is foreseeable that native parallel solutions represented by FSDP2 will play a core role in the iterative optimization of domestic AI chips, and a technology ecosystem combining hardware, software stack, and model library will become a key source of differentiated competition. For developers and enterprise decision-makers, understanding these underlying technical details helps more accurately evaluate the adaptation cost and long-term benefits of heterogeneous computing platforms.