Training a Trillion-Parameter Model on Domestic AI Accelerators: Adaptation Boundaries and an Engineering Checklist

    This article clarifies the critical difference between Day-0 inference adaptation and full training adaptation for large language models on domestic AI accelerators. It analyzes a publicly reported 16-GPU, 400-step joint training run, identifies the missing experimental details that limit its reproducibility, and provides a practical engineering reference: correct FSDP2 configuration, a minimal logging checklist for verifiable results, systematic debugging procedures for NaN losses and straggler nodes, and a validation checklist for claiming "ready-to-train" support.

    I. Training Adaptation vs. Day-0 Inference Adaptation: What’s the Difference?

    In industry discussions, the term “adaptation” is often used to describe two very different types of work. The first is Day-0 inference adaptation, which means a chip can run forward inference on the day an open-source model is released. The core validation here focuses on the correctness of operator outputs and inference throughput. The second is training adaptation, which requires the full forward pass, backward pass, and optimizer update loop to run stably on the target hardware, covering model loading, parameter sharding, gradient synchronization, and checkpoint saving.

    The validation goals and risk profiles differ significantly. The table below can help you determine which category a given report belongs to.

    Dimension Day-0 Inference Adaptation Training Adaptation
    Validation target Correct forward operator outputs Stable multi-step optimizer updates
    Critical path Weight loading, forward computation Loading, sharding, forward, backward, communication, optimizer, checkpointing
    Core metrics Output consistency, latency, throughput Loss curve, gradient norm, NaN/Inf count, per-step time
    Primary risks Missing operators, precision deviation Numerical overflow, communication hangs, straggler nodes
    Minimal validation set Output comparison on a few fixed prompts Multi-step training logs with fixed data and random seeds

    When you see a claim that a chip has “adapted Model X,” first confirm whether the validation covered inference or training. If the report does not state the compute source used for base pre-training, a reader cannot determine whether that chip can handle pre-training workloads at all.

    II. What This Practice Report Establishes — and What It Omits

    According to publicly available materials, in a two-node, 16-GPU joint training test, all 16 training processes completed 400 consecutive optimizer updates. Throughout the run, the gradient norm remained finite, with no numerical overflow or abnormal termination. These three findings can be cited as results of this test.

    The following information was not disclosed in the public materials, so this article makes no assumptions about it:

    1. The parallel strategy combination, e.g., how many GPUs were assigned to data parallelism, sharded parallelism, and tensor parallelism.
    2. Global batch size, micro batch size, and sequence length.
    3. The mixed-precision scheme, i.e., whether parameters, gradients, and communication used BF16 or FP32.
    4. The monitoring thresholds for loss and gradient norm, and whether gradient clipping was enabled.
    5. Performance data such as throughput, memory usage, and scaling efficiency.
    6. Model architecture details, including how multimodal inputs were encoded.

    Without these parameters, a 400-step result only demonstrates that under some undisclosed configuration, the training pipeline did not crash within 400 steps and gradients remained finite. It does not demonstrate stability over longer runs, on larger datasets, or on different clusters, nor does it indicate what level of training efficiency was achieved.

    III. FSDP2 Configuration: Key Points and the Correct API

    FSDP2 is PyTorch’s next-generation fully sharded data parallel implementation built on DTensor. The entry point is the fully_shard function. The earlier FullyShardedDataParallel wrapper belongs to FSDP1; the two have different interfaces and cannot be mixed. Below is a conceptual code example. For real use, adjust it to your model architecture and PyTorch version.

    1. import torch
    2. from torch.distributed.device_mesh import init_device_mesh
    3. from torch.distributed.fsdp import fully_shard, MixedPrecisionPolicy
    4. # 2 machines, 8 GPUs each, 16 GPUs total
    5. mesh = init_device_mesh("cuda", (2, 8), mesh_dim_names=("dp_replicate", "dp_shard"))
    6. mp_policy = MixedPrecisionPolicy(
    7. param_dtype=torch.bfloat16,
    8. reduce_dtype=torch.float32,
    9. )
    10. model = build_model() # user-defined model constructor
    11. # Shard submodules first, then the root module
    12. for block in model.blocks:
    13. fully_shard(block, mesh=mesh, mp_policy=mp_policy, reshard_after_forward=True)
    14. fully_shard(model, mesh=mesh, mp_policy=mp_policy)
    15. optimizer = torch.optim.AdamW(model.parameters(), lr=1e-4)
    16. for step, batch in enumerate(dataloader):
    17. loss = model(**batch).loss
    18. loss.backward()
    19. torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
    20. optimizer.step()
    21. optimizer.zero_grad()

    There are three key configuration points.

    First, sharding granularity. Sharding layer by layer allows each layer’s parameters to be freed promptly after the forward pass; reshard_after_forward controls this behavior. If the sharding granularity is too coarse, peak memory usage rises. If it is too fine, communication frequency increases.

    Second, estimating communication volume. The forward pass requires one all-gather for parameters. If full parameters are not retained before backward, an additional all-gather is needed, and gradients are distributed via reduce-scatter. Per-GPU communication volume is roughly proportional to parameter count. A rough estimate is: parameter bytes times 2, plus gradient bytes, all multiplied by (N−1)/N, where N is the number of GPUs in the shard group. This is an order-of-magnitude estimate; the actual value depends on the degree of overlap between communication and computation.

    Third, checkpointing. A sharded model should be saved using the distributed checkpoint API, recording the step, random number state, and optimizer state together. Consolidating everything into a single file is generally infeasible at trillion-parameter scale.

    IV. A Two-Node, 16-GPU, 400-Step Test: What to Record for Verifiability

    If you plan to reproduce or independently verify a test of this kind, record at least the following fields and publish them alongside your conclusions.

    Category What to Record
    Hardware Accelerator model, GPUs per node, inter-node network type and bandwidth
    Software Driver and firmware versions, framework and operator library versions, PyTorch version
    Parallel configuration Shard group size, replicate group size, whether tensor or pipeline parallelism is enabled
    Batch and sequence Global batch size, micro batch size, sequence length
    Precision and optimization Parameter/gradient/communication precision, optimizer, learning rate schedule, gradient clipping threshold
    Data and randomness Dataset version, random seed, whether data order is fixed
    Per-step metrics Per-step loss, gradient norm, NaN/Inf count, per-step time
    Checkpoints Save interval, recovery verification results

    Only with these details recorded can a 400-step result be audited. Otherwise, it is a conclusion without bounds.

    V. Debugging NaN, Stragglers, and Checkpoint Recovery

    1. What to Do When NaN or Inf Appears

    Step one: identify when the anomaly first appears. If it appears at the very first step, the cause is likely initialization or data. If it appears after a specific update, the cause is likely related to learning rate or a gradient spike.

    Step two: check the mixed-precision settings. BF16 has a large dynamic range and typically does not require dynamic loss scaling; FP16 does. If mixing precisions, confirm that the loss scale update logic is still working.

    Step three: observe the gradient norm. When it spikes, lower the learning rate or tighten the clipping threshold.

    Step four: inspect activation values layer by layer to locate the first module where values go out of range.

    Step five: rerun the first few steps on a reference device with the same batch of data and compare intermediate results.

    2. What to Do When a Node Falls Behind or Communication Hangs

    Step one: record the per-step time for each rank and identify nodes that are consistently slower.

    Step two: check inter-node network bandwidth and link error counters to confirm whether the RDMA links are healthy.

    Step three: set a communication timeout and keep full logs so that a hung collective operation can be located afterward.

    Step four: compare the slow node against healthy nodes for temperature, power draw, and clock frequency to determine whether there is a thermal or throttling issue.

    3. What to Do When Checkpoint Recovery Fails

    Step one: terminate the training run intentionally mid-training, then restore from the most recent checkpoint.

    Step two: compare the loss values for the first few steps after recovery against a run that was not interrupted. If the difference is within floating-point error, recovery can be considered successful.

    Step three: if the difference is significant, check in order whether the random number state, data loading position, and optimizer state were fully restored.

    VI. A “Ready-to-Train” Checklist

    Before claiming that a software–hardware combination is “ready to train out of the box,” verify each of the following items.

    • Model loading: Weights load in sharded form, and peak memory stays within the expected range.
    • Single-step consistency: With the same data batch and the same random seed, two runs produce identical loss values, or values within floating-point error.
    • Multi-step stability: No NaN or Inf appears within the target number of steps, and the gradient norm remains within established thresholds.
    • Communication health: Per-step time variance is acceptable, with no extended hangs.
    • Recovery capability: After a checkpoint restore, the loss curve continues seamlessly.
    • Reproducible records: All configuration and environment versions can be exported and rerun in a separate environment.

    Only when these conditions are met can a software–hardware combination claim verifiable training capability. A single continuous run is just the first item on this list.