Domestic GPU Large-Model Training Adaptation: FSDP2, 16-GPU Stability, and BF16/FP16 Troubleshooting
This article explains how to adapt and validate large-model training on domestic GPUs. It distinguishes training adaptation from full pretraining, outlines an FSDP2 training path for 16-GPU multimodal scenarios, defines a 400-step cross-node stability validation, and turns BF16/FP16 numerical risks into checkable items. It also covers common issues such as OOM, NaN, Inf, and communication timeouts, together with engineering practices for reproducible large-model training.
1. Running Large-Model Training on Domestic GPUs: From “Runnable” to “Verified”
As large-model parameter counts keep growing, domestic GPUs have become an important compute foundation for training and fine-tuning. Readers often ask:
- How do you adapt large-model training for domestic GPUs?
- How do you get FSDP2 working on domestic GPUs?
- How do you validate stable training on 16 GPUs?
- How should you handle common OOM, NaN, and communication timeout issues?
To answer these questions, the first point to clarify is this: a powerful GPU does not automatically mean that a large model can be fully trained on it. Training adaptation is about connecting model loading, forward computation, backward propagation, gradient reduction, optimizer updates, and checkpoint saving around a specific stack of hardware, drivers, frameworks, operator libraries, and communication backends. The goal is to complete verification under observable, reproducible, and monitorable conditions.
Therefore, this article does not discuss the vague claim of “supporting large models.” Instead, it focuses on a practical approach to domestic GPU large-model training adaptation:
- How to define validation boundaries.
- How to organize an FSDP2 training path.
- How to run cross-node stability tests.
- How to control BF16/FP16 numerical risks.
- How to build an engineering-oriented toolchain.
2. Training Adaptation Is Not Full Pretraining
When discussing domestic compute and large models, a common misconception appears: if a model can run on a certain chip, it is assumed that the model was pre-trained on that chip. These are two different things.
Training adaptation means making an existing model structure, weights, or training workflow run on a specific hardware and software stack, then validating the feasibility of training. It focuses on whether operators are available, whether the parallel strategy is reasonable, whether communication is stable, whether memory is sufficient, and whether numerical behavior is controllable.
Full pretraining, by contrast, starts from random initialization and uses large-scale data, a complete training strategy, and a large amount of compute to enable the model to develop foundational capabilities. Pretraining involves data mixtures, training rounds, compute sources, convergence strategies, and the path by which model capability is formed. It cannot be replaced by a single pipeline validation.
Therefore, phrases such as “16-GPU training,” “400-step validation,” and “short-duration stable training” in this article should be understood as model loading, single-step forward and backward computation, short-term stability validation, or parameter-efficient fine-tuning scenarios. They should not be interpreted as full pretraining. When describing specific capability, it is better to include additional details such as parameter count definition, frozen scope, sequence length, data scale, memory usage, and parallel strategy.
3. 16-GPU FSDP2 Multimodal Training Path: Define Boundaries First
FSDP2, or Fully Sharded Data Parallel, is a technique that shards model parameters, gradients, and optimizer states within a data-parallel group. Compared with traditional data parallelism, which keeps a full model replica on every GPU, FSDP2 aggregates parameters and performs gradient reduction on demand. This reduces per-GPU memory pressure and allows larger models to be trained or fine-tuned with a limited number of GPUs.
However, on domestic GPUs, it is not accurate to simply say that “16 GPUs can train a near-trillion-parameter model.” The scenario boundary should be clarified first. For example, it can be described as follows:
| Condition | Example Description |
|---|---|
| Validation goal | Model loading, single-step forward and backward computation, 400-step short-duration stability validation, or parameter-efficient fine-tuning |
| Parameter definition | Total parameters, active parameters, expert parameters, embedding table parameters |
| Freeze scope | Frozen backbone, partial unfreezing, LoRA adaptation, full-parameter updates |
| Sequence length | Text length, image resolution, multimodal input length |
| Batch size | Per-GPU micro batch, gradient accumulation, global batch |
| Parallel strategy | FSDP2 data parallelism, tensor parallelism, pipeline parallelism, expert parallelism |
| Memory strategy | Activation recomputation, offloading strategy, parameter aggregation granularity |
| Data type | BF16, FP16, FP32 master weights, communication precision |
| Observability | Loss, gradient norm, step time, memory peak, NCCL logs |
If the goal is “How to get FSDP2 running on domestic GPUs,” a typical path includes model loading, shard scheduling, forward and backward computation, gradient reduction, optimizer updates, and checkpoint saving.
The following conceptual code illustrates the flow. It does not represent the interface of any specific framework:
# Conceptual example: FSDP2 sharding wrapper and training loopmesh = create_data_parallel_mesh(dp_size=16)model = wrap_fsdp2(model,mesh=mesh,block_class=TransformerBlock,param_dtype=torch.bfloat16,reduce_dtype=torch.float32,checkpoint_interval=50,log_metrics=["loss", "grad_norm", "step_time", "oom", "nan_inf"])for step, batch in enumerate(dataloader):with autocast(dtype=torch.bfloat16):outputs = model(batch)loss = outputs.lossif is_nan_or_inf(loss):skip_step_and_log(step)loss.backward()grad_norm = clip_grad_norm_(model.parameters(), max_norm=1.0)if grad_norm.isnan() or grad_norm.isinf():skip_step_and_log(step)optimizer.step()optimizer.zero_grad()if step % 50 == 0:save_checkpoint(model, optimizer, step)
This pseudo-code emphasizes four checkable items:
- Data-parallel mesh.
- BF16 computation.
- FP32 gradient reduction.
- Logging and checkpointing.
In real deployment, additional details are also needed, such as driver versions, framework versions, operator library versions, communication backend versions, memory estimation, and a minimal reproducible configuration.
4. Cross-Node Stable Training Validation: Prerequisites for a 400-Step Test
When single-node memory is insufficient, or when training throughput needs to be improved, cross-node distributed training becomes necessary. The challenge of cross-node training is not just using more GPUs. It also involves more complex communication links, higher failure probability, and more difficult issue localization.
The goal of a two-node, 16-GPU, 400-step stability test is not to prove convergence capability or peak throughput. It is to verify whether the training pipeline can continue running reliably. To avoid misinterpretation, it can be described as follows:
“After defining the model scale, parallel configuration, version matrix, and validation checklist, a 400-step continuous training test is completed to evaluate pipeline robustness. It does not represent throughput or convergence capability.”
Before validation, it is recommended to prepare the following prerequisites:
| Check Item | Recommendation |
|---|---|
| GPU driver | Record the driver version and confirm compatibility with CUDA and the runtime environment |
| Training framework | Record framework versions, plugin versions, and communication library versions |
| Operator library | Confirm operator coverage, precision support, and known limitations |
| Communication backend | Record NCCL, RCCL, or other communication library versions |
| Network configuration | Confirm IB or RoCE bandwidth, topology, MTU, and timeout settings |
| Node scale | Clarify GPUs per node, number of nodes, and processes per node |
| Container image | Use a fixed image to avoid dependency drift |
| Random seeds | Fix data sampling, model initialization, and dropout seeds |
| Monitoring items | Loss, gradient norm, step time, memory usage, NCCL errors |
| Checkpoints | Define saving frequency, directory, recovery method, and available disk space |
For stability acceptance, the following indicators are recommended:
| Metric | Pass Criteria |
|---|---|
| Loss | Remains finite throughout the run, with no NaN or Inf |
| Gradient norm | Stays within predefined thresholds, with no sustained abnormal growth |
| Step time | No long periods of unresponsiveness, with acceptable fluctuation |
| NCCL errors | No timeouts, connection failures, or collective communication failures |
| OOM | No memory overflow |
| Checkpoint recovery | Training can resume from the latest checkpoint and continue |
If 16 training processes complete 400 steps of continuous updates while loss, gradient norm, and communication status remain normal, the pipeline has basic stability. If OOM occurs, reduce the batch size or sequence length. If NCCL timeout occurs, check the network, topology, and communication library configuration. If loss changes abruptly, check the data, learning rate, numerical type, and gradient clipping.
5. BF16/FP16 Numerical Stability: Checkable Items Rather Than Principles
Large-model training often uses BF16 or FP16 mixed precision to reduce memory usage and improve computational efficiency. However, lower precision also introduces risks such as underflow, overflow, NaN, and Inf. Therefore, numerical stability should not remain at the level of general principles. It should be converted into checkable items.
For BF16/FP16 training on domestic GPUs, the following items are worth checking:
| Check Item | Description |
|---|---|
| Initial loss scale | In FP16 scenarios, set a reasonable initial value and observe whether overflow occurs frequently |
| Overflow skip strategy | When NaN or Inf appears, skip the current step and record it to avoid corrupting parameters |
| Gradient norm clipping threshold | Set an upper bound, such as 1.0, or adjust it according to the task |
| Master weights precision | Keep optimizer master weights in FP32 to reduce precision loss |
| Optimizer state precision | Carefully choose BF16 or FP32 based on memory capacity and framework capability |
| Activation distribution | Watch for unusually large values, layer output explosions, or sparse NaN |
| Checkpoint locations | Check after loss computation, after backward propagation, after gradient reduction, and before optimizer update |
| Logging fields | Record step, loss, gradient norm, loss scale, memory usage, and elapsed time |
If loss becomes NaN during training, common actions include:
- Lowering the learning rate.
- Checking whether the data is abnormal.
- Confirming whether the loss scale is reasonable.
- Enabling gradient clipping.
- Skipping abnormal steps.
- Rolling back to the latest normal checkpoint.
If gradients become Inf, check for division by zero, abnormal inputs, numerical type errors, or abnormal gradient reduction behavior in communication.
6. Adapting Complex Large Models: Multimodal, World Models, and Embodied AI
Different model types place different requirements on the training pipeline.
Multimodal models usually involve text, images, video, and other input types. They require attention to data loading, modality alignment, memory usage of visual encoders, and changes in sequence length. Video or high-resolution inputs can significantly increase activation memory and easily trigger OOM.
World models often involve high-dimensional spatiotemporal modeling. Their training is more sensitive to parallel strategies, numerical precision, and long-sequence stability. Embodied AI models combine perception, decision-making, and control. They often involve simulation environments, action labels, trajectory data, and multimodal inputs, making the end-to-end pipeline more complex.
Therefore, evaluating whether a domestic GPU training stack is mature should not rely only on whether a single demo runs successfully. It should also examine whether the system can handle challenges such as:
- Long sequences.
- Video frames.
- Mixed multimodal inputs.
- Simulation data loading.
- Memory peak control.
- Exception recovery.
- Monitoring for long-running training.
7. Engineering Toolchain: From “Trainable” to “Lower Debugging Cost”
A successful adaptation is only the starting point. A valuable training adaptation process should produce reusable engineering capabilities. It is recommended to start with the following checklist:
- Driver and runtime: Define GPU driver versions, CUDA or equivalent runtime versions, and container image versions.
- Frameworks and plugins: Fix training framework versions, communication plugin versions, and distributed library versions.
- Operator library: Build an operator coverage table and record unsupported operators, approximate implementations, and performance bottlenecks.
- Communication backend: Configure NCCL/RCCL and other communication library parameters, and record timeout, retry, and topology information.
- Parallel strategies: Support combinations of data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism.
- Memory estimation: Provide estimation methods for model states, activations, communication buffers, and optimizer states.
- Checkpoint recovery: Support periodic saving, checkpoint validation, and recovery from failure points.
- Monitoring and alerting: Cover loss, gradient norm, step time, memory usage, disk usage, and NCCL errors.
- Troubleshooting guide: Provide standard procedures for OOM, NaN, communication timeout, and loading failures.
- Risk reminders: Validate at a small scale first, then gradually increase scale. Back up original weights, avoid overwriting existing checkpoints, and monitor disk and log capacity.
When model scale, parallel configuration, version matrices, and validation checklists are clearly defined, domestic GPU large-model training can significantly reduce debugging cost. This allows engineers to focus more on the model and data themselves, rather than repeatedly troubleshooting the underlying environment.
8. Common Questions and Troubleshooting
Model loading failure
First check the weight format, shard configuration, tokenizer/model structure version compatibility, and whether there is enough memory to load the shards.
Insufficient memory
First try reducing the micro batch size, shortening sequence length, enabling activation recomputation, adjusting FSDP aggregation granularity, or using parameter-efficient fine-tuning.
Communication timeout
Check inter-node networking, IB/RoCE status, NCCL logs, timeout parameters, MTU settings, and topology configuration. If necessary, compare single-node multi-GPU and two-node two-GPU setups to reproduce the issue.
Loss becomes NaN
Check abnormal data, learning rate, loss scale, input normalization, and gradient clipping. Then recover from the latest normal checkpoint.
Gradient becomes Inf
Check abnormal inputs, division by zero, numerical overflow, and communication reduction errors. Confirm whether gradient clipping is effective.
Conclusion
Domestic GPU large-model training adaptation is a system-level engineering effort. It involves operators, parallelism, communication, numerical precision, checkpoints, monitoring, and troubleshooting. To improve the reliability of the training pipeline, teams should:
- Understand the boundary between training adaptation and full pretraining.
- Define the scope of 16-GPU validation.
- Establish a 400-step stability validation checklist.
- Convert BF16/FP16 numerical stability into concrete checkable items.
As version matrices, adaptation checklists, and engineering toolchains gradually improve, domestic GPU support for large-model training can move from one-off validation toward sustainable, reusable, and operable engineering practice.
