How to Adapt Domestic AI Accelerators for Trillion-Parameter Model Training: A Complete Engineering Path

    Training trillion-parameter open-source models on domestic AI accelerators is a demanding test of the full hardware-software stack. This article walks through the complete adaptation path—from streaming model loading and FSDP2-based sharding to gradient synchronization—explaining why FSDP2 is the key enabler, how much engineering lies beneath the software stack, and what multimodal training adds to the challenge. It closes with practical lessons for developers running large-scale distributed training.

    Background: The Adaptation Challenge in the Trillion-Parameter Era

    In recent years, the parameter scale of open-source large models has continued to climb, with trillion-parameter flagship models progressively releasing their weights. This has pushed the combination of “open-source models + domestic compute” into the industry spotlight. Pretraining and continued training of such models place extreme demands on infrastructure: memory capacity, interconnect bandwidth, operator coverage, communication efficiency, and numerical stability. A weakness in any of these areas can prevent training from converging or leave cluster utilization far too low.

    For domestic AI chips, completing the training adaptation of a trillion-parameter model means more than just “getting it to run”—it must remain stable across long-running distributed training. This is a comprehensive test of hardware-software co-engineering and an important benchmark for the maturity of the domestic compute ecosystem.

    The Overall Technical Path for Adaptation

    Based on public information, this adaptation was built on a flagship training-and-inference AI accelerator card and a self-developed unified software stack, establishing a native FSDP2 multimodal training path that connects the full training chain from model loading and shard scheduling to gradient synchronization. The path can be broken into three core stages:

    1. Model loading. Even stored in half precision, a trillion-parameter model’s weights amount to several terabytes—far beyond what a single card’s memory can hold. The loading scheme must therefore support streaming reads, on-demand sharding, and weight format conversion. In practice, the original checkpoint is split into shard units suited to the chosen parallelism strategy, with data type validation and tensor layout planning performed during loading.

    2. Shard scheduling. This stage determines both memory efficiency and compute efficiency. FSDP2 (Fully Sharded Data Parallel, second generation) distributes model parameters, gradients, and optimizer states evenly across all compute cards. During forward and backward passes, the required shards are temporarily gathered on demand and released after use. Compared with traditional data parallelism, it reduces memory footprint from “full state on every card” to “1/N of the state per card”—the key technique that makes ultra-large-scale training feasible.

    3. Gradient synchronization. After backpropagation, each card’s local gradients must be aggregated into global gradients via collective communication (such as All-Reduce or Reduce-Scatter). At the scale of tens of thousands of cards, communication overhead can consume a significant share of total training time, so optimizations like overlapping communication with computation, bucketed aggregation, and communication compression are essential.

    Why FSDP2 Is the Key Choice for Training Adaptation

    A major improvement of FSDP2 over the first-generation approach is its DTensor-based per-dimension sharding, which enables finer sharding granularity and composes more naturally with tensor parallelism. This matters especially for multimodal training: vision encoders, projection layers, and the language model backbone differ greatly in structure and parameter distribution, and coarse-grained sharding easily causes load imbalance.

    In practice, a typical sharding configuration involves:

    • Sharding dimension choices: decide independently whether to shard parameters, gradients, and optimizer states;
    • Prefetching: fetch the parameter shards of layer N+1 while computing layer N, hiding communication latency;
    • CPU offloading: offload infrequently accessed data such as optimizer states to host memory to further save device memory;
    • Mixed precision: assign different precisions to weights, gradients, and optimizer states, balancing stability and efficiency.

    An illustrative pseudocode structure:

    1. # Illustrative sharding plan configuration
    2. sharding_plan = FSDP2Plan(
    3. module=root_model,
    4. sharding_degree=world_size, # Full sharding
    5. cpu_offload=True, # Offload optimizer states
    6. mixed_precision="bf16", # Mixed precision
    7. prefetch_factor=1 # Layer-wise prefetch
    8. )

    The Deep Engineering Effort Behind Software Stack Adaptation

    Hardware specifications are only half the story—the real difficulty lies in the software stack. To support trillion-parameter training, a chip vendor must complete the following work:

    1. Operator coverage. Training frameworks depend on hundreds of foundational operators, from matrix multiplication and LayerNorm to various fused operators. Any missing operator can halt training or force a fallback to inefficient implementations. Vendors typically need high-performance versions of critical operators, especially the linear layer computations that dominate the FLOPs in Transformers.

    2. Communication library optimization. Collective communication must run efficiently across chip interconnects (both intra-node and inter-node), involving topology-aware routing, bandwidth utilization, and congestion control.

    3. Compilation and graph optimization. The frontend framework’s computation graph must pass through graph optimization, operator fusion, and code generation before being mapped to the chip’s instruction set. The value of a self-developed stack is that upper-layer frameworks need not be aware of hardware details—“framework compatible, hardware transparent.”

    4. Stability verification. Ultra-large-scale training runs continuously for weeks at a time, making fault recovery, checkpointing, and resumable training mandatory. Adaptation work must validate fault tolerance and rapid recovery when individual nodes fail.

    Special Considerations for Multimodal Training

    The adaptation explicitly features a “multimodal training path,” reflecting the current mainstream trend: models no longer process text alone but jointly train on images and other modalities. Multimodal training adds several challenges:

    • Complex data pipelines: preprocessing, encoding, and packing differ significantly across modalities, requiring an efficient data loading and prefetching system so data supply does not become the bottleneck;
    • Heterogeneous parameter structures: vision and language modules differ in scale and compute characteristics, so sharding and scheduling strategies must be differentiated per module;
    • Joint loss optimization: multi-task loss weights and gradient scale differences affect convergence, requiring gradient scaling and clipping strategies to maintain stability.

    Industry Implications and Lessons for Developers

    The successful adaptation of a trillion-parameter open-source model on domestic compute sends signals on three levels:

    First, a new level of ecosystem maturity. Running cutting-edge open-source model training end to end shows that the complete chain from hardware to software stack can support large-scale pretraining—not just inference or fine-tuning.

    Second, stronger viability of the “open-source models + diverse compute” model. Enterprises can start from open weights and choose from multiple compute options, including domestic chips, for continued training and domain fine-tuning—reducing dependence on a single compute supply chain.

    Third, practical lessons for developers. When running large-scale distributed training, prioritize clarifying your parallelism strategy combination (the mix of data, tensor, and pipeline parallelism), budget memory carefully and analyze communication costs, and establish checkpointing and fault recovery mechanisms early. Also pay attention to software-hardware version compatibility to avoid hidden performance losses from version mismatches.

    Conclusion

    From model loading and shard scheduling to gradient synchronization, adapting trillion-parameter model training is a tightly linked engineering chain. The successful training adaptation of a flagship open-source model on a domestic training-and-inference compute platform shows that ultra-large-scale training capability is becoming a “rite of passage” for domestic AI infrastructure. Going forward, as software stacks mature and multimodal training demands grow, large-scale training on heterogeneous compute will move toward a more standardized, replicable engineering paradigm—opening broader space for the deep integration of open-source ecosystems and domestic compute.