Getting Large Model Training Working on Domestic AI Accelerators: A Two-Node, 16-Card Practice Guide

    This article walks through how to validate an end-to-end large language model training pipeline on domestic AI accelerators in a two-node, 16-card setup, finishing with a 400-step smoke test. It explains what "getting the training pipeline working" actually means, breaks the pipeline into its core stages, and examines the main challenges of scaling from a single card to two nodes: operator adaptation and numerical precision, collective communication, and parallel strategy. It then covers key implementation points such as software stack alignment, mixed precision and loss scaling, parallel topology and communication optimization, and data pipeline reproducibility, along with the criteria for judging whether the 400-step run has truly passed and the engineering best practices that help avoid common pitfalls.

    1. Background: Why “Getting the Training Pipeline Working” Is the Critical Step

    As compute self-sufficiency becomes a hard requirement, more and more teams want to run large-scale language model training on domestic AI accelerators. Yet whether a single card can be powered on, or whether it can run single-card inference, is a completely different matter from whether it can support a full training pipeline.

    “Getting the training pipeline working” means completing a closed loop on a given hardware and software stack: from environment setup, data loading, model construction, the forward pass, backpropagation, gradient synchronization, and optimizer updates all the way to checkpoint saving, while maintaining numerical correctness and runtime stability across multiple machines and cards. This article uses a domestic accelerator in a two-node, 16-card environment as its scenario to show how to systematically complete this validation and run 400 steps to confirm the pipeline is usable.

    It is worth stressing that these “400 steps” are not aimed at model convergence. This is a smoke test: a short run that exposes the vast majority of pipeline-level problems and is the lowest-cost, fastest-feedback validation method in engineering practice.

    2. What Makes Up a Training Pipeline

    Before you can get the pipeline working, you first need to see the whole picture. A typical training iteration (step) consists of the following stages:

    1. Environment setup: version alignment across the driver, runtime, communication library, the deep learning framework, and its hardware backend plugin.
    2. Data pipeline: dataset reading, tokenization and packing, sharding according to the parallel strategy, and prefetching and batching.
    3. Model construction: sharding parameters according to the parallel plan, weight initialization, and random seed alignment.
    4. Forward and backward pass: operator-level computation and gradient accumulation.
    5. Gradient synchronization: gradient reduction across cards and across machines via collective communication.
    6. Optimizer update: parameter updates and loss scaling under mixed precision.
    7. Checkpoint saving: periodic persistence to guarantee recoverability.

    A problem in any single stage will cause the job to either “fail to start” or “run but produce incorrect results.” Validation must therefore be done stage by stage, rather than only checking whether the job can launch.

    3. The Core Challenges of Two Nodes and 16 Cards

    Scaling from a single card to two nodes and 16 cards concentrates the problems into two categories: alignment and communication.

    1. Operator adaptation and numerical precision
    Large model training relies on a large number of operators (matrix multiplication, attention, normalization, loss functions, and so on). If a domestic platform lacks an efficient implementation of some operator, it often has to fall back to a slower path or develop the operator itself. A more subtle problem is numerical precision inconsistency: the accumulation order and rounding of the same operator on different hardware may differ, causing deviations in the loss curve and even NaN/Inf values. Precision alignment is therefore the first hurdle in getting the pipeline working.

    2. Collective communication
    Multi-node training depends on collective communication primitives such as AllReduce, AllGather, and ReduceScatter. Cross-node communication introduces issues like network topology, bandwidth bottlenecks, and communication-computation overlap. If the communication library is not well adapted to the multi-node environment, it is very likely to result in hangs or timeouts.

    3. Parallel strategy
    Models at the hundreds-of-billions-of-parameters scale cannot fit on a single card and require combining several forms of parallelism:

    • Data parallelism (DP): shards the data and synchronizes gradients via AllReduce;
    • Tensor parallelism (TP): shards a single layer’s parameters and is more efficient under high-speed intra-node interconnect;
    • Pipeline parallelism (PP): splits layers across devices and requires handling pipeline bubbles.

    The choice of parallel strategy directly affects memory usage, communication volume, and scaling efficiency, and needs to be tuned repeatedly under the two-node, 16-card topology.

    4. Key Implementation Points

    4.1 Software Stack Alignment

    The hardware backend plugin, communication library, and framework versions must match. It is recommended to freeze the environment into a reproducible image to avoid the “works on my machine” predicament. A schematic environment-check script:

    1. # Pseudo-code: environment consistency check
    2. python -c "
    3. import runtime, backend_plugin, comm_lib
    4. assert backend_plugin.check_ops(['matmul','layernorm','softmax','cross_entropy'])
    5. print('device_count =', runtime.device_count())
    6. print('backend_version =', backend_plugin.version())
    7. "

    4.2 Mixed Precision and Loss Scaling

    To balance memory and throughput, training generally uses mixed precision (such as FP16/BF16). At lower precision, gradients may underflow, so loss scaling together with gradient clipping is needed to keep numerics stable. A schematic configuration:

    1. # Pseudo-code: parallelism and mixed-precision config
    2. parallel_config = dict(
    3. tensor_parallel_size=8, # intra-node tensor parallelism
    4. pipeline_parallel_size=2, # inter-node pipeline parallelism
    5. data_parallel_size=1,
    6. )
    7. precision = dict(dtype="bf16", loss_scale="dynamic", grad_clip=1.0)

    4.3 Parallel Topology and Communication Optimization

    Communication-intensive tensor parallelism should be kept within the high-speed intra-node interconnect domain as much as possible, while pipeline parallelism should span the slower inter-node links, so that cross-node communication volume is minimized. At the same time, enabling communication-computation overlap helps relieve the communication bottleneck.

    4.4 Data Pipeline and Reproducibility

    Fixing the random seed, ensuring consistent data sharding across all parallel ranks, and enabling data prefetching both speed up training and make the 400-step validation reproducible and comparable.

    5. How to Validate a “400-Step Run”

    Running 400 steps is only a result; what is truly valuable is the criteria for judgment. The following indicators are recommended:

    • Loss curve: should decrease smoothly or fluctuate within a stable range, with no diverging trend;
    • Gradient norm: should stay within a reasonable range, with no sustained abnormal spikes;
    • Numerical health: no NaN/Inf throughout the entire run;
    • Stable throughput: per-step time should be steady, with no periodic stalls or slowdowns;
    • Recoverability: a checkpoint saved mid-run can be successfully loaded to resume training.

    Schematic monitoring logic:

    1. # Pseudo-code: training stability monitoring
    2. for step in range(400):
    3. loss = train_step(batch)
    4. if not math.isfinite(loss):
    5. raise RuntimeError(f"non-finite loss at step {step}")
    6. grad_norm = clip_and_measure_grads()
    7. if step % 50 == 0:
    8. logger.info(step, loss, grad_norm, tokens_per_sec)
    9. save_checkpoint(step)

    When all of the above indicators behave consistently across all 16 cards, the training pipeline can be judged to be working.

    6. Engineering Best Practices and Common Pitfalls

    • Prioritize precision alignment: first use a tiny model with fixed data to establish a “gold standard” alignment, then scale up gradually.
    • Shrink the problem to reproduce it: when a hang occurs, first reproduce it with the minimum parallelism and fewest cards to narrow down the investigation.
    • Make good use of monitoring and logging: in distributed training, logs, metrics, and alerts are key to locating bottlenecks; these can be centrally managed with general cloud capabilities such as container platforms, log services, and monitoring and alerting.
    • Make checkpointing routine: before a long stability run, first verify saving and recovery to avoid “wiping everything overnight” after hours of training.
    • Pin versions: once the software and hardware versions have been validated, freeze them into a baseline; any upgrade should go through regression validation.

    7. Conclusion: From “Working” to “Working Well”

    Running 400 steps on two nodes and 16 cards means the domestic compute platform has demonstrated the feasibility of supporting large language model training. But this is only the starting point: moving from “working” to “stable,” and then to “well” (high throughput, high scaling efficiency, low cost), still requires ongoing refinement in operator optimization, communication optimization, parallel strategy, and stability. For developers and enterprises, turning the validation methodology into reusable engineering standards is the key step toward making good use of domestic compute and moving to scale.