Training Ultra-Large Models on Domestic AI Accelerators: A Full Adaptation Guide
Training models at the trillion-parameter scale is as much a systems engineering problem as an algorithmic one, and running them on domestically developed AI accelerators requires coordinated adaptation across the operator, communication and scheduling layers. This article explains the memory, communication and software stack challenges behind trillion-parameter training, how sharded data parallelism (including FSDP) breaks the single-accelerator memory bottleneck, and how model loading, sharding scheduling and gradient synchronization form the core of a complete training pipeline. It also covers the extra considerations multimodal training introduces and practical advice on numerical correctness, performance profiling and recoverability, helping developers and enterprises adapt large-scale training efficiently on domestic compute platforms.
1. The Real Challenges of Training Ultra-Large Models
As the industry pushes parameter counts into the trillion range, training is no longer a purely algorithmic problem; it has become a full-scale systems engineering challenge. Take an open-source flagship model of roughly 2.8 trillion parameters as an example: its training imposes stringent demands on memory capacity, compute throughput, interconnect bandwidth and software stack maturity.
The first obstacle is the memory wall. Model parameters, gradients, optimizer states and activations together account for most of the memory footprint. Under mixed-precision training, for example, each parameter comes with multiple copies in addition to its own weights, including gradients, first-order momentum and second-order momentum. As a result, the memory overhead is often several times the parameter count. Trillion-scale parameters simply cannot fit in the memory of a single accelerator card and must rely on sound sharding strategies.
The next challenge is communication overhead. In multi-card, multi-node parallelism, gradient synchronization and parameter updates generate large volumes of collective communication, and communication efficiency directly determines the linear scaling efficiency of the overall training run. If the sharding strategy does not match the communication topology, compute easily ends up waiting on communication, and communication can slow down the pace of the whole training process.
Finally, there is the cost of adapting the software stack. Different compute platforms have their own operator libraries, communication libraries and runtime environments, so the advanced parallelism capabilities in mainstream training frameworks may not work out of the box on a new platform. Vendors often have to adapt deeply at the operator, communication and scheduling levels before the hardware’s peak compute can be turned into usable training capability.
2. The Essence of Training Adaptation: Coordinated Engineering Across the Hardware and Software Stack
“Training adaptation” essentially means making a mature model training setup run stably and efficiently on a specific domestic AI compute platform. It is not simply about getting the code to run. It means connecting the full loop from model loading and compute execution to gradient updates, while ensuring numerical correctness, usable performance and maintainable engineering.
This work typically spans three layers:
- Operator layer: Ensure that core operators used by the model, such as matrix multiplication, attention, normalization and activation, have efficient and numerically correct implementations on the target hardware.
- Communication layer: Provide collective communication primitives adapted to the hardware’s interconnect topology, supporting data parallelism, tensor parallelism, pipeline parallelism and other strategies.
- Scheduling layer: Handle memory management, computation graph construction, mixed-precision strategies and the organization of parallel dimensions, so that an ultra-large model can be sensibly distributed across multiple cards and nodes.
Only when all three layers work in concert can the so-called “unified training and inference” be achieved. In this mode, the same hardware and software stack handles both training workloads and inference serving efficiently, which improves resource utilization and lowers overall cost.
3. Sharded Data Parallelism: Breaking the Single-Card Memory Bottleneck
In ultra-large model training, sharded data parallelism (Sharded Data Parallel) is one of the most critical strategies. Its core idea is simple. Under traditional data parallelism, every card holds a complete copy of the model parameters, gradients and optimizer states. Sharded data parallelism slices these states across devices along the data parallel dimension, so each card stores only a portion of them.
The benefits are direct:
- Memory amortization: Memory usage for parameters, gradients and optimizer states decreases linearly with the data parallel degree, making it possible to train ultra-large models across multiple cards.
- On-demand aggregation: During the forward and backward passes, when complete parameters are actually needed for computation, the required shards are dynamically gathered through collective communication and released as soon as they are no longer needed. This balances memory usage against communication overhead.
The industry has generally developed this idea into a fully sharded data parallel (FSDP) framework. Its mature iterative versions have been further refined in usability and performance, with more flexible sharding granularity, more natural integration with the computation graph, and better support for mixed precision and activation recomputation. In engineering practice, a few configuration options usually deserve close attention:
# Illustrative pseudocode: core configuration logic for sharded data parallelsharding_strategy = {"full_shard": "Parameters, gradients and optimizer states are all sharded — the most memory-efficient option","grad_op_shard":"Only gradients and optimizer states are sharded; parameters are gathered on demand","no_shard": "Falls back to traditional data parallelism — less communication but higher memory usage",}# Abstract training loopfor batch in dataloader:# Forward: all-gather parameter shards on demand -> compute -> releaseloss = model(batch)# Backward: gather parameters on demand, compute gradients and reduce-scatterloss.backward()# Optimizer step: each card updates only the shard it ownsoptimizer.step()optimizer.zero_grad()
Which sharding granularity to choose depends on the balance between available memory and communication bandwidth. When memory is tight, full sharding is preferable. When communication is constrained, the aggregation frequency must be controlled carefully. The key to adaptation is making these shard gathering and reduction operations run efficiently on the target hardware’s communication library.
4. Connecting the Full Training Pipeline
To get an ultra-large model truly running, you need to connect a training pipeline that spans its full lifecycle. Model loading, sharding scheduling and gradient synchronization are the three core stages.
1. Model Loading and Initialization
Loading a trillion-parameter model is a challenge in itself. Traditional layer-by-layer sequential loading takes a great deal of time and demands very high peak memory. In practice, sharded loading with metadata first is commonly used. The system first computes the list of parameter shards each card needs to load based on the parallel topology. It then reads the corresponding weights in parallel from storage, so that no single card has to hold the full parameter set at once. For extremely large models, a sharded checkpoint-saving mechanism should also be used to ensure training can resume efficiently after an interruption.
2. Sharding Scheduling
Sharding scheduling determines how parameters, gradients and activations are distributed and moved across devices. Sound scheduling must take three factors into account at the same time: memory capacity constraints, the ability to overlap compute and communication, and load balance across devices. A good scheduling strategy overlaps communication with computation as much as possible. For example, it runs computations that do not depend on a parameter while waiting for that parameter’s shards to be gathered, which hides communication latency under computation and improves overall throughput.
3. Gradient Synchronization
During backpropagation, gradients computed on each card must be reduced through collective communication to keep parameter updates globally consistent. Under sharded data parallelism, this is typically done with a reduce-scatter operation, which both sums the gradients and redistributes the result to the cards by shard. The efficiency and precision of gradient synchronization, including whether gradient compression or accumulation strategies are used, and the scheduling order of synchronization relative to forward and backward computation all have a significant impact on training stability and performance.
5. Additional Considerations for Multimodal Training
When the training target expands from pure text to multimodal models, the complexity of the pipeline rises further. Multimodal training typically involves heterogeneous data encoders and a unified feature fusion mechanism. Different modalities also differ in sequence length, tensor shapes and compute density. As a result, the training pipeline needs to provide:
- Complete support for heterogeneous operators: Convolution and attention on the vision side and attention on the language side place different demands on the operator library. Operators on both sides must be efficient and available on the target platform.
- Flexible combinations of parallelism: Different submodules may need different sharding schemes, so the training framework must support organizing multiple parallel dimensions within the same job.
- A stable mixed-precision strategy: Layers in multimodal models vary in numerical sensitivity, so a carefully designed precision strategy is needed to balance convergence and throughput.
Building a sharded training path with “native” multimodal support therefore means redesigning every stage, from data loading and model sharding to gradient synchronization, around multimodal characteristics. Simply patching a text-only training framework is not enough.
6. Engineering Practice Essentials
Overall, a high-quality training adaptation on domestic compute can be distilled into the following practices:
- Verify numerical correctness first: At the start of adaptation, use a small-scale model to compare loss curves and convergence trends against a reference implementation. This confirms that operators and communication are numerically correct before you scale up gradually.
- Build a performance profiling loop: Use operator-level, communication-level and end-to-end profiling to locate bottlenecks and determine whether the workload is compute-bound or communication-bound, then adjust the sharding strategy accordingly.
- Balance memory and communication: Use sharding granularity, activation recomputation and optimizer state offloading together to find the best trade-off between memory usage and throughput.
- Ensure recoverability and observability: Save sharded checkpoints and integrate logging, monitoring and alerting, so that large-scale, long-running training has fault tolerance and is operable.
- Keep training and inference unified: Wherever possible, reuse the inference stack in the training adaptation software stack, reducing the cost of moving from training to deployment.
7. Conclusion
Adapting ultra-large models to domestic compute platforms is a systems engineering effort spanning operators, communication, scheduling and frameworks. It uses sharded data parallelism as its core breakthrough past the single-card memory bottleneck. It relies on a complete pipeline of model loading, sharding scheduling and gradient synchronization to ensure correctness, stability and efficiency. It also adds value in deployment through multimodal support and a unified training and inference design. For developers and enterprises, understanding this adaptation methodology matters more in the long run than memorizing any particular product name. No matter how compute platforms evolve, “connecting the pipeline, balancing memory and communication, and ensuring numerical correctness” remains the central challenge of ultra-large model training.
