Trillion-Parameter Model Training on Domestic AI Accelerators: A Complete Adaptation Path

    This article outlines a practical path for adapting domestically developed AI accelerators to very large model training, using a 2.8-trillion-parameter open-source multimodal model as a case study. It covers a three-layer stack from hardware and a unified software stack to a native FSDP2 framework path; key stages including checkpoint loading, multi-dimensional sharding orchestration, and gradient synchronization; multimodal-specific engineering considerations; and validation through numerical consistency and scaling efficiency. Readers gain a general methodology for running trillion-parameter training on heterogeneous compute.

    I. Background: Challenges of Trillion-Parameter Models for Training Infrastructure

    In recent years, the open-source community has released flagship models with hundreds of billions to trillions of parameters, and multimodal capabilities have become standard for such models. Training these models places extremely high demands on infrastructure. First, memory capacity: even with mixed precision and sharding strategies, a trillion-parameter model cannot fit its full model state on a single card. Second, interconnect bandwidth: after parameter sharding, frequent gradient synchronization imposes strict requirements on inter-card communication. Third, software ecosystem: mainstream training frameworks are deeply tied to a particular GPU ecosystem, so domestic accelerator cards need to build their own software stacks to support such training workloads.

    A notable case has emerged in the industry: one team used a domestic flagship AI training and inference accelerator card and its accompanying software stack to complete training adaptation for an open-source 2.8-trillion-parameter multimodal model. The work covered the end-to-end path from model loading and sharding scheduling to gradient synchronization. This practice offers general reference value for understanding how heterogeneous compute can handle very large model training. Using this case as an entry point, this article abstracts a general methodology for large model training adaptation.

    II. Overall Architecture of Training Adaptation: A Three-Layer Stack from Hardware to Framework

    To run very large model training on a new accelerator hardware platform, it is usually necessary to build three layers of capability.

    1. Hardware Layer: A Training/Inference Integrated Design Approach

    Modern AI accelerator cards generally adopt a training/inference integrated architecture, meaning the same card can support both high-throughput inference and large-scale distributed training. This requires the hardware to provide large-capacity, high-bandwidth memory (usually HBM-based), high-compute-density matrix computation units, and a high-speed interconnect bus that supports multi-card connectivity. In training scenarios, inter-card interconnect bandwidth often becomes a bottleneck earlier than single-card compute, so the interconnect topology within a multi-card server is critical.

    2. Software Stack Layer: An Alternative to CUDA-Like Ecosystems

    Domestic accelerator cards usually provide a self-developed unified compute software stack. Its role is similar to the runtime and driver layers in a GPU ecosystem, and it generally includes:

    • Device programming model: provides kernel authoring and compilation capabilities and supports efficient implementations of mainstream operators.
    • Communication library: implements collective communication primitives such as AllReduce, AllGather, and ReduceScatter, which are the communication foundation of distributed training.
    • Operator and BLAS libraries: provide deeply optimized implementations for high-frequency operators in Transformer structures, such as attention and GEMM.
    • Framework adaptation layer: connects the self-developed backend to the backend interfaces of mainstream training frameworks, minimizing changes to upper-layer training code.

    Schematically, a typical device abstraction layer interface looks roughly like this:

    1. # Pseudocode: backend abstraction
    2. device = backend.Device(index=0)
    3. stream = backend.Stream(device)
    4. tensor = backend.Tensor(shape=[4096, 4096], dtype="bf16", device=device)
    5. dist.all_reduce(tensor, op=dist.SUM, group=mesh["dp"])

    The significance of this abstraction is that the framework-level code in training scripts remains unchanged; only the underlying device and communication backend are replaced.

    3. Distributed Training Framework Layer: A Native FSDP2 Path

    A highlight of this adaptation is the construction of a native FSDP2 (Fully Sharded Data Parallel 2.x) multimodal training path. The core idea of FSDP is “full sharding”: model parameters, gradients, and optimizer states are all partitioned across cards and aggregated and released on demand. Compared with traditional data parallelism (DP), FSDP can reduce per-card memory footprint by more than an order of magnitude, making it a foundation for trillion-parameter model training.

    Compared with earlier versions, the main improvements in FSDP2 include finer-grained sharding control, DTensor-based tensor sharding representation, and better coordination with compilation optimizations such as torch.compile. Implementing a “native” path means not simulating through a compatibility layer, but directly implementing DTensor distribution and collective communication semantics on the self-developed backend. This avoids the extra overhead and edge-case issues introduced by a compatibility layer.

    III. Three Key Stages of the Complete Training Path

    1. Model Loading: Efficient Loading of Very Large Checkpoints

    For a 2.8-trillion-parameter model, BF16 weights alone reach the scale of several terabytes; adding optimizer states (Adam requires more than twice the additional space), the loading stage itself is an engineering challenge. Common practices include:

    • Sharded loading: The checkpoint is stored in shards, and each shard is mapped directly to the corresponding rank during loading, avoiding single-point aggregation followed by redistribution.
    • Lazy materialization and streaming reads: With object storage or parallel file systems, shards are streamed in order to control peak memory.
    • Metadata validation: Shard hashes and shape metadata are validated before loading to prevent failures from data corruption during large-scale training.

    2. Sharding Scheduling: Orchestrating Multi-Dimensional Parallelism

    Trillion-parameter models usually do not rely on FSDP alone; they combine multiple parallelism strategies:

    • Data parallelism (DP/FSDP): splits along the batch dimension, with FSDP responsible for sharding model states.
    • Tensor parallelism (TP): splits large matrices in a single layer across multiple cards, relying on high-bandwidth intra-node interconnect.
    • Pipeline parallelism (PP): splits the model by layers and uses micro-batch pipelining to hide communication.
    • Expert parallelism (EP): if the model uses a MoE structure, expert parameters are sharded independently and paired with All-to-All routing.

    The core of scheduling orchestration is to use a “Device Mesh” to express these parallel dimensions in a unified way:

    1. mesh = DeviceMesh("accel", [[0,1,2,3],[4,5,6,7]], mesh_dim_names=["dp","tp"])
    2. model = distribute_model(model, mesh, shard_fn=fully_shard)

    Each card plays multiple parallel roles in the mesh, and the framework executes the correct collective operations on the correct communication groups. Most of the difficulty in adaptation lies in the fact that the self-developed communication library must correctly and efficiently support these communication patterns and handle overlap with compute streams.

    3. Gradient Synchronization: Overlapping Communication and Computation

    The typical FSDP execution loop is: during forward, AllGather the full parameters of the current layer → compute → release; during backward, AllGather the parameters again → compute gradients → ReduceScatter to synchronize gradient shards. If communication and computation are serialized, device utilization drops significantly. Common optimization methods include:

    • Prefetch: initiate AllGather for layer N+1 parameters while layer N is computing.
    • Gradient bucketing and asynchronous ReduceScatter: aggregate gradients into buckets and synchronize them asynchronously, overlapping with subsequent computation.
    • Communication compression and precision strategies: use low-precision or quantized communication for gradient synchronization (with convergence impact assessed).
    • Topology-aware communication routing: use high-bandwidth intra-node interconnect and RDMA-class networks across nodes to reduce long-distance communication.

    Special Considerations for the Multimodal Path

    Compared with text-only training, multimodal training introduces a vision encoder, cross-modal alignment modules, and interleaved image-text sample organization. Engineering work needs to handle differences in sharding strategies for heterogeneous modules (for example, the vision tower can have separately configured parallelism), throughput matching in the multimodal data pipeline (to avoid data loading becoming a bottleneck), and the impact of different modality loss weighting on gradient scale. Building a “multimodal training path” means all the above stages must run end-to-end on the self-developed backend with numerical correctness guaranteed.

    IV. Adaptation Validation: Numerical Correctness and Scale Scalability

    Completing training adaptation does not mean the system simply “runs.” Two levels of validation are also required:

    1. Numerical consistency: Under the same data and random seed, compare the loss curve and gradient norm against a reference implementation. Single-step error is usually required to be within floating-point tolerance, and long-run training trends must be consistent.
    2. Weak and strong scaling efficiency: Measure MFU (model FLOPs utilization) at scales from hundreds to thousands of cards to verify whether the communication implementation and scheduling orchestration remain efficient at larger scale.

    In addition, fault tolerance during training (automatic checkpoint save/restore, faulty node removal and restart) is also an essential engineering capability for long-duration training.

    V. Summary and Outlook

    This case shows that domestic AI compute already has the complete capability to handle trillion-parameter open-source model training. Its technical path can be summarized as: training/inference integrated hardware + self-developed unified software stack + native distributed training framework path + end-to-end validation. For teams planning to conduct large model training on heterogeneous compute, the recommended focus areas, in order, are: operator coverage and communication library performance in the software stack, the degree to which framework adaptation is native rather than compatibility-layer emulation, and strict validation of numerical consistency. As the open-source large model ecosystem and domestic compute software stacks mature, the cost of adapting models to compute will continue to decline, and heterogeneous training infrastructure will become the norm.