Adapting Trillion-Parameter Model Training to a Chinese-Developed AI Compute Stack: A Practical Path

    This article describes the end-to-end work needed to bring training for a 2.8-trillion-parameter open-source multimodal model onto a Chinese-developed accelerator and software stack. It covers model loading, parameter sharding, gradient synchronization, and the multimodal training path, along with the benefits of a unified training and inference architecture and practical lessons for engineering teams.

    1. Background: From Inference to Training

    Recently, an open-source multimodal flagship model with 2.8 trillion parameters drew wide attention. For AI infrastructure teams, models of this size are easier to adapt for inference than for training. Inference mainly requires operator coverage and sufficient memory. Training involves coordinating data flow, parallelism strategy, memory management, and communication synchronization.

    A complete training adaptation typically needs to connect the following pipeline:

    • Model loading: correctly parsing and initializing weights and configuration on the target hardware;
    • Shard scheduling: splitting and distributing parameters, gradients, and optimizer states across multiple cards and machines;
    • Gradient synchronization: aggregating gradients efficiently across devices so the result is mathematically equivalent to single-card training;
    • Multimodal pathway: encoding and aligning heterogeneous inputs, such as text and images, in a unified way.

    Only when all four stages work end to end can training adaptation be considered complete. Getting the model to run is not enough.

    2. Technical Challenges in Training Adaptation

    1. Model Loading: More Than Reading Weights

    The weight files of trillion-parameter models are very large, so the loading stage has three problems to solve.

    Format compatibility. Mainstream open-source models commonly use Safetensors or similar sharded formats. The training framework must correctly parse tensor shapes, data types, and quantization markers on the target hardware. For mixed precision, such as BF16 weights with FP32 optimizer states, data types also need to be planned at load time.

    Memory planning. As a rough estimate, 2.8 trillion parameters stored in BF16 take more than 5 TB for the weights alone, far beyond the memory of a single card. The loading stage must therefore settle the sharding strategy in advance. The model can be loaded first and then split, or each shard can be loaded directly onto its target device. The second approach, called sharded loading, significantly reduces peak host memory and is a common practice in large-scale training.

    Initialization consistency. In training, randomly initialized parameters must remain semantically identical to the full model after sharding. This is typically achieved with a unified random seed and a deterministic mapping of parameter names.

    2. Shard Scheduling: The Core of FSDP

    Many teams build on Fully Sharded Data Parallel (FSDP). Its core idea is to shard all three categories of model state, parameters, gradients, and optimizer states, across devices. Parameters are gathered temporarily during the forward pass, on demand.

    Compared with the first generation, FSDP2 offers finer control over sharding granularity. Developers can decide per module whether to wrap it and how to shard it, instead of applying one policy to the entire model. For multimodal models, the vision encoder and the language model backbone can use different sharding and fine-tuning strategies. For example, the vision-side parameters can be frozen while only the alignment layers are trained. This substantially reduces memory and communication overhead.

    A typical wrapping strategy, shown as pseudocode:

    1. # Pseudocode: apply sharding at module granularity
    2. for block in model.transformer_blocks:
    3. apply_sharding(
    4. block,
    5. shard_param=True,
    6. shard_grad=True,
    7. shard_optimizer=True,
    8. reshard_after_forward=True, # Release the gathered copy immediately after the forward pass
    9. )
    10. # Freeze vision branch parameters; this branch only runs the forward pass
    11. freeze(model.vision_encoder)

    3. Gradient Synchronization: A Decisive Factor in Communication Efficiency

    Gradient synchronization is a key bottleneck for training throughput. Common optimizations include:

    • Overlapping communication with computation: during backpropagation, AllReduce or ReduceScatter can start as soon as a module’s gradients are ready, running in parallel with the computation of later modules;
    • Gradient bucketing: small gradients are grouped into larger buckets before communication, which amortizes the fixed latency of each transfer;
    • Mixed precision and gradient accumulation: computing in BF16 and accumulating master gradients in FP32 balances precision against bandwidth.

    Training also needs topology-aware collective communication. Traffic within a node uses high-bandwidth interconnects, while traffic between nodes crosses the network. Topology-aware scheduling can produce a several-fold difference in effective throughput.

    4. Multimodal Training Pipeline

    Multimodal models process heterogeneous data. Images are encoded by a vision encoder and concatenated with text tokens as “soft prompts.” In practice, the data pipeline must supply image-text pairs efficiently, and the sharding strategies for the vision and language branches must be configurable independently. A “native” multimodal training path means the framework supports multimodal input from data loading through loss computation. It does not rely on workarounds that stitch the modalities together.

    3. The Value of a Unified Training and Inference Architecture

    The adaptation work described here was done on a Chinese-developed accelerator designed for both training and inference, together with its supporting software stack. This reflects an important trend in AI infrastructure: training and inference share the same hardware and software ecosystem.

    A unified training and inference architecture offers three benefits:

    1. Lower migration cost: operators and kernels validated on the training side can be reused directly on the inference side, avoiding a second round of adaptation;
    2. Elastic resource scheduling: the same cluster can shift compute between training peaks and inference peaks, improving overall utilization;
    3. An end-to-end path to deployment: once a model is adapted on the training stack, the inference deployment path is already connected, which shortens the time from open-source release to production use.

    At the software level, a unified runtime needs to provide broad operator library coverage, including efficient implementations of core operators such as attention, MoE routing, and normalization. It also needs a distributed communication library, automatic parallelism interfaces, and compatibility layers for mainstream training frameworks. Together, these capabilities determine how much work adaptation actually requires.

    4. Lessons for Engineering Teams

    Several general engineering lessons follow from this adaptation work.

    First, treat adaptation as an end-to-end pipeline, not a set of isolated checks. Running a single operator or module does not mean training is usable. End-to-end numerical consistency checks, such as comparing loss curves and gradient norms, are the reliable standard.

    Second, memory planning comes before performance tuning. The first barrier in large-model training is fitting the model at all. Sharding, recomputation, and offloading can bring memory within the target card count. Throughput optimization comes after that.

    Third, multimodal support should be part of the framework’s native design. As multimodal capability becomes standard in flagship models, training frameworks that natively support heterogeneous modalities in parallelism strategies and data pipelines will reduce the adaptation cost of future models.

    Fourth, build a reusable adaptation process. A standardized checklist that covers model structure parsing, operator coverage checks, small-scale smoke tests, and full training helps teams keep pace with the fast release cycle of open-source models.

    5. Conclusion

    Training adaptation for trillion-parameter models is a practical test of how mature a compute ecosystem is. It requires coordination across hardware, communication libraries, parallel frameworks, and the operator ecosystem. As more teams complete full training pipelines for cutting-edge open-source models on Chinese-developed software stacks, the usable range of heterogeneous compute ecosystems keeps expanding. For AI engineering teams, understanding the general principles behind these adaptations, including sharded parallelism, communication optimization, mixed-precision management, and multimodal data paths, offers more long-term value than following individual news items.