Practical Guide to Running End-to-End Large Model Training on Domestic AI Compute Platforms

    This article explains why getting the full training pipeline to run reliably matters more than raw speed when adapting large model training to domestic AI compute platforms. It covers setting a fixed environment baseline, matching parallel strategies to interconnect topology, optimizing collective communication, maintaining numerical stability under mixed precision, building observability for fault diagnosis, and a practical acceptance checklist. The target milestone is 400 consecutive uninterrupted steps on a two-node, sixteen-card setup.

    1. Why “Getting the Pipeline Working” Matters More Than “Running Fast”

    When adapting large model training to domestic AI compute platforms, the first challenge a team faces is usually not performance but whether the pipeline can close the loop end to end. A working pipeline means the entire flow can be executed repeatedly: data loading, model construction, parallel partitioning, forward and backward computation, gradient synchronization, parameter updates, and checkpoint saving and restoration, all while maintaining numerical stability and steady throughput over several hundred iterations.

    When the pipeline is not working, performance numbers are meaningless. Common symptoms include processes hanging during initialization, communication domain setup timing out, operators missing implementations in the backward pass, loss values turning non-numeric under mixed precision, and saved checkpoints failing to load a second time. These issues are rarely single-point failures; they usually result from the combined effect of versions, drivers, compile options, and parallel configurations. For this reason, setting “400 consecutive steps without interruption” as the acceptance bar is a pragmatic and quantifiable engineering standard.

    2. Environment Baseline: Converging Variables to a Controllable Range

    The first principle of adaptation work is to reduce variables. It is recommended to fix a baseline and document it: operating system and kernel version, accelerator card driver and runtime version, compiler toolchain version, deep learning framework version, collective communication library version, and the version of any serialization libraries you depend on. Any single upgrade should be validated on its own, avoiding the situation where “ten things are upgraded at once and nothing can be traced.”

    1. # Illustrative only: collect an environment fingerprint for reproducibility and comparison
    2. collect_env > baseline_$(date +%F).log
    3. diff baseline_2024-01-01.log baseline_2024-01-08.log

    Environment alignment should also cover container image consistency. Distributing a single unified image to two hosts can significantly reduce cases where “it runs on a single machine but fails on multiple machines.” The image should pin the versions of dependencies related to random number seeds, so that numerical behavior does not drift due to minor upstream version changes.

    3. Topology and Parallel Strategy: Matching Partitioning to Interconnect Capability

    A two-node, sixteen-card setup is a typical small-scale multi-node training scenario, and its bottleneck is usually not peak compute but cross-node communication. Before defining a parallel strategy, clarify the topology first: whether high-bandwidth interconnect exists within a node, what the bandwidth and latency of the inter-node links are, and whether the network interface for each card is consistent. Based on this, a common trade-off is to place tensor parallelism within a node, pipeline parallelism across nodes, and data parallelism across all cards.

    A practical principle is to “put the most communication-heavy dimension on the highest-bandwidth link.” Tensor parallelism requires multiple reductions per layer and is suited to intra-node placement; data parallelism’s gradient synchronization can overlap with backward computation and is suited to cross-node use. If tensor parallelism is forced to run across nodes, throughput is very likely to drop sharply and time out within 400 steps.

    1. # Illustrative: priority ordering of parallel dimensions
    2. # 1) Intra-node: tensor parallelism (frequent communication, small payload per call)
    3. # 2) Inter-node: pipeline parallelism (point-to-point, can overlap with computation)
    4. # 3) Global: data parallelism (gradient reduction, higher bandwidth utilization after bucketing)
    5. parallel_order = ["tensor intra-node", "pipeline inter-node", "data global"]

    4. Communication Optimization: Hiding Synchronization Costs

    The efficiency of cross-node training depends largely on whether communication is hidden behind computation. Common techniques include gradient bucketing and fusion, triggering reductions in reverse order of the backward pass, separating communication and computation streams, and setting reasonable timeouts and retries for collective communication. Buckets that are too small cause too many launches, while buckets that are too large lengthen each synchronization; the right value must be measured empirically against the target throughput.

    1. # Illustrative: pseudocode for gradient bucketing and overlap
    2. for bucket in reversed(grad_buckets):
    3. launch_allreduce(bucket, stream=comm_stream) # overlaps with backward computation
    4. optimizer.step()

    In addition, bandwidth and latency should be part of routine monitoring. If periodic jitter appears within 400 steps, it is usually related to checkpoint saving, log flushing, or monitoring collection contending for resources, and can be mitigated by staggered writes and asynchronous flushing.

    5. Numerical Stability: Necessary Safeguards for Mixed Precision

    Large model training generally adopts mixed precision to trade for throughput, but differences in operator implementations on domestic hardware more easily expose numerical risks. It is recommended to enable loss scaling and observe whether its dynamic adjustment converges, use higher-precision accumulation for reduction-type operators, and keep a master copy of weights for normalization layers and optimizer states. During acceptance, record the loss curve and gradient norm to confirm there is no sustained rise or sudden drop to zero.

    1. # Illustrative: stability observation points
    2. log_metrics = ["loss", "grad_norm", "loss_scale", "step_time", "comm_time"]
    3. assert isfinite(loss) and grad_norm > 0

    6. Observability and Fault Localization

    The prerequisite for running 400 steps is being able to “see” what is happening. It is recommended to collect at least four categories of metrics: iteration time, communication time, memory usage, and compute utilization. Logs should carry a globally unique step number and host identifier to make sorting easier amid interleaved multi-node output. When a hang occurs, prioritize process stack sampling and communication domain status queries to determine whether the block is on the compute side or the communication side, rather than blindly restarting.

    Checkpoint strategy is also part of observability. Save at fixed step intervals and periodically perform a “save then immediately load” verification to ensure the restoration path works. When resuming training, compare the loss and optimizer state to confirm they match the state before the interruption.

    7. Acceptance Checklist

    • Environment fingerprint fixed, images consistent, version changes validated individually;
    • Parallel partitioning matched to topology, with cross-node links not carrying high-frequency reductions;
    • Communication bucketing and overlap in effect, with throughput jitter explainable;
    • Loss and gradient norm finite and stable under mixed precision;
    • Checkpoints can be saved, loaded, and used to resume training;
    • Metrics, logs, and stack sampling all in place.

    Following the approach above, completing 400 consecutive iterations on a two-node, sixteen-card setup is a reasonable and reproducible milestone. What it validates is not peak compute but the maturity of the adaptation process. Once this process is codified into a standard, the migration cost for subsequent larger-scale, longer-duration training tasks will drop significantly. In practice on platforms such as Baidu AI Cloud, treating the environment baseline, parallel strategy, and observability as three pillars is an effective path to improving the startup success rate of training jobs.