Training Trillion-Parameter Models on Domestic AI Accelerators: Adaptation Strategies and Common Pitfalls

    This article explores the key technical steps and practical challenges when adapting a trillion-parameter model training workload to domestic AI accelerator hardware. It covers memory budgeting, software stack requirements, core sharded training workflows (load, forward, backward, gradient reduction), communication cost estimation, and common pitfalls. The discussion is based on a documented 2.8-trillion-parameter open-source model training case, but focuses on reusable engineering patterns rather than specific performance claims. Aimed at ML engineers and infrastructure teams evaluating hardware alternatives for large-scale distributed training.

    1. Background: Three Pressures of Ultra-Large-Scale Training

    As model parameters grow from hundreds of billions to trillions, training difficulty is no longer about single-card compute alone. For a dense model with several trillion parameters, the main pressures concentrate in three areas:

    • Memory capacity: parameters, optimizer states, and intermediate activations cannot fit into device memory.
    • Communication volume: inter-card traffic grows with model size, reducing scaling efficiency.
    • Gradient synchronization latency: wait time during gradient all-reduce or reduce-scatter extends each iteration.

    Recently, a domestic AI accelerator vendor announced that it had completed training adaptation for an open-source model with 2.8 trillion parameters. According to public information, the training flow was completed on a specific hardware configuration and software version. The exact number of cards, network topology, throughput, and convergence metrics are subject to official release and third-party reproduction. This article does not repeat specific performance results. Instead, it breaks down the reusable technical path to help readers evaluate whether a similar approach fits their own scenarios.

    2. First: Compute the Memory Budget

    Before adaptation, you should estimate memory requirements. Under mixed-precision training with an Adam-family optimizer, each parameter typically occupies about 16 bytes:

    • BF16 weight: 2 bytes
    • BF16 gradient: 2 bytes
    • FP32 master weight: 4 bytes
    • Adam first and second moment: 4 bytes each

    Based on this, a 2.8-trillion-parameter model requires about 44.8 TB (2.8×10^12 × 16 bytes) for parameters, gradients, and optimizer states alone. Activation values consume additional memory, which depends on sequence length, batch size, and activation checkpointing strategy.

    These numbers show that no single GPU’s memory can hold the full model—the parameters, gradients, and optimizer states must be sharded across many cards. Assuming about 40 GB of usable device memory per card, only the state portion would require at least roughly 1,120 cards. In practice, you also need space for activations, communication buffers, and fragmentation, so the card count is often higher.

    3. Division of Labor in the Software Stack

    Above the hardware, the compiler, runtime, and collective communication library work together:

    • Compiler: maps the framework’s computation graph to hardware kernels, and fuses adjacent operators such as attention and normalization to reduce kernel launch overhead.
    • Runtime: manages memory pools, multi-stream scheduling, and event synchronization, determining whether compute and communication can truly overlap.
    • Collective communication library: implements operations such as all-gather, reduce-scatter, and all-reduce. Its performance directly affects the scalability of sharded training.

    For a vendor’s self-developed software stack, the adaptation effort usually focuses on three points:

    • Framework version and operator coverage completeness.
    • Whether the distributed training interface stays aligned with the framework’s mainline.
    • Bandwidth utilization of the communication library on the target topology.

    When selecting a hardware platform, ask the vendor for a framework support matrix and run a small-scale validation on your own model.

    4. Core Flow of Sharded Training

    4.1 Model Loading and Sharding

    The key to model loading is that each process only reads its own parameter slice. If every process reads the full weights, memory peak grows linearly with the number of cards, which can fail even at the loading stage. The recommended approach is to shard parameters layer by layer, so each card only holds its corresponding shard and writes directly to the shard location during loading.

    Shard layout needs to balance compute balance and communication distance. A common practice is to first split layers uniformly, then consider physical topology: place communication groups of the same layer within a high-bandwidth interconnect domain. Embedding and output layers often account for a large parameter share, so they can be combined with tensor parallelism to reduce per-card pressure.

    4.2 Forward Pass: Collecting Parameters on Demand

    In fully sharded data parallelism (FSDP), each card only stores a parameter shard. During the forward pass for a given layer, you need to use all-gather to collect that layer’s full parameters, compute the layer, and immediately release the collected tensor to avoid long-lived memory occupation. To hide communication latency, you can prefetch the next layer’s parameters while computing the current layer, overlapping communication with computation.

    4.3 Backward Pass: Gradient Reduction

    During backward propagation, you also need to gather the full parameters for the layer to compute the complete gradient. Then you use reduce-scatter to sum gradients and split them, so each card receives the gradient fragment corresponding to its own parameter shard. The communication volume here is proportional to the parameter shard size, which differs from the all-reduce semantics in pure data parallelism.

    This flow applies only to a fully sharded data parallel configuration. If you use pure data parallelism, gradient synchronization usually uses all-reduce. If you use tensor parallelism or pipeline parallelism, the communication group and pattern will change accordingly.

    To reduce scheduling overhead, you can bucket gradients from multiple layers into a single communication call. In mixed precision, parameters are stored and transmitted in BF16, while gradient reduction can use FP32 to preserve accumulation accuracy. These precision choices must be explicitly configured in the framework. Gradient compression (for example, TopK sparsification) can further reduce communication volume, but it affects convergence—validate it separately before enabling.

    4.4 Communication Volume Estimation

    Let the model parameter count be P, the bytes per transmitted parameter be b, and the number of cards be N. The communication volume per step per card can be roughly estimated as:

    Per-card communication ≈ 3 × P × b × (N−1) / N

    The factor 3 corresponds to the forward all-gather, backward all-gather, and gradient reduce-scatter. This formula does not account for overlap between communication and computation, nor the transmission precision of gradients—it is only for order-of-magnitude judgment. Actual numbers should be confirmed with communication library logs and bandwidth benchmarks.

    4.5 Conceptual Pseudo-Code

    The following code is only to illustrate the step order of the training loop. It is not directly runnable. Interface names and arguments follow the official documentation of the framework you use.

    1. # Conceptual illustration only: not runnable
    2. model = build_model()
    3. for layer in model.layers:
    4. fully_shard(layer) # Shard each layer; each card holds only a slice
    5. fully_shard(model)
    6. optimizer = AdamW(model.parameters(), lr=lr)
    7. for batch in dataloader:
    8. loss = model(batch).loss
    9. loss.backward()
    10. optimizer.step()
    11. optimizer.zero_grad()

    5. Common Pitfalls and Adaptation Notes

    When adapting a trillion-parameter training workload to a domestic accelerator platform, watch for the following issues:

    • Operator coverage gaps: some framework ops (e.g., specific flash attention variants, fused normalization kernels) may not be implemented or may fall back to slow paths. Verify the operator support matrix early.
    • Communication library efficiency: the vendor’s NCCL-like library may not achieve the expected bandwidth on your topology. Run bandwidth tests (e.g., all-gather and reduce-scatter with synthetic data) before launching large runs.
    • Mixed-precision numerics: FP32 gradient accumulation and BF16 parameter storage must be consistent. Some kernels may silently upcast or downcast, causing accuracy drift.
    • Memory fragmentation: frequent all-gather and release can fragment device memory. Use memory pooling and pre-allocated buffers if the runtime supports them.
    • Loading stage bottlenecks: loading the full model file on every rank can cause I/O and memory spikes. Split the checkpoint by shard and load only the relevant slices.
    • Pipeline and tensor parallelism interactions: if you combine FSDP with other parallelism strategies, the collective communication groups and synchronization points become more complex. Profile the communication graph to identify hotspots.

    6. Conclusion

    Adapting a trillion-parameter model to a domestic AI accelerator is not a simple plug-and-play exercise. It requires careful memory budgeting, a mature software stack, and a disciplined sharded training loop—from parameter loading to forward and backward passes to gradient reduction. The communication volume grows linearly with model size and inversely with the number of cards, so the network and collective library become a primary bottleneck. By following the steps outlined here and validating at small scale first, you can assess whether a given hardware and software combination is suitable for your training workload. For the most accurate performance and convergence numbers, consult the vendor’s official documentation and reproduction reports.