Training Trillion-Parameter MoE Models on Domestic GPU Clusters: Engineering Practices

    This article presents a technical overview of adapting a 2.8-trillion-parameter open-source Mixture-of-Experts (MoE) model for training on domestic GPU clusters. It covers hardware selection criteria, the adoption of native FSDP2 for fully sharded data parallelism, key engineering challenges such as operator precision and MoE load balancing, and the best practices that emerged from this large-scale training effort. Aimed at AI infrastructure engineers and researchers, the content focuses on replicable methodologies rather than vendor-specific details.

    Introduction: The Infrastructure Challenge of Ultra-Large Open-Source Models

    The parameter scale of open-source large language models continues to climb, with trillion-parameter Mixture-of-Experts (MoE) models emerging as a mainstream architecture for flagship open-source releases. By using sparse activation mechanisms, these models keep inference costs relatively manageable while pushing total parameter counts into the trillions, significantly expanding knowledge capacity and complex task handling capabilities.

    This leap in parameter count poses systemic challenges to the underlying training infrastructure:

    1. Memory wall: For a 2.8-trillion-parameter model stored in BF16 precision, the model weights alone require roughly 5.6 TB of memory. When combined with optimizer states, gradients, and activations, the total memory demand can be several times the weight size, far exceeding the capacity of a single accelerator or even a single server.
    2. Communication bottleneck: In distributed training across thousands or tens of thousands of accelerators, gradient synchronization and parameter shard communication generate enormous traffic. Collective communication efficiency directly determines overall throughput.
    3. Software stack porting cost: Open-source models are typically developed and validated on mainstream GPU ecosystems. Porting them to domestic GPU platforms requires per-operator verification of coverage, numerical precision, and communication library compatibility.

    Recently, a domestic GPU vendor completed training adaptation of a 2.8-trillion-parameter open-source MoE model on its flagship training-and-inference accelerator, using its proprietary software stack. The effort established a full pipeline from model loading and shard scheduling to gradient synchronization via the native FSDP2 (Fully Sharded Data Parallel 2) multi-modal training path. This practice offers a valuable engineering reference for domestic compute platforms taking on frontier-scale model training. This article strips away product-specific details and examines the key methodologies from a general technical perspective.

    Hardware Selection Criteria for Trillion-Parameter Training

    Training a trillion-parameter model requires the hardware platform to satisfy four dimensions simultaneously: compute capacity, memory capacity, interconnect bandwidth, and ecosystem maturity.

    Compute and Memory Configuration

    Trillion-parameter training imposes high requirements on both per-accelerator compute throughput and memory capacity. The industry standard choice is AI accelerators with large memory (typically 80 GB or more) and high-bandwidth HBM (HBM memory bandwidth in the terabytes-per-second range). Larger memory per accelerator allows each card to hold more parameter shards, increasing the flexibility of parallel partitioning and reducing communication overhead.

    High-Speed Interconnect

    Distributed training depends on high-speed interconnect between accelerators within a node and across nodes. On-card interconnect—such as high-speed SerDes-based point-to-point links—determines the efficiency of tensor parallelism and expert parallelism. Inter-node RDMA networking (e.g., RoCE or equivalent lossless Ethernet solutions) determines the scalability of data parallelism and pipeline parallelism. When evaluating hardware, it is critical to benchmark collective communication primitives—AllReduce, AllGather, ReduceScatter—under real bandwidth conditions rather than relying solely on theoretical peak specs.

    Software Stack Maturity

    Hardware capability is only realized through its software stack. A mature AI software stack typically includes:

    • Compute runtime: Compute interfaces aligned with mainstream programming models, supporting custom operator development.
    • Operator library: High-performance implementations of core operators—matrix multiplication, attention, normalization, MoE routing.
    • Communication library: Compatibility with mainstream collective communication interfaces, enabling drop-in integration with distributed frameworks.
    • Compilation and graph optimization layer: Support for computation graph capture, operator fusion, and other optimization passes.

    Only when mainstream frameworks such as PyTorch and their distributed components run natively on this software stack does the adaptation of frontier strategies like FSDP2 become feasible.

    FSDP2: A Native Sharding Strategy for Trillion-Parameter Models

    Why Full Sharding Is Required

    Traditional data parallelism (DP) requires each accelerator to hold a complete replica of the model, which is completely infeasible at trillion-parameter scale. Fully Sharded Data Parallel (FSDP) shards model parameters, gradients, and optimizer states along the data-parallel dimension. Each accelerator holds only 1/N of the shards, temporarily materializing required parameters via AllGather during forward and backward passes, then releasing them immediately after computation. This reduces per-accelerator memory consumption by a factor of approximately N.

    Key Improvements in FSDP2

    FSDP2 is the next-generation fully sharded implementation in PyTorch. Its core improvement is the introduction of the DTensor (distributed tensor) abstraction, treating “sharding” as a native property of tensors rather than an external wrapper layer. This yields three main benefits:

    1. Cleaner semantics: How parameters are sharded—along which dimensions and across which devices—is declared at model definition time, decoupling the training path from the model structure.
    2. Stronger composability: Tensor parallelism, expert parallelism, and pipeline parallelism can be composed with data parallelism on the same DeviceMesh to form multi-dimensional hybrid parallelism.
    3. More precise communication: Parameter shards are stored as DTensor instances, avoiding the padding and alignment issues introduced by parameter flattening in earlier implementations, resulting in more accurate communication volume.

    For MoE models, expert parameters naturally lend themselves to sharding along the expert dimension (expert parallelism), while shared attention and embedding layers use FSDP sharding. The DTensor abstraction in FSDP2 expresses this differentiated sharding strategy uniformly.

    Building a Native Multi-Modal Training Path

    The “native FSDP2 multi-modal training path” refers to training a multi-modal model—including vision encoders and the language backbone—directly through PyTorch’s native FSDP2 interfaces without additional parallel framework patches. The key stages are:

    1. Model Loading

    Checkpoint files for trillion-parameter models are typically stored as hundreds of shards across object storage or distributed file systems. Loading requires lazy loading and meta-device initialization: first construct the model structure on the meta device, then stream weight shards to target accelerators according to the parallel topology, avoiding CPU memory and accelerator memory spikes. The following demonstrates the pattern:

    1. from torch.distributed.device_mesh import init_device_mesh
    2. from torch.distributed.fsdp import fully_shard
    3. mesh = init_device_mesh("gpu", (dp_size, ep_size),
    4. mesh_dim_names=("dp", "ep"))
    5. with torch.device("meta"):
    6. model = build_moe_model(config) # build structure only, no memory allocation
    7. # Use expert parallelism for expert layers, FSDP for the rest
    8. for layer in model.expert_layers:
    9. fully_shard(layer, mesh=mesh["ep"])
    10. for block in model.transformer_blocks:
    11. fully_shard(block, mesh=mesh["dp"])
    12. fully_shard(model, mesh=mesh["dp"])
    13. # Stream weight shards to target devices
    14. load_sharded_weights(model, checkpoint_dir)

    2. Shard Scheduling

    Shard scheduling determines which parameters and data each compute device is responsible for in each iteration. The practice requires balancing three factors: memory usage (finer sharding saves more memory), communication overhead (finer sharding increases communication frequency), and load balancing (MoE models exhibit inherent imbalance in expert activation). Common optimization techniques include activation checkpointing to trade compute for memory, and expert reordering based on historical load statistics.

    3. Gradient Synchronization

    After the backward pass, gradient shards on each accelerator must be aggregated and reduced via ReduceScatter, followed by the optimizer updating the local parameter shards. To hide communication latency, communication-computation overlap is commonly employed: as gradients are produced layer by layer during backpropagation, gradient communication for completed layers is initiated asynchronously. Additional cost-reduction measures widely adopted in the industry include gradient bucketing to merge small communications and low-precision gradient communication (e.g., BF16).

    Common Engineering Challenges and Mitigations

    Operator Precision Consistency

    Across platform migrations, subtle numerical differences may appear in basic operators—matrix multiplication, Softmax, LayerNorm—across different hardware. These differences can accumulate and amplify during long-sequence training. The mitigation is a layered verification framework: single-operator precision comparison first, then forward/backward alignment for single layers and modules, followed by small-scale end-to-end loss curve comparison. Only after confirming consistent convergence behavior should training scale be expanded.

    MoE Routing and Load Balancing

    The gating network in MoE models dynamically assigns tokens to experts, and “popular expert” overload can occur during training. The industry commonly uses auxiliary load-balancing losses or bias adjustment strategies without auxiliary losses to mitigate this. On domestic accelerators, it is also critical to ensure that token distribution (AllToAll communication) achieves sufficient bandwidth utilization under high concurrency, potentially through grouped AllToAll to reduce inter-node traffic.

    Fault Tolerance and Checkpoint Resumption

    Hardware failures are the norm rather than the exception in training at the ten-thousand-accelerator scale. The adaptation must include efficient distributed checkpointing: asynchronous shard persistence, support for hot-loading recovery mid-training, combined with health checks and automatic faulty node eviction. This keeps the cost of any single failure within minutes.

    Performance Tuning Loop

    Complete adaptation is not just about “making it run” but “making it fast.” A standard tuning loop includes: profiling compute and communication time per layer → identifying communication-exposed time → adjusting parallel partitioning, bucket size, and recomputation granularity → regression verification. The goal is to raise Model FLOPs Utilization (MFU) to a level comparable with mainstream platforms.

    Conclusion and Outlook

    The successful adaptation of a 2.8-trillion-parameter MoE model to domestic GPUs marks a significant expansion of domestic compute capabilities at the frontier of large-scale model training. The methodological insights are broadly applicable: using native FSDP2 as the core sharded training strategy, using the DTensor abstraction for unified multi-dimensional parallelism, using layered verification for precision consistency, and using asynchronous checkpointing for stable long-running training. These methods are not bound to specific hardware or models and can be reused for adapting other domestic accelerators and frontier open-source models.

    As the open-source community and domestic software/hardware ecosystems continue to align, models will increasingly expose parallel-friendly structural information upfront, and framework-level distributed capabilities will further become “out-of-the-box” defaults. For enterprises, building cross-platform training adaptation and verification capabilities early is a critical step toward maintaining autonomy and control over large model R&D in a multi-vendor compute landscape.