Large Model Training on Domestic GPUs: A Practical Adaptation and Validation Guide

    This guide explains how to adapt domestic GPU accelerators for trillion-parameter large model training and validate the setup at a small, equivalent scale. Using a dual-node, 16-card run of 400 consecutive optimizer updates over a roughly 130B-parameter MoE model (about 20B activated, 8 experts, top-2 routing), it documents the parallelization scheme (TP=2, PP=4, DP=2 with FSDP), key adaptation pitfalls in weight parsing and sharding, and the boundary between "a run that closes the training loop" and a full pretraining run. It also provides an actionable monitoring checklist for loss, gradient norms, communication wait, memory, and checkpoint writes; a checkpoint and fault-recovery strategy; a nine-step smoke-test path with pass criteria; and answers to common questions about parallel-strategy selection and long-run stability.

    1. Case Boundaries: What 400 Consecutive Steps on 16 Cards Across Two Nodes Actually Proves

    In large model training adaptation, many teams mistake “the model starts” for “the model has completed pretraining.” In reality, model loading, forward computation, backward propagation, gradient synchronization, optimizer updates, long-horizon convergence, and fault recovery are engineering problems at different levels. 400 consecutive optimizer updates on 16 cards across two nodes only show that the training pipeline can close the loop; they do not by themselves prove that a full trillion-parameter model can complete pretraining.

    This case targets trillion-parameter training needs but relies on small-scale equivalent validation: roughly 130B total parameters, about 20B activated, an MoE structure with 8 experts and top-2 routing. The hardware is a dual-node, 16-card domestic GPU setup with 64GB per card. To reduce disclosure and compliance risk, the hardware is described at a category level as “a domestic DCU accelerator card with 64GB per card,” without specifying a brand or model. The software stack is exemplified by ROCm/DTK, RCCL, MIOpen/rocBLAS, and PyTorch 2.2+ROCm; in a real project, teams should confirm specific software versions against their own channels, versions, and release standards.

    To let readers judge applicability, this case provides example reproducibility boundaries: sequence length 2048; global batch size 32; micro batch size 2; gradient accumulation 8; expert parallelism EP=1, meaning the 8 experts are not given a separate expert-parallel dimension but instead take part in tensor-parallel and pipeline-parallel splitting; capacity factor 1.0. If optimizer state is partially offloaded, at least 1TB of CPU memory per node is recommended; the storage system needs to support GB-level checkpoint writes with a recommended read/write bandwidth of at least 1GB/s; the network should provide at least 2×100Gb RDMA per node. If a team cannot obtain these measured conditions, this article should be treated as an illustrative case and not copied directly.

    The parallel relationships must be explicit: world_size=16; TP=2; PP=4; DP=2. FSDP shards parameters, gradients, and optimizer state only between the 2 cards within a DP group, without stacking any additional DP replication dimension. Peak memory per card is about 58GB, measured as the process-level memory peak during a training step. It includes model weights, gradients, optimizer state shards, activations, and communication buffers, but excludes inference services, debugging processes, or other tasks.

    The scope validated by this case includes: model loading, shard scheduling, forward computation, backward propagation, gradient synchronization, optimizer updates, checkpoint writes, and numerical stability checks. It does not represent full trillion-parameter pretraining, nor does it alone prove convergence quality, long-term production readiness, or multimodal training capability.

    2. Domestic GPU Adaptation Details: Model Loading, Parallel Splitting, and Pitfalls Already Hit

    The first step of domestic GPU training adaptation is not launching training but ensuring weights can be correctly parsed, split, and scheduled. Loading a large-parameter model usually involves weight-file parsing, tensor-dimension validation, data-type conversion, weight-layout adaptation, distributed initialization, and weight redistribution. If these steps are not explicitly validated, later training may only expose problems after tens or hundreds of steps.

    Common adaptation points in a domestic GPU environment include:

    • Using BF16 as the primary compute data type while keeping FP32 master weights, normalization-layer parameters, and optimizer state;
    • Splitting the embedding layer by vocabulary to avoid excessive memory usage for a single-card output layer;
    • Splitting the QKV weights in attention and the FFN weights in the MLP by tensor parallelism;
    • Explicitly marking layer boundaries and stage inputs/outputs in pipeline parallelism;
    • Validating the load order, shard boundaries, and rank mapping after FSDP parameter sharding;
    • Assessing memory and communication overhead for MoE routing, expert weights, and the capacity factor.

    Pitfalls actually encountered include: incorrect weight-name mapping, inconsistent tensor transpose direction, precision loss in some sensitive layers after BF16 conversion, anomalous loss caused by uneven vocabulary splitting in the output layer, unstable RCCL initialization order, and missing operators that force a CPU fallback and slow down training. These problems often do not fully surface in single-card smoke tests, so they must be validated step by step across multiple cards, multiple nodes, and small training runs.

    On parallel-strategy design, a trillion-parameter model cannot be fully resident on a small number of devices, so multiple parallelism strategies must be combined. Common strategies include data parallelism, tensor parallelism, pipeline parallelism, parameter sharding, optimizer state sharding, and gradient sharding. The dual-node, 16-card case uses a TP=2, PP=4, DP=2, FSDP combination. The goals are to verify whether the model can be split according to the domestic GPU memory boundary; whether different ranks can stably complete parameter exchange; whether consistency is maintained after optimizer state sharding; and whether cross-node communication shows long waits.

    For domestic GPU training, it is not advisable to pursue the most complex combination from the outset. Usually, first confirm whether single-card memory is sufficient, then decide whether to introduce tensor parallelism; if there are many layers or cross-card communication cost within a node is high, introduce pipeline parallelism; if parameters and optimizer state take too much space, then introduce FSDP or optimizer state offloading. Parallel strategy should start from small-scale validation and increase in complexity step by step. Otherwise, once loss becomes anomalous, it is hard to quickly determine whether the problem lies in operators, communication, splitting, or numerical stability.

    3. Gradient Synchronization, Numerical Stability, and an Actionable Checklist

    In data-parallel training, after each device computes local gradients, they must be synchronized through collective communication. Common communication primitives include all-reduce, reduce-scatter, all-gather, and broadcast. In large-scale training, communication overhead is often the performance bottleneck, so it is necessary to bucket gradients, overlap communication with backward computation, control the data volume of each communication, and reduce unnecessary synchronization points.

    Numerical stability is the core threshold of training adaptation. It is recommended to put loss, gradient norm, parameter update magnitude, memory usage, and communication wait time into the same checklist rather than only looking at whether training started successfully. The checklist should specify collected fields, sampling method, threshold rationale, and anomaly-counting window; otherwise “anomaly” itself becomes a black box that is hard to judge.

    Metric Collected Fields Sampling Recommended Threshold & Rationale Anomaly-Counting Window & Action Alert Level
    loss finite global_step, rank, loss value, NaN/Inf flag, data sample window Every step Cannot be NaN or Inf; threshold from baseline training stability experience On single-step NaN/Inf, stop training immediately and preserve state; 3 consecutive anomalies auto-rollback to the latest checkpoint P0
    grad_norm finite local grad_norm, global grad_norm, NaN/Inf flag, clipping coefficient Every step, aggregated every 100 steps Cannot be NaN or Inf; threshold from numerical stability experience On single-step anomaly, record state and skip step or clip; 3 consecutive anomalies auto-rollback to the latest checkpoint P0/P1
    grad_norm smooth 100-step moving average, current value, ratio Every step, aggregated every 100 steps Not more than 10× the moving average; this ratio is an empirical threshold that needs calibration per model and cluster If threshold exceeded, clip first; on 3 consecutive anomalies, skip step and record P1
    parameter update valid parameter differential norm, update rate, whether all-zero or an abnormal jump Every 100 steps Should not be all-zero or an abnormal jump; threshold from expected optimizer behavior On 2 consecutive check anomalies, stop and preserve state P1
    communication wait all-reduce, reduce-scatter, all-gather time, wait ratio, slow rank Every step, aggregated every 100 steps Wait ratio over 20% triggers alert; this threshold is an empirical value; calibrating with a measured baseline is recommended No auto-rollback; check slow nodes, RCCL timeout, and network links P1
    memory usage allocated, reserved, process peak, fragmentation rate Every step Alert above 90%, reduce batch or shard above 95%; threshold from memory-headroom experience No auto-rollback; adjust batch, sequence length, or offloading strategy P2
    checkpoint write step, path, size, checksum, recoverable state Every 100 steps Write succeeds and is verifiable; verification from file integrity and recovery validation On 2 consecutive write failures, alert and retain the previous checkpoint P1

    The purpose of this checklist is to move training adaptation from “it can start” to “it can be judged.” Especially when NaN or Inf appears for N consecutive steps, training should not blindly continue but should trigger single-step stop with state preservation, log retention, rollback on consecutive anomalies, tiered alerts, and manual confirmation. For communication wait and memory usage, baselines should be established against the specific hardware, model, and parallel strategy rather than mechanically applying fixed thresholds.

    4. Checkpoints and Fault Recovery: More Than Just Saving Model Weights

    Large-scale training cannot completely avoid interruption. Common interruptions include single-node failure, network jitter, memory overflow, data-loading exceptions, process exit, platform scheduling preemption, and storage read/write timeouts. Therefore, a checkpoint cannot save only model weights.

    Recommended checkpoint strategy:

    • Save interval: every 100 steps or every 30 minutes, whichever comes first;
    • Retention: keep at least 3 full checkpoints plus 1 most recent recoverable checkpoint;
    • Save content: model weights, optimizer state, learning-rate scheduler state, random-number state, current step, data read position, and parallel-strategy mapping;
    • Recovery steps: first verify checkpoint integrity, then restore model parameters, then restore optimizer state, and finally restore the data read position;
    • Risk reminder: if the checkpoint interval is 100 steps, a failure may lose at most the 99 unsaved steps of data. After recovery, data duplication or data skipping may occur, so the data-loading position must be recorded and the training-sample loss window evaluated.

    On compliance and data security, checkpoints, logs, and datasets must not contain sensitive information. If training data involves user privacy, trade secrets, or unauthorized data, desensitization, encryption, or access control should be completed before writing to disk. Before restoring a checkpoint, verify the file source, hash value, integrity, access permissions, and legitimacy of the write path to avoid loading weights or optimizer state from an untrusted source. Logs should likewise avoid outputting sensitive paths, keys, user identifiers, or un-desensitized samples.

    A training system without a checkpoint mechanism is not suitable for long-running operation. Checkpoints are not only a fault-recovery tool but also the foundation for training-asset accumulation and experiment reproducibility.

    5. From “It Runs” to “Stable Operation”: Engineering Capabilities

    Successful training adaptation does not equal production training capability. A truly reliable training system needs operator coverage, automation, monitoring, and fault-recovery capabilities working together.

    At the operator level, matrix multiplication, convolution, normalization, activation functions, loss functions, optimizer updates, backward propagation, and multi-shape inputs need to be validated. A single operator error may be imperceptible early on but can be amplified into an anomalous loss after tens or hundreds of steps. For domestic GPUs, operator coverage, numerical precision, boundary shapes, and fallback mechanisms should all be included in smoke tests.

    At the automation level, coverage should include environment checks, configuration generation, model parsing, parallel-strategy recommendation, task launch, metric collection, anomaly alerts, checkpoint saving, and fault recovery. Automation is not about being unattended but about reducing repetitive operations and human misjudgment. Especially in the early stage of domestic GPU adaptation, automation scripts should be able to automatically record environment variables, driver versions, communication-library versions, model configuration, and parallel mapping to facilitate reproduction and troubleshooting.

    At the monitoring level, coverage should include training loss, gradient norm, learning-rate changes, parameter update magnitude, memory usage, compute utilization, communication wait, data-loading latency, process liveness, and checkpoint-write status. A lack of intermediate-process observation significantly increases the cost of locating problems.

    The smoke test is recommended to proceed along the following path, with a pass standard set for each step:

    1. Single-card forward validation: pass standard is finite forward output, no memory anomaly, and shapes as expected; on failure, first check missing operators, data types, and weight loading.
    2. Single-card backward validation: pass standard is gradients without NaN/Inf and reasonable gradient norms; on failure, check backward operators, activation functions, and BF16 precision.
    3. Single-card optimizer-update validation: pass standard is that parameters change reasonably; on failure, check optimizer state, learning rate, and parameter mapping.
    4. Single-node multi-card data-parallel validation: pass standard is consistent loss, normal communication, and no long waits; on failure, check RCCL initialization, rank mapping, and network interfaces.
    5. Dual-node communication validation: pass standard is successful all-reduce, reduce-scatter, and all-gather; on failure, check RDMA, network cards, ports, and timeout configuration.
    6. 100-step numerical-stability validation: pass standard is no NaN/Inf and no abnormal grad_norm jumps; on failure, preserve state and roll back.
    7. 400-step pipeline-stability validation: pass standard is that 400 consecutive optimizer updates complete and metrics are collected completely; on failure, locate the slow node or numerical anomaly.
    8. Checkpoint-recovery validation: pass standard is that training can continue from the latest checkpoint with correct optimizer and data-position recovery; on failure, check checksum, saved content, and load order.
    9. Node-failure-recovery validation: pass standard is that training can continue after the failed node recovers without silent data loss; on failure, check scheduling, storage, and checkpoint strategy.

    If multimodal training is involved, additional validation items are needed. The text branch focuses on long sequences, vocabulary splitting, and attention communication; the image branch focuses on high-resolution inputs, hybrid convolution/attention operators, and memory peaks; the audio branch focuses on variable-length inputs, temporal splitting, and load imbalance. Multimodal amplifies data-pipeline, operator-correctness, and communication-stability problems, so it should be extended step by step only after single-modality stability is achieved.

    6. Practical Recommendations and FAQ

    1. What are the common mistakes in domestic GPU training adaptation?

    Common problems include: precision anomalies caused by mixing data types; incorrect weight-splitting direction; CPU fallback caused by missing operators; unstable RCCL or corresponding communication-library initialization; insufficient precision in normalization layers; checkpoints that fail to save optimizer state; data-loading positions not restored; insufficient memory-boundary estimation; compliance risk from logs that are not desensitized; and recovery failures caused by unverified checkpoint sources.

    2. How do you choose a parallel strategy?

    Look at memory first. If a single card can hold the full model and gradients, prefer data parallelism; if a single operator does not fit in memory, introduce tensor parallelism; if there are many layers and cross-card communication cost is high, introduce pipeline parallelism; if parameters and optimizer state take too much space, introduce parameter sharding or optimizer-state sharding. In the early stage of domestic GPU adaptation, validate in small steps first, then gradually increase parallel complexity.

    3. What should you watch for in long-term stable operation?

    Long-term stable operation requires simultaneously watching for finite loss, finite gradient norm, no communication timeouts, recoverable checkpoints, no memory leaks, unblocked data loading, and slow-node identification. Do not look only at throughput, nor only at single-step success. It is recommended to review the checklist once a week and update thresholds and slow-node baselines.

    4. How do you do smoke testing?

    Proceed in the order of single-card forward, single-card backward, single-card optimizer update, single-node multi-card data parallelism, dual-node communication, 100-step numerical stability, 400-step pipeline stability, checkpoint recovery, and node-failure recovery. Each step should record commands, versions, configuration, logs, and observed metrics, avoiding drawing conclusions only from successful results.

    5. How do you judge whether the training pipeline is reliable?

    Look at these criteria: finite loss; finite grad_norm; no NaN or Inf for N consecutive steps; recoverable checkpoints; consistent optimizer state; no long communication timeouts; observable memory and throughput; and the ability to continue training after a failure. Only when the training system moves from “trainable” to “well-trainable,” and then to “reproducible, recoverable, and scalable,” can domestic computing power form more stable real productivity in large model training scenarios.