Full-Stack Domestic AI Compute for Ultra-Large-Scale Model Training: Technical Practice and Reflections
This article examines the engineering challenges and practical solutions involved in training trillion-parameter multimodal models on domestic full-stack AI compute platforms. It breaks down the end-to-end training pipeline into three critical stages—model loading, sharded scheduling, and gradient synchronization—and details the software stack adaptations required to achieve native support for large-scale distributed training. The discussion also covers the architectural value of integrated training-and-inference AI accelerators, a methodology for adapting self-developed software stacks, and the broader implications for the industry and developers.
Background: The Comprehensive Demands of Ultra-Large-Scale Model Training on Compute Stacks
In recent years, flagship models in the open-source community have seen continuous growth in parameter counts. Trillion-parameter, multimodal models have moved from the laboratory into practical deployment. Training such models poses comprehensive challenges to the underlying compute system, far beyond the single question of “is there enough memory.”
Specifically, training a model with 2.8 trillion parameters requires solving several categories of engineering problems:
- Memory Wall: A single accelerator’s memory cannot hold the entire model. The combined demand for parameters, gradients, and optimizer states is typically tens of times the parameter count, necessitating multi-dimensional sharding and offloading strategies.
- Communication Wall: After the model is sharded across hundreds or thousands of accelerators, the communication volume from gradient synchronization and parameter broadcast grows linearly or even super-linearly with scale. Communication efficiency directly determines training throughput.
- Stability Wall: Training cycles last weeks or even months. Any single point of failure or numerical anomaly can cause significant loss, requiring robust fault tolerance and monitoring mechanisms.
- Ecosystem Wall: Mainstream training frameworks and operator libraries are largely built around specific hardware ecosystems. Non-mainstream hardware requires building a complete software stack from scratch to run end-to-end training.
Recently, a team announced that, based on a flagship AI training-inference integrated compute accelerator and a self-developed software stack, they completed the training adaptation of a 2.8-trillion-parameter open-source multimodal flagship model. They built a native fully-sharded data parallel training path, completing the full chain from model loading and shard scheduling to gradient synchronization. This progress provides a valuable reference sample for domestic compute stacks supporting ultra-large-scale training. This article attempts to distill transferable technical approaches and practical takeaways.
Three-Stage Breakdown of the Training Pipeline
A complete large-scale model training adaptation can be abstracted into three critical stages: model loading, sharded scheduling, and gradient synchronization. These three stages are interconnected—if any segment has a bottleneck, the throughput of the entire pipeline will be constrained.
Model Loading: From Weight Files to Distributed Device Mapping
The weight files of ultra-large-scale models are enormous. The key focus areas during the loading phase are:
- Shard Metadata Management. Modern open-source large models typically use sharded storage formats. Weights are stored as tensor slices, accompanied by index files describing the layer ownership and shape of each slice. The training side needs to correctly parse the index at startup and map slices according to the target device topology.
- Format Conversion and Precision Handling. Loading is often accompanied by precision conversion—for example, converting certain weights to lower-precision formats to save memory, while preserving high-precision critical paths (such as normalization layers and embedding layers) for the main computation.
- Streaming Loading and Lazy Initialization. A common practice is to use “meta device” initialization: first construct an empty model skeleton on a logical device, declare the shape and layout of each tensor, then load the actual weights piece by piece to the target device as needed, avoiding materializing the entire model on a single machine.
# Meta device initialization example (pseudocode)with torch.device("meta"):model = build_model(config) # Build structure and shapes onlymodel.load_sharded_state_dict(index_path) # Load piece by piece per shard index
Sharded Scheduling: Engineering Implementation of Fully-Sharded Data Parallelism
For trillion-parameter scale, the industry generally adopts fully sharded data parallelism (FSDP-class approaches) as the foundational parallel strategy. The core idea: shard parameters, gradients, and optimizer states across all devices. During computation, temporarily gather full parameter layers on demand, then release them immediately after computation completes.
On this basis, multiple parallel strategies are typically combined:
- Tensor Parallelism: Shards individual large matrix operations across multiple accelerators, suitable for scenarios with exceptionally large single-layer parameters.
- Pipeline Parallelism: Divides the model into stages by layers, executing across stages in a pipelined manner to improve device utilization.
- Data Parallelism: The outermost layer fans out data batches; each replica performs independent forward/backward passes and synchronizes gradients collectively afterward.
- Context Parallelism: Targets long-sequence multimodal training by sharding the sequence dimension, reducing peak memory usage in attention computation.
The key to a “native training path” is that these parallel strategies are not external patch-style adaptations. Instead, they are natively integrated with the software stack’s operators, communication, and scheduling layers. The system can automatically select the optimal sharding and communication strategies based on hardware topology (such as multi-accelerator interconnect bandwidth characteristics), reducing high-overhead cross-node communication.
Gradient Synchronization: The Decisive Role of Communication Efficiency
Typical optimization techniques in the gradient synchronization phase include:
- Bucket Communication and Compute-Communication Overlap: Gradients are grouped into buckets. Backward computation runs in parallel with communication for the previous bucket, hiding communication latency.
- Low-Precision Gradient Compression: Uses low-precision transmission for gradient communication while preserving convergence, reducing bandwidth consumption.
- Topology-Aware Communication Algorithms: Intra-node aggregation uses high-bandwidth interconnects; inter-node synchronization happens afterwards, hierarchically reducing cross-network traffic.
# Compute-communication overlap examplefor bucket in grad_buckets:bucket.reduce_scatter_async() # Asynchronously initiate reductionoptimizer.step(bucket) # Overlap with next bucket's computation
The Value of Training-Inference Integrated Architecture
Notably, this adaptation used “training-inference integrated” compute accelerators. The significance of this integrated design:
- Architectural Consistency: Training and inference share the same hardware microarchitecture and operator library. Numerical behavior validated during training can be directly transferred to the inference side, reducing precision alignment costs.
- Elastic Resource Reuse: The same cluster can flexibly schedule between training tasks and inference services, improving overall compute utilization and avoiding idle resource waste during training cluster downtime.
- Unified Software Stack: One compiler, one runtime, and one driver cover both training and inference scenarios, reducing maintenance and adaptation costs.
For developers, this means a shorter migration path from model completion to deployment, and a more controllable end-to-end engineering pipeline.
Adaptation Methodology for Self-Developed Software Stacks
The core competitiveness of domestic compute platforms largely depends on the maturity of self-developed software stacks (such as heterogeneous unified programming interfaces and operator libraries). A generalizable methodology can be distilled from this adaptation practice:
Step One: Operator Coverage Verification. Traverse all operators used by the target model, confirm efficient implementations exist on the target hardware. Prioritize high-frequency operators such as attention mechanisms, normalization, and activation functions. Replace or hand-optimize operators that do not meet requirements.
Step Two: Precision Alignment. Using a small-scale model and small dataset as the baseline, compare the loss curves and gradient norms between the reference implementation and the target implementation. Locate sources of numerical deviation layer by layer. Common issues include matrix multiplication accumulation order and low-precision conversion strategies.
Step Three: Small-Scale Joint Debugging, Then Large-Scale Scaling. First validate parallel strategy correctness on a single machine with multiple accelerators, then gradually expand to multi-machine scale, observing communication efficiency, memory levels, and throughput changes. Only then commit to full-scale training.
Step Four: Long-Run Stability Assurance. Establish loss anomaly detection, device health inspection, checkpoint resumption, and automatic rollback mechanisms. This is critical to the success of multi-week training tasks.
Implications for the Industry and Developers
- The software stack is the decisive factor for domestic compute. Hardware specifications are merely an entry ticket. Whether the training pipeline for mainstream open-source models can run natively is the key to ecosystem acceptance.
- Native support beats external adaptation. The “native” construction of the training path means greater optimization headroom for both performance and stability, and lowers the marginal cost of adapting future models.
- The open-source ecosystem is the touchstone. Continuously aligning with the training requirements of flagship open-source models is an effective path to validate and drive the co-evolution of domestic software and hardware.
As domestic compute software stacks continue to mature, the capability to train trillion-parameter models will gradually transition from “able to run” to “running well,” providing a more solid underlying foundation for large-scale AI applications.
