Training Adaptation on Domestic GPUs: How to Validate Step Counts and Numerical Stability
This article explains how to evaluate whether a domestic GPU software-hardware stack has completed training adaptation, rather than pretraining. It covers four validation layers—operator correctness, sharding and memory, cross-node communication, and long-run stability—and describes what a reproducible record should include, an FSDP2 configuration example, how to read adaptation reports, and an internal acceptance checklist.
1. Distinguish Training Adaptation from Pretraining
Training adaptation means verifying that a software-hardware combination can complete the training flow for a certain class of models. This flow includes forward and backward computation, gradient synchronization, optimizer updates, and checkpoint saving and restoration. Pretraining means that a model starts from random initialization and completes all training on a given chip. These are different tasks. A model completing training adaptation on a domestic GPU does not mean that its base weights also came from that GPU.
This distinction is critical both when selecting hardware and when reading reports. Compute progress is often described as “completed training of a large model,” and readers can easily interpret this as “the model has already been trained from scratch on domestic cards.” Before reading, ask three questions: which part of the pipeline was validated, how many GPUs were used, and how many steps were run.
Pretraining, continued training, and fine-tuning are also different. Continued training continues from existing weights, while fine-tuning updates only a small number of parameters or makes small-scale data adjustments. The three have very different requirements for memory, data volume, and stability, and a report should clearly state which one is being discussed.
2. Four Checks for Training Adaptation
To train very large models stably on new hardware, four layers of checks are usually required.
- Operator correctness and numerical equivalence. Mixture-of-experts, multi-head attention, and mixed-precision computation use many custom operators. The forward and backward results of each operator must align with a reference implementation. Small per-step deviations accumulate over tens of thousands of steps and eventually appear as loss divergence or gradient anomalies.
- Sharding and memory. When the parameter count exceeds single-GPU memory, parameters, gradients, and optimizer states must be split across multiple GPUs, and computation requires all-gather operations. Overlapping communication and computation directly affects throughput.
- Cross-node communication. Bandwidth between nodes is usually lower than intra-node interconnect bandwidth. The communication topology for gradient synchronization, communication compression methods, and network jitter handling all affect training stability.
- Long-running operation. Numerical overflow, NaN propagation, process hangs, and memory fragmentation often appear only after hundreds of steps. A short successful run is not enough to prove that the pipeline is robust.
3. What a Reproducible Validation Record Should Contain
For a publicly announced adaptation result to be judged by others, it should contain at least the following information.
| Item | What to specify | Example wording |
|---|---|---|
| Model scale | Total parameter count and active parameter count; MoE models need both separately | Both numbers must be given, not just one |
| Hardware and interconnect | GPU type, per-GPU memory, number of nodes, intra-node and inter-node interconnect | For example: 2 nodes with 16 GPUs total, with a certain type of inter-node network |
| Training configuration | Sequence length, global batch size, gradient accumulation steps, compute precision | Give all specific values |
| Parallelism strategy | Sharding method, whether CPU offload is enabled, partitioning of expert parallelism and data parallelism | State the size of each parallelism dimension |
| Performance data | Time per step, throughput, multi-GPU scaling efficiency | Give the measurement method and warm-up steps |
| Stability results | Consecutive optimizer update steps, loss curve, gradient norm, NaN/Inf counts | Loss finite throughout, NaN/Inf count 0, state the start and end step numbers |
| Recovery capability | Whether checkpoint save and restore succeed, whether loss is continuous after restore | Compare several steps before and after restore |
If any item is missing, readers will find it difficult to judge the weight of the result. A statement such as “16 GPUs ran 400 steps” does not reveal the model size, how much memory each GPU carries, or whether the scale truly requires cross-node training.
4. How to Write an FSDP2 Sharding Configuration
First, clarify the version. FSDP2 is a new DTensor-based sharding implementation in PyTorch, and its entry point is the fully_shard function. PyTorch 2.6 and later can import it directly from torch.distributed.fsdp. Versions 2.4 and 2.5 require importing from a private path, and interface details also differ. PyTorch on domestic GPUs is usually maintained by the vendor, so the version number should follow the vendor documentation.
Below is a minimal runnable configuration snippet. Assume the process group has been initialized, the model consists of several Transformer layers, and the layer objects are stored in model.layers.
import torchimport torch.distributed as distfrom torch.distributed.device_mesh import init_device_meshfrom torch.distributed.fsdp import fully_shard, MixedPrecisionPolicyworld_size = dist.get_world_size()# The device type is determined by the vendor's PyTorch build; "cuda" is used as a placeholder here.mesh = init_device_mesh("cuda", (world_size,))mp_policy = MixedPrecisionPolicy(param_dtype=torch.bfloat16, # Parameter precision used for forward and backward computationreduce_dtype=torch.float32, # Precision used for gradient reduction)for layer in model.layers:fully_shard(layer, mesh=mesh, mp_policy=mp_policy)fully_shard(model, mesh=mesh, mp_policy=mp_policy)
If memory is tight, you can add the offload_policy parameter to fully_shard and pass CPUOffloadPolicy(). This places some state in host memory, at the cost of lower throughput.
The correspondence between FSDP1 parameters and FSDP2 is as follows.
sharding_strategyhas no directly corresponding parameter. FSDP2 shards parameters, gradients, and optimizer states per parameter by default, which is close toFULL_SHARD. To control whether full parameters are released after forward, usereshard_after_forward. For intra-node sharding and inter-node replication, use a two-dimensionalDeviceMesh.mixed_precisioncorresponds toMixedPrecisionPolicy.backward_prefetchis scheduled automatically by the framework. For manual control, use theset_modules_to_forward_prefetchandset_modules_to_backward_prefetchmethods provided byFSDPModule.cpu_offloadcorresponds tooffload_policy, with the valueCPUOffloadPolicy.
There is no absolute right or wrong configuration; whether it can be used depends on the memory budget. When presenting a configuration, also provide the total parameter count, per-GPU memory estimate, and communication overhead estimate.
The per-GPU memory estimate is as follows. If parameters are stored in FP32 and the Adam optimizer is used, model state is about 16 bytes per parameter: 4 bytes for the FP32 parameter, 4 bytes for the gradient, and 8 bytes for Adam’s first- and second-order moments. After FSDP2 sharding, per-GPU model state is approximately the total divided by the number of GPUs, plus activations, communication buffers, and fragmentation. The estimate should be checked against measured values. During training, record the peak value with the framework’s memory statistics interface, such as torch.cuda.max_memory_allocated; for domestic GPUs, use the vendor’s equivalent interface.
The communication overhead estimate is as follows. Each step usually includes a forward parameter all-gather, a backward parameter all-gather, and a gradient reduce-scatter. When resharding after forward and backward is enabled, the per-GPU per-step communication volume is approximately 3 × parameter bytes × (number of GPUs − 1) / number of GPUs. You can use a profiling tool to measure actual communication time and compare it with the estimate.
If these numbers cannot be provided, the configuration can only serve as an illustration of an approach, not as a reproducible basis.
5. How to Read an Adaptation Report
Based on the current material, what can be confirmed is this: in a two-node, 16-GPU cross-node environment, training completed 400 consecutive optimizer updates; during the process, loss and gradient norm remained finite, and no numerical overflow or abnormal interruption occurred.
The missing information is also clear. The report does not give the model’s total parameter count or active parameter count, does not give sequence length or batch settings, does not give per-GPU memory usage or throughput data, and does not provide verifiable experimental records. Therefore, the parameter scale mentioned in the report cannot currently be verified. When citing, rely on the original technical report or experimental record.
400 steps is a length suitable for link validation. It can cover part of the expert routing switching and checkpoint saving process. However, it cannot prove long-cycle convergence quality, nor can it represent stability in a production environment.
6. How Developers Should Perform Adaptation Acceptance
The following check order can be used directly for internal acceptance.
- Operator layer: Compare forward and backward results one by one against the reference implementation, and record the maximum relative error.
- Single-GPU layer: Run the complete training loop on a small-scale model, including optimizer updates and checkpoint saving.
- Multi-GPU layer: Check whether actual memory usage after sharding matches the estimate, and measure the overlap efficiency of communication and computation.
- Cross-node layer: Enable inter-node communication, train continuously for hundreds of steps or more, and record loss, gradient norm, and NaN/Inf counts.
- Recovery layer: Interrupt training midway, restore from a checkpoint, and confirm that the loss curve is continuous.
Set pass thresholds in advance for each layer. For example, loss remains finite, gradient norm stays within a preset range, and NaN and Inf counts are zero. Thresholds need to be determined according to the specific model and task; do not directly copy other people’s values. Acceptance results can be recorded using the template below.
| Layer | Metric | Threshold | Measured | Conclusion |
|---|---|---|---|---|
| Operator layer | Maximum relative error | Set by the team based on precision requirements | To be filled | Pass or fail |
| Single-GPU layer | Training loop and checkpoint | Runs end to end without errors | To be filled | Pass or fail |
| Multi-GPU layer | Peak memory vs. estimate deviation | Deviation within the agreed range | To be filled | Pass or fail |
| Cross-node layer | Loss, gradient norm, NaN/Inf counts | Loss finite; NaN/Inf count 0 | To be filled | Pass or fail |
| Recovery layer | Loss continuity after restore | No obvious jump across several steps before and after | To be filled | Pass or fail |
7. On “Out-of-the-Box Training”
“Out-of-the-box training” means that leading open-source models can start training directly on domestic GPUs without extensive manual tuning. This is a long-term goal. It still depends on operator adaptation, parallel strategy tuning, and toolchain maturity. Adaptation validation is not equal to pretraining, nor is it equal to production readiness.
For short-term selection, check the following items.
- Operator coverage: Are all custom operators used by the target model supported, and are there alignment test results?
- Parallel strategy: Have FSDP2, tensor parallelism, and expert parallelism been validated, and do the versions match?
- Toolchain versions: Is there vendor documentation for the version combination of PyTorch, the communication library, and the driver, and is it compatible with your code?
- Verifiable records: Is there a public validation record that includes the fields required in Section 3?
- Fault recovery: Have checkpoint saving and restoration, as well as long-running stability, been validated?
