From Inference to Stable Training: Key Checks for Adapting Large Models to Heterogeneous Accelerators

    This article clarifies the common confusion between inference support, training adaptation, and base-model pretraining, then outlines practical checks for validating training stability on non-standard hardware. It explains how to organize large-model training with FSDP2, what metrics to track for stability, and how to report results honestly without overclaiming.

    1. Inference, Training Adaptation, and Base-Model Pretraining: What Each Actually Requires

    Many chip vendors announce that they have “adapted” an open-source large model, but what they often mean is inference support. Inference requires only forward computation. If operators run and produce outputs matching the reference implementation, the task is considered complete. Training adaptation is far more demanding: the software stack must support backpropagation, gradient synchronization, optimizer state updates, checkpoint saving, and fault recovery.

    Base-model pretraining is another stage entirely. Which hardware a model was pretrained on is usually stated by the model publisher. When technical reports show inference results on multiple hardware types side by side, that does not imply the model was pretrained on those devices. When reading such claims, first verify which stage they cover.

    Stage What needs to be verified Common misconception
    Inference support Operator correctness, output consistency, latency Treating inference as evidence of training capability
    Training adaptation Forward/backward computation, gradient sync, mixed precision, checkpoints A few successful steps considered stable training
    Base-model pretraining Convergence and stability across full data and step count Inference results on other hardware treated as pretraining provenance

    2. Organizing Large-Model Training with FSDP2

    FSDP2 (Fully Sharded Data Parallel 2) shards parameters, gradients, and optimizer states layer by layer across processes. Compared with FSDP1, FSDP2 operates on per-parameter shard representations, has fewer wrapper layers, and manages state more directly. In PyTorch, the entry point for FSDP2 is the fully_shard function, distinct from the FullyShardedDataParallel class used in FSDP1. Before use, confirm the correct interface path for your PyTorch version.

    Perform memory estimation before training. Under common mixed-precision configurations, each parameter consumes about 16 bytes, including the bf16 parameter, bf16 gradient, fp32 master weight, and two Adam states. A 3-trillion-parameter model would require approximately 48 TB (3 × 10^12 × 16 bytes). If each accelerator has 64 GB of memory, just holding these states needs roughly 750 cards—before accounting for activations, communication buffers, and memory fragmentation. So a dense 3-trillion-parameter model cannot fit on, say, 16 cards. For MoE structures, total parameter count may be large, but each token activates only a subset of parameters, significantly reducing memory pressure. If CPU or NVMe offloading is used, throughput will suffer. These assumptions should be clearly stated in any report.

    The code below only shows the order of API calls and is not runnable as-is; build_model and loader must be replaced with your own implementations.

    1. import os
    2. import torch
    3. import torch.distributed as dist
    4. from torch.distributed.fsdp import fully_shard, MixedPrecisionPolicy
    5. # The communication backend name is provided by the vendor's communication library; nccl is used here as an example.
    6. dist.init_process_group(backend="nccl")
    7. # Device binding must also be replaced with the vendor-provided interface.
    8. model = build_model()
    9. mp_policy = MixedPrecisionPolicy(
    10. param_dtype=torch.bfloat16,
    11. reduce_dtype=torch.float32,
    12. )
    13. # Shard each layer block first, then shard the whole model.
    14. for block in model.blocks:
    15. fully_shard(block, mp_policy=mp_policy)
    16. fully_shard(model, mp_policy=mp_policy)
    17. optimizer = torch.optim.AdamW(model.parameters(), lr=1e-5)
    18. for batch in loader:
    19. loss = model(**batch).loss
    20. loss.backward() # Reduce-Scatter gradients during backward
    21. optimizer.step() # Update sharded parameters
    22. optimizer.zero_grad()

    Sharding granularity affects memory and communication. If shards are too coarse, a single module’s full parameters can occupy too much memory during forward passes and trigger OOM. If shards are too fine, the number of communication steps increases, reducing the overlap between computation and communication. Measure both extremes during training instead of blindly relying on defaults.

    3. Which Metrics Prove Stability During Training

    A short run of a few hundred steps shows that the training pipeline works end-to-end, but it does not prove long-term stability. Define pass criteria before starting. Key metrics include:

    • Loss and gradient norm: Must remain finite throughout, with no NaN or Inf. Gradient norm fluctuations should stay within a pre-set threshold.
    • Numerical accuracy: bf16 generally does not require dynamic loss scaling. If fp16 is used, record the number of overflows and skipped steps; too many skipped steps indicate a problematic precision configuration.
    • Throughput and communication: Record tokens processed per card per second, the fraction of step time spent on communication, and cross-node bandwidth utilization, then compare with a single-node baseline. Congestion or packet loss on cross-node links usually appears as jitter in step time, which requires long-horizon monitoring to detect.
    • Fault tolerance: Document checkpoint save interval, save duration, and recovery time after intentionally killing one process. The loss curve after recovery should be continuous with the pre-interruption curve.
    • Run scale: Report step count, batch size, sequence length, and dataset size. Results can only be reproduced if these conditions are explicit.

    4. How to Judge Whether an Adaptation Is Complete

    Conclusions in a report should match the evidence that was gathered. Use the following checklist:

    1. State the model architecture, distinguishing dense from MoE models, and give both total parameter count and activated parameter count.
    2. Describe the parallel strategy and offloading approach.
    3. Provide a memory budget, listing the footprint of parameters, gradients, optimizer states, activations, and communication buffers.
    4. Provide a reproducible launch command, along with PyTorch, driver, and firmware versions.
    5. Give stability metrics and the number of training steps, and state whether fault recovery was exercised.
    6. When communicating externally, classify conclusions into three categories: inference-ready, short-run training functional, complete pretraining done. Do not mix them.

    5. Summary

    Calling inference support “training adaptation” is a common conflation in the industry. Training adaptation requires verified backpropagation, distributed gradient synchronization, and checkpoint recovery, backed by auditable run logs. For a model near 3 trillion parameters, memory estimation alone rules out many direct configurations. When evaluating such reports, first examine the model architecture, parallel scheme, step count, and metric definitions before deciding how far the conclusions generalize.