Engineering Practice for Large Model Training Adaptation on Domestic GPUs
Training adaptation—the work of making a large model train correctly and converge stably on domestic GPUs—is a distinct engineering challenge. It is far harder than inference deployment and does not mean pretraining the model from scratch on that hardware. This article breaks down what the work involves: sharding model states with FSDP2 so trillion-parameter models fit, keeping collective communication correct and efficient across nodes, and maintaining numerical stability through mixed precision, loss scaling, gradient clipping, and loss and gradient-norm monitoring across all ranks. It also covers operator correctness and alignment, and the engineering system that turns a single successful training run into a repeatable "out-of-the-box" experience. Readers will gain a clear picture of what a complete training adaptation requires and how to validate it.}
1. Why “Training Adaptation” Is a Distinct Engineering Problem
For a long time, discussions of domestic AI accelerators and deep learning frameworks focused mainly on inference deployment: whether a model can load, produce correct outputs, and complete a single forward pass within a reasonable latency. Now that models with tens of billions, hundreds of billions, or even trillions of parameters have become routine, the focus has shifted from getting inference to work to getting training to work.
The change looks like a move from using a model to training one, but it raises the difficulty by an order of magnitude.
- Inference works with static weights and a largely fixed computation graph. It mainly tests operator support and memory-access efficiency.
- Training must simultaneously manage three kinds of data: forward activations, backward gradients, and optimizer states. It also requires frequent synchronization across multiple accelerators and servers.
A single numerical anomaly, communication stall, or operator defect can be amplified over hundreds of iterations into training divergence. Getting a large model from “loading” to “updating stably” on a new domestic GPU is therefore a systematic engineering effort spanning the framework, operators, communication, and scheduling.
2. A Key Distinction: Training Adaptation Is Not Base Model Pretraining
When evaluating adaptation results, one boundary is easy to blur: completing the training adaptation of a model is not the same as pretraining its base weights on that chip.
- Training adaptation makes a model run the full chain of forward pass, backward pass, and optimizer update correctly on a given hardware and software stack. It verifies numerical correctness and stability. In other words, it validates that this hardware/software combination can support training this class of models.
- Base model pretraining builds the final weights from scratch through repeated iterations over massive corpora. It requires resources in data, compute scale, and training strategy far beyond a single adaptation validation.
Some authoritative technical reports list multiple hardware platforms for cross-validation at the operator level or of parallelism strategies. This, however, usually refers to validating inference or individual operators. It does not claim that the full compute for base model pretraining came from those platforms.
Understanding this distinction helps us assess the value of training adaptation objectively. It is a necessary prerequisite for bringing model capabilities to domestic compute, not a public claim about the final training result.
3. Full-Stack Training Pipeline: From Loading to Gradient Synchronization
A complete training adaptation has to make the entire chain work: model loading → shard scheduling → forward and backward passes → gradient synchronization → parameter update. The key stages are broken down below.
3.1 Model Loading and Sharding: Making the Model Fit
In a trillion-parameter model, the memory required for parameters, gradients, and optimizer states combined is often several times that of inference. A single GPU cannot hold it all. The three kinds of state must be sharded across every accelerator involved in training, using sharded data parallelism.
Take FSDP2 (Fully Sharded Data Parallel, second generation), a widely used approach. Its core idea is to shard parameters at the granularity of individual Transformer layers:
- Forward pass: required shards are temporarily gathered with
All-Gatherand released once they are no longer needed. - Backward pass: gradients are aggregated with
Reduce-Scatter. - Optimizer step: the optimizer updates only the parameter shards owned by the local GPU.
Compared with earlier approaches that flatten an entire layer into a single tensor and then split it, per-parameter sharding offers lower peak memory usage, finer-grained communication, and greater flexibility. It also combines more easily with strategies such as mixed precision and activation recomputation.
3.2 Cross-Node Communication: Keeping the Cluster in Sync
Once the parameter count exceeds the memory of a single machine, training has to scale to multiple nodes and GPUs. Communication then becomes the main bottleneck for training efficiency:
- Intra-node: nodes typically have high-speed interconnects with ample bandwidth, well suited to dense
All-GatherandReduce-Scattertraffic. - Inter-node: communication relies on the network and has higher latency. Communication and computation need to be carefully orchestrated so they overlap and computation “hides” communication as much as possible.
The key is to make collective communication between ranks both semantically correct and properly sequenced on the target hardware’s communication library. This prevents deadlocks, misordered operations, and missed synchronization points.
A typical validation treats all training processes across multiple nodes and GPUs as a single unit. They must complete several hundred consecutive optimizer updates without any process crash or numerical interruption. This tests the endurance of distributed training, not merely whether it can start once.
4. Numerical Stability: The Lifeline of Long Training Runs
Moving from “training runs” to “training runs stably” depends above all on numerical stability.
4.1 Mixed Precision and Numerical Overflow
Training commonly uses low-precision formats such as BF16 and FP16 to save memory and increase throughput. Their limited dynamic range, however, makes NaN or Inf values likely. Common engineering measures include:
- Computing overflow-prone operators (such as LayerNorm, Softmax, and some reductions) in higher precision;
- In FP16 setups, using loss scaling to amplify gradients before the update and restore them afterward;
- Applying gradient clipping to cap the global gradient norm and prevent exploding gradients.
4.2 Loss and Gradient Norm as Health Probes
The most direct signals of training health are the loss curve and the gradient norm (grad norm). In healthy training, loss decreases steadily overall, while the gradient norm stays within a finite, relatively stable range. A NaN, an Inf, or a sudden spike in the gradient norm usually points to one of three problems: a numerical error in an operator, a learning rate that is too high, or anomalous data.
The pseudocode below shows a common approach to numerical health monitoring inside the training loop:
# Pseudocode: sharded training loop with numerical health monitoringfor module in model.layers:if is_transformer_block(module):shard_module(module) # shard parameters/gradients/optimizer statesshard_module(model)optimizer = build_optimizer(model, lr=1e-4, betas=(0.9, 0.95), eps=1e-8)grad_clip = 1.0for step, batch in enumerate(training_loader):loss = model(batch).lossloss.backward()# Gradient clipping: suppresses exploding gradients, returns the global gradient normgrad_norm = clip_grad_norm_(model.parameters(), max_norm=grad_clip)optimizer.step()optimizer.zero_grad(set_to_none=True)# Numerical health probe: NaN/Inf on any rank means this iteration has failedif not is_finite(loss) or not is_finite(grad_norm):trigger_alert(step, loss, grad_norm) # capture the state and raise an alertbreakif step % log_interval == 0:log(step, loss=loss.item(), grad_norm=grad_norm.item())
One easily overlooked but critical detail is that monitoring must make a global decision across all ranks. In sharded training, each rank computes independently. If one rank silently produces an Inf and the lead rank does not detect it, training can keep updating with the bad value. The problem may not show up in the loss until much later.
This is why the conclusion that “loss and gradient norms remain finite throughout the run” carries real weight in adaptation validation. It demonstrates sustained observability of every training process.
5. Operator Adaptation: Correctness Before Efficiency
All of the above relies on one premise: every operator the model uses has a semantically correct implementation on the target hardware. Adaptation work often starts at the operator level:
- Operator coverage: making sure core operators have corresponding implementations, including attention, normalization, activation, and various reductions.
- Numerical alignment: comparing each domestic-hardware operator’s output element by element with a reference implementation, keeping the error within an acceptable threshold.
- Performance tuning: on top of correctness, optimizing memory access and fusing operators to approach the hardware’s peak compute.
Operator correctness is the foundation of training correctness. A tiny error can be amplified repeatedly during long training runs in low precision. It eventually surfaces as training divergence that is difficult to trace back to its source. A rigorous adaptation process therefore always puts correctness first and efficiency second.
6. From “It Trains” to “Trains Out of the Box”: The Engineering System
A single successful run only proves feasibility. The real moat is a reproducible, deliverable engineering system, which includes at least four layers of capability:
- Operator library: a collection of operators that cover mainstream model architectures and have been numerically verified;
- Multi-GPU coordination: stable, reliable distributed training with fault tolerance and checkpoint/resume support;
- Automation toolchain: one-click model conversion, configuration distribution, and monitoring and alerting;
- Accumulated experience: hands-on experience with diverse model types, including scientific computing models, world models, and embodied intelligence. This experience is gradually generalized to more cutting-edge large models.
When these capabilities are packaged as default, ready-to-use paths, users no longer have to rediscover the same pitfalls for every new model. Domestic compute can then move from “it trains” to “trains out of the box.”
7. Conclusion
Supporting large model training on domestic GPUs is essentially a systems engineering effort that takes the hardware from “usable for inference” to “trustworthy for training.” It requires:
- Clearly distinguishing training adaptation from base model pretraining;
- Building a complete pipeline for sharding, communication, and parameter updates;
- Safeguarding numerical health over long runs with loss and gradient norms;
- Solidifying the foundation of correctness at the operator level.
Once operator adaptation, multi-GPU coordination, and automation toolchains mature into an engineering system, the goal of “training out of the box” for frontier large models on domestic full-function GPUs will turn from a slogan into an everyday reality.
