End-to-End LLM Training Across 16 Chinese-Made AI Accelerator Cards on Two Servers

    This article describes how to validate a complete large language model training pipeline across two servers, each with eight AI accelerator cards for 16 cards in total, over 400 training steps. It covers environment consistency checks, multi-node communication setup, parallelism and memory planning, checkpoint handling, training monitoring, and common troubleshooting steps. It also proposes a four-part acceptance framework for judging whether a run is complete and reproducible.

    1. Background and Problem Definition

    Large language model training places simultaneous and sustained demands on compute, memory, communication, and storage. As parameter counts grow, single-machine training quickly runs into memory limits, so multi-node, multi-GPU training has become standard practice. A multi-node setup combines compute nodes, a high-speed interconnect, and shared storage into one system. A fault in any of these components can cause training to fail midway or quietly reduce efficiency.

    The software and hardware ecosystem for Chinese-made accelerator cards has matured in recent years. However, getting a workload to run and getting it to finish reliably are different goals. In practice, teams often encounter the following problems:

    • Driver, runtime, and communication library versions differ across nodes, causing initialization failures or unpredictable behavior.
    • Network bandwidth or latency falls short of requirements, so collective communication becomes the bottleneck and throughput falls well below the theoretical value.
    • Training stops after several hours because of an individual card fault, a hung process, or a storage write failure.
    • Improper numerical precision settings lead to gradient overflow or a loss value of NaN.

    For this reason, validating a training pipeline should not focus only on whether the program starts. A more reliable approach is to split the pipeline into checkable stages, verify each one, and then run an end-to-end validation.

    2. Target Scenario and Acceptance Criteria

    The target scenario in this article uses two servers with eight accelerator cards each. All 16 cards take part in a single training job that runs for 400 steps. The 400-step milestone is long enough to cover the full cycle of data loading, forward computation, backward propagation, gradient synchronization, optimizer updates, learning rate scheduling, and periodic checkpoint saving. It is also short enough to avoid tying up cluster resources for an extended period.

    Acceptance criteria should be defined across the following four dimensions:

    1. Pipeline integrity: Every step completes data reading, forward pass, backward pass, gradient aggregation, and parameter updates, with no skipped steps and no silent failures.
    2. Numerical health: Loss shows an overall downward trend, gradient norms stay within a reasonable range, and no NaN or Inf values appear during the run.
    3. Runtime stability: Load is balanced across cards, no process exits abnormally, and no restarts are caused by communication timeouts.
    4. Recoverability: A checkpoint saved mid-run loads correctly, and training resumed from the interruption point produces a continuous loss curve.

    These criteria are more specific than “the 400 steps finished,” which makes the results easier to reproduce and compare.

    3. Overall Architecture and Layering

    A multi-node training pipeline can be divided into five layers:

    Layer Main Responsibilities Key Concerns
    Hardware Compute cards, host memory, intra-node interconnect Card health, temperature, power draw
    Network Inter-node high-speed interconnect and collective communication Bandwidth, latency, NIC binding
    Storage Training data, checkpoints, logs Read/write throughput, consistency across nodes
    Scheduling and runtime Process launch, rank assignment, parallelism strategy Startup order, consistent environment variables
    Application Model architecture, optimizer, training loop Numerical precision, gradient handling, monitoring metrics

    Layering helps locate problems. When training fails, you can first determine which layer the fault belongs to, then investigate that layer directly. This avoids repeated trial and error between application code and low-level drivers.

    4. Environment Consistency Checks

    Environment inconsistency is one of the most common risks in multi-node training. If two machines differ in driver or dependency versions, even for the same job, the result can be errors that are hard to explain. Run a unified check procedure before launching the job.

    The check should cover the following items:

    • Accelerator driver version and runtime version match across nodes.
    • Collective communication library version and build options match across nodes.
    • The Python environment and dependency package versions are pinned.
    • The number and numbering of visible cards on each machine match expectations.

    The following is an illustrative validation script. The function names are for demonstration only and should be replaced with the detection interfaces available in your environment:

    1. REQUIRED_ENV = {
    2. "driver_version": "matches cluster baseline",
    3. "runtime_version": "matches cluster baseline",
    4. "comm_lib_version": "matches cluster baseline",
    5. "visible_devices": 8,
    6. }
    7. def check_node(node):
    8. info = collect_node_info(node) # collect node environment information
    9. mismatches = []
    10. for key, expected in REQUIRED_ENV.items():
    11. actual = info.get(key)
    12. if actual != expected:
    13. mismatches.append((key, expected, actual))
    14. return mismatches
    15. def precheck_cluster(nodes):
    16. report = {}
    17. for node in nodes:
    18. report[node] = check_node(node)
    19. failed = {n: m for n, m in report.items() if m}
    20. if failed:
    21. raise RuntimeError(f"Environment check failed: {failed}")
    22. return True

    Run this check automatically as the first step of the launch procedure. If any item fails, the job should not enter the training stage. This surfaces problems early, so a version mismatch does not go unnoticed until the job has been running for several hours.

    5. Multi-Node Communication Configuration

    Multi-node training depends on collective communication between nodes to synchronize gradients. The communication configuration involves three main elements: how process groups are organized, how network interfaces are bound, and how timeouts are set.

    5.1 Process Groups and Rank Planning

    Two machines provide 16 cards, and each card runs one process, so the global world size is 16. Each process needs a globally unique rank, and it must know its local rank within its node. The recommended assignment is: node 0 uses ranks 0 to 7, node 1 uses ranks 8 to 15, and each local rank maps one-to-one to a physical card number.

    5.2 Network Interface Binding

    On a multi-node system, a host often has both a management network and a high-speed data network. If the communication library does not explicitly specify which NIC to use, it may route traffic over a slower network, which can greatly reduce throughput. Set the data network interface explicitly in the configuration, and use the same naming convention on both machines.

    5.3 Communication Timeouts and Retries

    During long training runs, an individual node may respond slowly because of a brief network disturbance. A timeout that is too short causes false failure detection, while one that is too long delays the discovery of real faults. A practical compromise is to set separate timeouts for the initialization phase and the training phase, and to log the context of every timeout.

    An example configuration:

    1. dist_config = {
    2. "world_size": 16,
    3. "nodes": ["node-0", "node-1"],
    4. "gpus_per_node": 8,
    5. "master_addr": "node-0",
    6. "master_port": 29500,
    7. "data_interface": "ib0", # set according to the actual data NIC name
    8. "init_timeout_sec": 1800,
    9. "step_timeout_sec": 600,
    10. }

    After the configuration is in place, run a communication-only test before training. For example, perform global reductions on tensors of different sizes and measure latency and bandwidth. Only proceed to model training once the communication metrics meet expectations.

    6. Parallelism Strategy and Memory Planning

    In a 16-card setup, common parallelism methods include data parallelism, tensor parallelism, and pipeline parallelism. The product of the three degrees must equal the total card count: tp × pp × dp = 16.

    One workable combination is:

    • Tensor parallelism tp = 2, which splits the matrix operations within a layer across two cards.
    • Pipeline parallelism pp = 2, which splits the model layers into two stages by depth.
    • Data parallelism dp = 4, where each data replica processes a different set of samples independently.

    When choosing a parallelism strategy, estimate memory usage first. With mixed-precision training, each parameter needs roughly 16 bytes of memory. This covers the half-precision parameter, its gradient, and optimizer states such as the fp32 master weight, momentum, and variance. Memory pressure grows as the parameter count increases. The estimate can be written as:

    Memory usage ≈ parameter count × 16 bytes / (tp × pp) + activation memory

    Activation memory depends on sequence length, batch size, and whether activation recomputation is enabled. The purpose of the estimate is to leave a safety margin. A reserve of at least 20% of GPU memory is generally recommended to avoid out-of-memory errors caused by peak fluctuations.

    7. Data Management and Checkpoint Strategy

    7.1 Data Sharding and Reproducibility

    In multi-node training, each rank should read a non-overlapping data shard. The sharding logic should be computed from the rank and world size, and it should use a fixed random seed. This ensures that after an interruption, reading can resume from the same position. If the data loading logic is not reproducible, the loss curve will jump after recovery, which makes it hard to tell whether the problem comes from the model or the data.

    7.2 Checkpoint Saving

    A checkpoint should contain the model parameters, optimizer state, learning rate scheduler state, random number generator state, and the current step count. When saving checkpoints, keep the following in mind:

    1. Write to a temporary file first, then rename it atomically. This prevents a corrupted file from being left behind if the process is interrupted during the write.
    2. Keep only the most recent few checkpoints so that shared storage does not fill up.
    3. Record a checksum when saving, and verify integrity before restoring.
    4. Include a snapshot of the training configuration in the checkpoint directory for traceability.

    Consider step 200 as an example. If a checkpoint is saved every 50 steps, a 400-step run produces 8 checkpoints. Running a restore test on one of these checkpoints, by loading it and then training for 10 more steps, can confirm that the recovery logic works correctly.

    8. Monitoring the 400-Step Training Run

    Once training starts, monitoring aims to detect anomalies as early as possible. Track at least the following metrics:

    • Loss and gradient norm: Watch the downward trend. A sudden rise in gradient norm often signals numerical instability.
    • Throughput: Measured in tokens processed per second. Investigate when fluctuations exceed a set range.
    • Memory usage: Record the peak on each card to see whether it is approaching the limit.
    • Communication time: Measure the share of each step spent in collective communication. If this share keeps rising, communication may be becoming the bottleneck.
    • Card status: Temperature, power draw, and error counts, used to catch early failures in individual cards.

    Alert rules can be defined as follows:

    1. def check_step_health(metrics, prev_loss):
    2. alerts = []
    3. if metrics["loss"] != metrics["loss"]: # NaN check
    4. alerts.append("Loss is NaN. Stop training immediately.")
    5. if prev_loss is not None and metrics["loss"] > prev_loss * 1.5:
    6. alerts.append("Loss rose sharply in a short period. Check the learning rate and data batches.")
    7. if metrics["step_time"] > metrics["baseline_step_time"] * 1.3:
    8. alerts.append("Step time exceeds baseline. Check communication and storage.")
    9. if metrics["max_mem_ratio"] > 0.95:
    10. alerts.append("Memory usage is close to the limit. Consider reducing batch size or enabling recomputation.")
    11. return alerts

    Alert thresholds should be based on baseline data rather than set by intuition. Record the normal range in a small-scale trial run first, then adjust the thresholds accordingly. This noticeably reduces false alarms.

    9. Common Problems and Troubleshooting

    Symptom Possible Cause Where to Look
    Some processes hang during initialization Nodes cannot reach each other, or the address or port is misconfigured Check master node address, port connectivity, and firewall settings
    Throughput is far below expectations A low-speed NIC is in use, or the parallel partitioning is unreasonable Verify NIC binding and re-measure communication bandwidth
    Communication timeout during training Abnormal load on a node, or network jitter Review logs and card status on the affected node, and confirm whether any process is hung
    Loss suddenly becomes NaN Learning rate too high, gradient overflow, or abnormal data Roll back to the latest checkpoint, lower the learning rate, and inspect anomalous samples
    Loss curve breaks after resuming Random state or data position was not restored correctly Compare data indices and random seeds before and after recovery
    Out-of-memory error Batch size too large, or activations not recomputed Reduce batch size, enable recomputation, and recheck the memory estimate

    When troubleshooting, follow the sequence of reproduce first, locate second, fix last. Change only one variable at a time and record the result so that multiple changes do not mask each other.

    10. Summary and Next Steps

    Based on the 400-step validation run across two servers and 16 cards, the following lessons stand out:

    • Splitting the pipeline into checkable stages and validating each one is more efficient than launching the full training job directly.
    • Environment consistency should be verified by script, not by manual comparison.
    • Communication performance should be measured separately before training, because it sets the ceiling for multi-node efficiency.
    • Checkpoint recoverability must be tested in practice. Otherwise, a checkpoint is only a file, not a safeguard.
    • Monitoring thresholds should be based on baseline data and adjusted continuously as the training scale grows.

    Future work can build on this by expanding the number of nodes, validating longer training runs, and incorporating the consistency checks, monitoring, and recovery tests into an automated pipeline. The configurations, metrics, and issue records produced by each validation round should be stored as team knowledge assets so the next training run can reuse them directly.