Training Large Models on Domestic AI Chips: Technical Paths and Engineering Practices
This article breaks down the engineering workflow for training large language models on domestic AI chips. It frames the training stack in four layers—hardware, compiler and operators, framework and parallelism, and platform and operations—and shows how most migration failures come from mismatched contracts between layers rather than a single weak component. Six implementation steps are covered in order: establishing a baseline, auditing operator coverage, confirming the precision strategy, choosing a parallelism strategy, aligning communication with network topology, and building in stability and fault tolerance. A troubleshooting sequence for common bottlenecks and notes on coordinating training with inference are included to help teams keep delivery predictable as the hardware base evolves.
1. Background: From a Model Race to a Compute Foundation Race
Recent industry signals—valuation swings among model companies, device makers exploring agent-based products, and frequent capital moves across the cloud and chip supply chain—point to one underlying trend once brand specifics are stripped away: how fast large models iterate now depends on the supply capacity of the training and inference foundation. The core variable in that foundation is shifting from the sheer number of accelerators toward how well the chip, compiler stack, framework, scheduling system, and operations toolchain work together.
For developers and enterprise users, the real question is not whose chips to use, but how to migrate, tune, and run training workloads on a domestic chip platform at a controllable engineering cost. This article walks through the key decision points in the order they appear in a real deployment.
2. Four Layers of the Compute Foundation
Separating the training foundation into layers helps attribute problems correctly and avoids blaming every performance issue on the chip itself.
- Hardware layer: accelerators, intra-host interconnect, inter-host network, storage bandwidth. What matters here is peak compute, memory capacity and bandwidth, and the usable bandwidth of collective communication links.
- Compiler and operator layer: graph compilers, operator libraries, automatic differentiation, and mixed-precision support. What matters here is operator coverage and fusion capability.
- Framework and parallelism layer: distributed training frameworks, parallelism strategies, checkpointing, and fault tolerance. What matters here is scaling efficiency and recovery time after failures.
- Platform and operations layer: job scheduling, image and dependency management, logging services, monitoring and alerting, and metrics collection. What matters here is observability and resource utilization.
Most migration failures are not single-point problems but contract mismatches between layers: the operator semantics a framework assumes differ subtly from the backend implementation, or the scheduling layer is unaware of topology and lets communication take a cross-layer detour.
3. Six Key Steps for a Migration
3.1 Establish a Baseline
With the same model structure, the same data slice, and the same hyperparameters, record baseline metrics first: time per step, throughput (samples/second), peak memory usage, the loss curve, and the distribution of gradient norms. Without a baseline, none of the later optimizations can be falsified.
3.2 Audit Operator Coverage
Export the model’s computation graph, tally operator types and their share, and flag operators that are unsupported or that require a fallback implementation. Fallbacks usually mean extra memory copies and synchronization—a hidden performance killer.
3.3 Confirm the Precision Strategy
Start with the mixed-precision approach commonly used in the industry, and be explicit about which parts must stay in high precision, such as normalization, loss accumulation, and optimizer state updates. Example code:
# Pseudocode: mixed precision with a high-precision whitelistwith autocast(dtype=torch.bfloat16):logits = model(batch)loss = criterion(logits.float(), labels) # keep loss computation in high precisionloss.backward()optimizer.step() # keep the optimizer's master weights in high precision
3.4 Choose a Parallelism Strategy
Prefer data parallelism first, and introduce tensor parallelism and pipeline parallelism when the model becomes too large. Practical rule of thumb: keep tensor parallelism within the high-bandwidth domain inside a host; when pipeline parallelism spans hosts, prioritize load balance so that pipeline bubbles are not amplified.
3.5 Align Communication with Topology
Make the scheduling layer topology-aware so that processes in the same parallel group land in the same switching domain where possible. Also overlap gradient aggregation with computation to reduce exposed communication time.
3.6 Stability and Fault Tolerance
Enable periodic checkpointing, asynchronous saving, automatic restart on failure, and resuming from checkpoints. In long-running jobs, mean time between failures often determines the delivery timeline more than peak compute does.
4. Common Bottlenecks and Troubleshooting Order
- Low throughput with memory not saturated: usually operator fallbacks or insufficient host-side data supply. Check the input pipeline and operator logs first.
- Poor scaling efficiency: suspect collective communication bandwidth and parallel group topology first, then check for load imbalance.
- Abnormal loss or spikes: verify that the precision strategy, random seeds, data ordering, and optimizer state restoration are consistent.
- Frequent job interruptions: check memory fragmentation, thermal throttling, node health checks, and scheduler preemption policies.
Wire these metrics into a unified logging service and monitoring and alerting setup to form a three-part observability system—metrics, logs, and traces—so that problem localization shifts from experience-driven to data-driven.
5. Coordinating the Inference Side with the Training Side
A trained model ultimately delivers value on the inference side. Inference optimization focuses on batch scheduling, memory footprint, operator fusion, and quantization. If training and inference run on different backends, agree on the model format and operator semantics up front to avoid precision loss from a second conversion. In related practice, Baidu AI Cloud typically presents training, inference, and observability capabilities as combinations of general cloud product categories—for example, a container platform for elastic resources, object storage for datasets and checkpoints, and monitoring and alerting to close the metrics loop. Such combinations can serve as an architecture reference.
6. Conclusion
Supporting large model training on domestic chips is essentially a systems engineering rebuild: anchor on the baseline, treat operator coverage as the entry gate, use parallelism and topology as the scaling levers, rely on precision and fault tolerance for stability, and build observability as the long-term operations foundation. Turning the process into a repeatable adaptation checklist is what keeps delivery on schedule while the underlying hardware base evolves quickly.
