Domestic GPU Training Adaptation: From Inference Deployment to End-to-End Stable Training
Training adaptation on domestic (Chinese) GPUs is a very different challenge from inference deployment. Using a recent case—a near-3-trillion-parameter open-source flagship model trained stably across two nodes with 16 accelerators over 400 consecutive optimizer updates—this article explains why continuous, numerically sound training is the real bar for hardware readiness. It breaks down the full training pipeline from model loading and sharding through forward/backward computation, gradient synchronization, and optimizer updates to numerical health checks; contrasts training versus inference adaptation; and provides a validation design, an acceptance checklist, and a troubleshooting guide for common failure modes. It closes with an engineering path from "can train" to "train out of the box." Readers will learn how to evaluate, reproduce, and troubleshoot stable large-model training on domestic accelerators.
1. Why 400 Consecutive Steps Matter
A domestic GPU vendor recently announced that it completed training adaptation for an open-source flagship large model with nearly 3 trillion parameters. For validation, the company ran cross-node joint training on two nodes with 16 flagship training/inference accelerators, and all 16 training processes completed 400 consecutive optimizer updates. Throughout the run, loss and gradient norm stayed finite—no numerical overflow occurred and there were no abnormal interruptions. According to the vendor, they built a native multimodal training path based on the FSDP-style (sharded data parallel) paradigm, connecting the full chain from model loading and shard scheduling to gradient synchronization.
In isolation, “16 cards” and “400 steps” don’t sound like much. But when the task is training adaptation of a trillion-parameter model on domestic GPUs, these two numbers are exactly the dividing line between “can it run a single step” and “can it run stably for many steps”—for three reasons:
- Training is a long run, and numerical error accumulates. Inference needs only a single forward pass; if a result is wrong, you can recompute it. Training repeatedly runs forward, backward, and update steps along the same compute path, so any tiny rounding error or gradient deviation can be amplified by the optimizer, eventually showing up as loss divergence, gradient-norm explosion, or even parameters turning into NaN.
- Cross-node scaling introduces distributed consistency problems. Once you go from a single node to two nodes, the question shifts from “is the operator computed correctly” to “do all 16 processes compute exactly the same thing.” If any rank takes a different execution path than the others, if the communication order is inconsistent, or if a collective communication doesn’t complete, the whole job can hang or error out.
- Training exposes gaps in operator coverage. Training requires a complete set of backward operators, reduction operators, and mixed-precision conversion operators. If any single operator is missing, has the wrong precision, or lacks an in-place version, the job can crash suddenly at some step midway—and this kind of problem only surfaces after a few hundred consecutive iterations trigger a specific code path.
So “16 training processes, 400 consecutive optimizer updates, loss and gradient norm finite throughout, no abnormal interruptions” describes a complete training task’s ability to run continuously. It is a necessary condition for training adaptation to become usable—not a sufficient one.
1.1 A Common Misconception: Training Adaptation ≠ Original Training Compute
It is worth clarifying that completing training adaptation and “this model was pre-trained on this card” are not the same thing.
- Inference adaptation is deployment-side work whose goal is to run forward computation correctly and efficiently on the target hardware.
- Training adaptation is training-side work that proves the target hardware and software stack can carry a complete training workflow.
- A base model’s original training compute is determined by the foundation model developers during their development phase and cannot be inferred backward from adaptation results.
The industry is no stranger to similar cases. One foundation model developer listed validation results based on both domestic and foreign chips side by side in a technical report, which the industry generally understood as operator validation on the inference side. The organization did not publicly disclose the compute source for the base model’s original pre-training.
So for statements like “completed training adaptation for a given model,” a more reasonable interpretation is: it shows that the hardware and software stack is capable of carrying a complete training workflow—not a re-determination of where that model’s compute came from. Only by keeping these three things separate can you avoid mistaking an engineering milestone for a conclusion about compute ownership.
2. Training Adaptation vs. Inference Adaptation: Different Levels of Difficulty
Inference adaptation solves a relatively concentrated set of problems: the mainstream matrix multiplications, attention computations, and quantization operators run correctly and efficiently, memory holds the weights and KV cache, and per-request latency and throughput reach an acceptable level.
Training adaptation has to satisfy far more conditions at once:
| Dimension | Inference adaptation | Training adaptation |
|---|---|---|
| Core requirement | Correctness and performance of a single forward pass | Correctness, precision, and stability of forward + backward + parameter update + communication |
| Operator coverage | Mostly forward operators like linear layers, attention, and normalization | Also needs a complete set of backward operators, reduction operators, and optimizer-state updates |
| Numerical risk | Some output error is usually acceptable | Gradient error accumulates and amplifies over the training process |
| Memory structure | Weights + KV cache | Weights + gradients + optimizer states + activations |
| Communication profile | Concurrent requests can be handled independently; communication pressure is relatively low | All training processes must stay strictly synchronized at every step |
| Validation cycle | A single request is enough to judge | Needs hundreds to thousands of consecutive steps to expose problems |
The memory ledger makes the point best. Take a model with N parameters. With a mixed-precision scheme of “BF16 parameters + FP32 gradients + FP32 first- and second-order optimizer moments,” the parameters, gradients, and optimizer states alone require about 16N bytes. That is before activations, temporary communication buffers, and memory fragmentation. By this estimate, the static memory footprint of a trillion-parameter model is about 16 TB, so it must be spread across many devices using parameter sharding and tensor/pipeline parallelism before it can actually run.
This is also why the core of training adaptation is not “run one forward pass” but “keep every update numerically correct in a strictly partitioned distributed environment.”
3. Full-Chain Breakdown: From Model Loading to Gradient Synchronization
The “full chain” can be broken into four interlocking stages: model loading and sharding, forward and backward computation, gradient synchronization and optimizer update, and numerical health checks.
3.1 Model Loading and Sharding
The first step is to make a complete model “fit and shard correctly.” Modern training frameworks generally use a “device mesh + shard spec” to explicitly describe the partitioning: first define a multi-dimensional device mesh, then declare which dimension each parameter is sharded along and which group of devices in the mesh it maps to. Example code:
# Illustrative code: demonstrates the concept of shard spec and device mesh only; not a specific framework's APIfrom torch.distributed.tensor import DeviceMesh, Shard, distribute_tensor# Arrange the 16 cards into a 1D device mesh along the data-parallel (dp) dimensiondp_mesh = DeviceMesh("cuda", list(range(16)), mesh_dim_names=("dp",))# Shard the weight evenly along the dp dimension of the mesh; each rank holds only 1/16weight_sharded = distribute_tensor(weight, dp_mesh, [Shard("dp")])
In practice, the sharding strategy has to balance several questions:
- Optimizer-state precision: Parameter updates are sensitive to precision. Storing parameters in BF16 while maintaining an FP32 master copy inside the optimizer is a common way to balance memory and stability.
- Combining tensor parallelism and sharded data parallel: Tensor parallelism splits a single matrix multiplication across cards, reducing per-card memory pressure, but it needs communication at every step. It is usually confined to the high-speed interconnect within a node, while sharded data parallel spans across nodes.
- Expert parallelism: For a trillion-parameter model with a mixture-of-experts (MoE) structure, most parameters concentrate in the expert layers. Expert parallelism distributes different experts across devices and needs sensible routing and all-to-all communication to avoid load skew.
- Layered sharding for multimodal models: The vision encoder, text backbone, and modality adapters differ markedly in parameter count, so different parallelism and sharding strategies should be chosen per component.
After sharding, how to load the weights is another engineering challenge. If every process loads the full weights first and then shards them, the loading phase alone can fail because a single card does not have enough memory. A more robust approach is “shard-aware” loading, where each process reads and loads only the portion that belongs to it.
3.2 Forward and Backward: All-Gather of Sharded Parameters
The core idea of the FSDP-style paradigm is “gather when needed, release when done”:
- When the forward pass enters a layer, first temporarily gather that layer’s full parameters via all-gather, then release them immediately after the computation.
- When the backward pass reaches that layer, all-gather the full parameters again, then release them immediately after computing gradients.
- Gradients are aggregated via reduce-scatter, so each rank keeps only the gradient for the parameter shard it is responsible for.
# Illustrative code: single-step training pseudocode for FSDP-style sharded data parallel# Forward: gather params layer by layer, release immediately after computefor layer in model.layers:full_param = all_gather(layer.sharded_param)activation = layer.forward(input, full_param)del full_param # lower peak memory# Backward: gather params layer by layer again, then reduce-scatter gradientsgrad = backward(loss_fn(activation, target))for layer in reversed(model.layers):full_param = all_gather(layer.sharded_param)full_grad = layer.backward(grad, full_param)layer.sharded_grad = reduce_scatter(full_grad)del full_param, full_grad# The optimizer updates only the parameter shard held by this rankoptimizer.step()optimizer.zero_grad(set_to_none=True)
For domestic GPUs, the adaptation difficulties in this flow are mostly in the details:
- In-place operation compatibility: Some frameworks use in-place operations when replacing or zeroing parameters. If the hardware backend lacks the corresponding implementation or the semantics differ, it can directly interrupt training.
- Forward/backward graph differences: Modern frameworks generally support selective activation recomputation—saving only some intermediate activations and recomputing the rest during backward. If the forward and backward passes do not generate exactly the same sequence of operators or communication order, collective communication can become misaligned, showing up as random hangs.
- Prefetching and compute/communication overlap: To hide communication latency, frameworks typically gather the next layer’s parameters in advance and run computation and communication on the same or separate streams. The backend must guarantee correct event dependencies and execution order; otherwise it can read data that is not ready and produce nondeterministic results.
3.3 Gradient Synchronization and Optimizer Update
Under sharded data parallel, each rank holds a different shard of the same parameters, so:
- Gradients must first be reduced within the rank, then reduce-scattered with the other ranks, ensuring each rank gets the global gradient for the shard it is responsible for.
- Gradient clipping must happen after the global reduction and compute the global norm in FP32; otherwise each rank derives a different clipping coefficient, causing parameter shards to drift.
Optimizer updates are another adaptation focus. With an Adam-family optimizer, for example, each step involves element-wise operations over four tensors—parameters, gradients, and the first- and second-order moments—which places high demands on operator precision and fused implementations. In practice, parameter updates are usually done on the FP32 master copy to avoid rounding error accumulating repeatedly under BF16.
3.4 Numerical Health Checks: Keeping Loss and Gradient Norm Finite Throughout
“Loss and gradient norm finite throughout” sounds like a result, but behind it is a set of checks that run through the whole training process. At minimum, cover these five types of metrics:
- Loss: Check that it is finite, and compare it against the training curve from a reference implementation.
- Global gradient norm: Check that it is finite and whether it keeps rising relative to the baseline.
- Parameter norm and update norm: The update norm is the per-step change in parameters, used to judge whether the optimizer is actually taking effect.
- Memory level: Watch for a slow leak that grows steadily with step count.
- Per-step time: Watch for performance degradation as step count increases.
# Illustrative code: numerical health checks in the training loopGRAD_NORM_BASELINE = NoneALERT_STREAK = 0for step, (inputs, targets) in enumerate(dataloader):loss = model(inputs, targets).mean()if not isfinite(loss):# Skip this step's update and record the intermediate activations at the point of failure for debuggingraise RuntimeError(f"[step={step}] loss is not finite")loss.backward()grad_norm = global_grad_norm(model.parameters()) # computed after global FP32 reductionif GRAD_NORM_BASELINE is None:GRAD_NORM_BASELINE = grad_normif grad_norm > 3 * GRAD_NORM_BASELINE:ALERT_STREAK += 1if ALERT_STREAK >= 3: # trigger only after 3 consecutive anomalies to avoid false positives# e.g., skip this step's update, lower the learning rate, and save a snapshothandle_anomaly(step, grad_norm)else:ALERT_STREAK = 0optimizer.step()optimizer.zero_grad(set_to_none=True)
The value of this mechanism is that it turns “training crashes” into an engineering problem that is “locatable, attributable, and recoverable.” When an anomaly occurs, developers can clearly know which step, which type of metric, and which stage deviated from expectations, rather than facing a vague error.
4. How to Test “400 Consecutive Steps”: Validation Design and Acceptance Checklist
A convincing training-adaptation validation should include at least these four types of tests:
- Single-step alignment (sanity check): Fix the random seed and data batch, have the domestic GPU and the reference implementation run the same training iteration, and compare loss, gradient norm, and the outputs of several key layers. This step quickly surfaces numerical precision deviations.
- Soak test: On a fixed two-node, 16-card configuration, run for several hundred steps or more, while monitoring the finiteness of loss and gradient norm, memory level, and per-step time. The reason for choosing the hundreds-of-steps scale is that problems like accumulated memory fragmentation, slowly growing buffers, and extreme distributions in long-sequence data often only surface after tens to hundreds of steps.
- Data diversity coverage: Mix data batches across different modalities, lengths, and expert-routing distributions. For multimodal tasks especially, a purely text batch might not trigger the vision branch’s code path at all.
- Scalability trend test: Repeat the same tests on more nodes and observe whether per-step time grows nearly linearly and whether the communication overhead share worsens with scale.
Based on these tests, you can put together a reusable acceptance checklist:
| Acceptance dimension | Core question | Typical check method |
|---|---|---|
| Numerical correctness | Do loss and gradients match the reference implementation? | Fixed-seed single-step alignment; compare key-layer outputs |
| Long-run reliability | Can it run for hundreds of steps without interruption? | Soak test; monitor NaN/Inf and abnormal exits |
| Numerical health | Are loss and gradient norm finite throughout? | Real-time monitoring; set alert thresholds on gradient norm |
| Memory stability | Is there a slow leak or fragmentation buildup? | Monitor the memory-level trend as step count grows |
| Cross-node consistency | Are all 16 processes strictly synchronized? | Set collective-communication timeouts and enable communication debug logs |
| Scalability | Does performance scale linearly as nodes are added? | Compare per-step time and communication share across scales |
It is worth emphasizing that the value of these tests lies in being “repeatable.” The test configuration, data construction, and pass/fail thresholds should all be fixed, forming a regression test that can run automatically after every adaptation—not a one-off manual validation.
5. Common Failure Modes and Troubleshooting
| Symptom | Common root cause | Troubleshooting |
|---|---|---|
| Loss becomes NaN or Inf | Numerical overflow under low precision, anomalous input samples, learning rate too high | Locate the first anomalous sample and compute layer, switch to FP32 to verify, check data preprocessing |
| Gradient norm keeps rising | Insufficient optimizer-state precision, out-of-sync parameter updates | Compare gradient norm and clipping coefficients across ranks; check whether FP32 master parameters are used |
| Training hangs randomly | Inconsistent communication order across ranks, asymmetric conditional branches | Enable communication debug logs, check that collectives appear in pairs, set communication timeouts |
| Out of memory or slow leak | Parameters not released after gathering, abnormal buffer reuse, fragmentation buildup | Monitor memory vs. step count, check the “gather–release” pairing logic |
| Loss persistently deviates from the reference | Backward-operator semantics differ, normalization differs, random-number state differs | Compare forward outputs and gradients layer by layer, unify random-number and initialization strategies |
| Per-step time grows with step count | Memory fragmentation, repeated buffer allocation and release | Observe the memory and time curves, adjust the memory allocation strategy |
The key to this troubleshooting approach is to turn “training won’t run” into “which stage, which metric went wrong,” shifting problem localization from guesswork to evidence.
6. From “Can Train” to “Train Out of the Box”: The Engineering Path
The case above represents a clear capability-evolution path in the domestic-compute ecosystem: first complete single-step correctness validation, then achieve long-run stability, and finally deliver large-scale, efficient training that works out of the box. According to public reports, domestic GPU vendors have recently delivered several “domestic chips training domestic models” results, including:
- Completing full training from scratch for a science foundation model of about 236 billion parameters;
- Supporting full-stack native training for a five-dimensional world model;
- Jointly completing the full training pipeline for an embodied-AI brain model with research institutions.
They are also pushing forward training of trillion-parameter large models.
The significance of these results is that they cover not only language models but also differentiated scenarios like scientific computing, world modeling, and embodied AI—each with different demands on operator libraries, parallelism strategies, and numerical stability. As domestic chips and China’s large models iterate in tandem, mutual adaptation and mutual refinement between the two have become the norm. Cloud service providers represented by Baidu AI Cloud are also continuing to invest in heterogeneous compute scheduling, distributed training frameworks, and training observability, driving “hardware–framework–toolchain” co-optimization to lower the cost of migrating large-model training.
From an engineering perspective, “out of the box” can be broken into three layers of capability:
- Out of the box: Mainstream open-source training frameworks run without modification or with only minor changes, with clear compatibility notes on operator coverage and parallelism-strategy configuration.
- Train immediately: Provide validated reference configurations, data-preparation scripts, and a one-click startup flow, so users do not have to figure out parameters on their own.
- Sustainable: Have automated regression tests, automatic fault recovery, and performance-baseline monitoring, so availability can be quickly reconfirmed after a model or framework version upgrade.
7. Conclusion
A domestic GPU completing training adaptation for a near-trillion-parameter model and achieving 400 steps of continuous, stable training on two nodes with 16 cards is an important milestone in domestic compute’s journey from “can do inference” to “can train” and then to “train stably.” But for developers and enterprise users, what is more worth attention is the methodology behind it:
- Training adaptation is far harder than inference adaptation; the memory ledger, backward operators, and communication consistency are all hard gates.
- Training adaptation is not the same as ownership of the original training compute; the two must be strictly distinguished.
- To verify training capability, look at a combination of single-step alignment, soak tests, data diversity, and scalability trends—not the result of a single demo.
- Going from “can train” to “train out of the box” ultimately relies on a standardized, reproducible engineering system.
As operator coverage, sharded parallelism, mixed precision, and automated toolchains keep maturing, the migration cost of large models on domestic compute will continue to fall, and more teams will shift their energy from “getting training to run” to “getting training to run better.”
