Training Large Models on 16 Domestic AI Accelerators Across Two Nodes: A Practical Guide

    This article details the practical steps for setting up a stable multi-node large-model training pipeline using 16 domestic AI accelerator cards distributed across two nodes. It covers hardware topology planning, software environment consistency, distributed communication configuration, parallel strategy selection, memory budgeting, stability monitoring, checkpointing, and a 400-step acceptance test. The guide emphasizes reproducibility and observability, offering a structured approach to validate the entire training chain before scaling up.

    1. Background and Objectives

    Scaling large-model training from a single node to multiple nodes introduces three main challenges. First, compute capacity: a single node has a limited number of accelerator cards, so as model parameters and training data grow, the workload must be split across machines. Second, communication: gradient synchronization and parameter exchange between nodes consume significant bandwidth, and communication efficiency directly affects overall throughput. Third, stability: the more nodes involved, the higher the chance of single-point failures, network jitter, out-of-memory errors, and other anomalies, making long-running training prone to interruption.

    The goal here is clear: on domestic AI accelerator cards, build a stable multi-node training pipeline and validate it using a benchmark of two nodes, 16 cards, and 400 training steps. This benchmark does not chase extreme performance; it focuses on verifying the completeness of the pipeline: proper environment initialization, correct multi-node communication, continuous training progress, and the ability to save and restore intermediate states.

    The value of this acceptance test lies in surfacing issues. At the start of training, most problems appear in the environment and configuration. After dozens of steps, issues tend to shift toward numerical stability and communication timeouts. Only by passing through both phases can the pipeline be considered ready for real training tasks.

    2. Hardware and Network Topology Planning

    2.1 Node and Accelerator Card Allocation

    A common setup for two-node, 16-card training is 8 accelerator cards per node. Inside each node, cards communicate via high-speed interconnects; between nodes, communication goes over a high-speed network. The bandwidth difference between these two layers is significant, and the parallel strategy must account for it.

    Before planning, confirm the following:

    • Number and model of accelerator cards per node; ensure driver and runtime versions match.
    • Intra-node card interconnect topology; identify which cards have the fastest connections.
    • Inter-node network bandwidth and latency; verify whether a non-blocking or near-non-blocking network configuration is enabled.
    • Memory size per card, which will be used for memory budget calculations.

    2.2 IP and Port Planning

    Multi-node training requires all nodes to reach each other. Assign fixed internal IP addresses to each machine and reserve a dedicated port for inter-process initialization handshake. Port planning should be documented to avoid conflicts with existing services. Firewall rules must also allow these ports; otherwise, a common symptom is processes stuck at initialization with no obvious error in the logs.

    2.3 Clock Synchronization

    Multi-node training is time-sensitive. Excessive clock skew between nodes can affect log ordering, timeout judgments, and some distributed protocols. All nodes should connect to a unified time synchronization service, and the skew should be checked before startup.

    3. Consistency of the Software Environment

    The most common hidden risk in multi-node training is environment inconsistency. If driver versions, runtime versions, or dependency library versions differ between two machines, it can lead to errors that are hard to locate in certain operators or communication operations.

    3.1 Environment Checklist

    Generate an environment checklist for each node, including:

    1. Operating system and kernel version.
    2. Accelerator card driver version and runtime version.
    3. Deep learning framework and its compilation options.
    4. Communication library version and configuration parameters.
    5. Python version and locked versions of key dependencies.
    6. Training code commit hash or version tag.

    The checklist can be collected automatically via a script and compared before training starts. If discrepancies exist, unify the environment before launching the task.

    3.2 Containerization and Image Management

    Using containerized environments significantly reduces the risk of environment drift. Images should be tagged by version and record the dependency list used during build. Each training task should specify the exact image tag rather than pulling the latest by default.

    3.3 Environment Self-Check Script

    Below is a sample workflow for environment self-check. Replace the detection commands with those provided by your platform.

    1. #!/bin/bash
    2. # Sample: run on each node, collect key version info
    3. echo "hostname: $(hostname)"
    4. echo "kernel: $(uname -r)"
    5. echo "driver: $(get_accel_driver_version)" # replace with platform query command
    6. echo "python: $(python3 --version)"
    7. echo "deps:"
    8. python3 -m pip freeze | sort

    Aggregate the outputs from all nodes and run a diff. Any inconsistency should be resolved first.

    4. Multi-Node Communication and Startup Configuration

    4.1 Basic Flow of Communication Initialization

    Multi-node training typically follows this sequence:

    1. Identify the primary node, which coordinates initialization.
    2. Assign each process a globally unique rank.
    3. Processes exchange address information via the primary node and build a communication group.
    4. Once the group is established, enter the training loop.

    Every step can fail. When troubleshooting, confirm each step in order rather than jumping directly to modifying training parameters.

    4.2 Key Environment Variables

    Most distributed training frameworks pass initialization information through environment variables. Common variables include the primary node address, primary port, total number of processes, and current process rank. The following is a sample configuration, using conventional variable names:

    1. # Node 0 (primary)
    2. export MASTER_ADDR=10.0.0.1
    3. export MASTER_PORT=29500
    4. export WORLD_SIZE=16
    5. export NODE_RANK=0
    6. export LOCAL_WORLD_SIZE=8
    7. # Node 1
    8. export MASTER_ADDR=10.0.0.1
    9. export MASTER_PORT=29500
    10. export WORLD_SIZE=16
    11. export NODE_RANK=1
    12. export LOCAL_WORLD_SIZE=8

    MASTER_ADDR and MASTER_PORT must match on both nodes, WORLD_SIZE must be 16 (total number of cards), and NODE_RANK must differ. Any error in these settings will prevent processes from forming a complete communication group.

    4.3 Unified Startup Method

    Use a unified startup script that reads the node rank and builds the launch parameters, avoiding manually entering commands on both machines. A single entry point reduces typographical errors and simplifies log archiving.

    4.4 Communication Timeout and Retry

    Set reasonable timeout values during initialization. A timeout that is too short will falsely fail when the network is slightly slow; one that is too long delays fault detection. A common approach is to use a relaxed timeout for the first validation, then tighten it once communication is confirmed.

    5. Parallel Strategy and Memory Budget

    5.1 Selecting Parallel Methods

    With 16 cards, several parallel methods can be combined:

    • Data parallelism: each group holds a full model replica, processes different data batches, and synchronizes gradients.
    • Tensor parallelism: split the weights of a single layer across multiple cards; suits high intra-node bandwidth.
    • Pipeline parallelism: split the model by layers into stages, distributed across cards; suits cross-node deployment.
    • Optimizer state sharding: distribute optimizer states across cards to reduce per-card memory.

    For a two-node scenario, a common approach is tensor parallelism within a node and data or pipeline parallelism between nodes. This keeps high-frequency, large-volume communication inside the higher-bandwidth node.

    5.2 Memory Budget

    The memory budget determines the upper limits for batch size and sequence length. At least four components must be estimated:

    • Model parameters.
    • Gradients.
    • Optimizer states.
    • Activations, which scale with batch size and sequence length.

    The goal is to leave a safety margin. In practice, memory fragmentation and temporary buffers also consume space, so reserve a portion of remaining memory and avoid pushing utilization to the limit.

    5.3 Verifying the Parallel Configuration

    Before full training, run a small-scale validation: only a few forward and backward steps to confirm the shapes after parallel splitting, verify gradients propagate correctly, and check that peak memory is within budget. Passing this validation saves significant debugging time later.

    6. Training Stability: Monitoring, Logging, and Checkpoints

    6.1 Metric Monitoring

    During training, continuously record the following:

    • Loss value per step; watch for abnormal jumps or continuous divergence.
    • Time per step; distinguish compute time from communication time.
    • Memory usage and utilization per card.
    • Gradient norm, to detect exploding or vanishing gradients.
    • Node network send/receive rates and error counts.

    These metrics should be fed into a unified monitoring and alerting system with thresholds, so anomalies trigger automatic notifications. Relying solely on manual log review is insufficient.

    6.2 Logging Standards

    Logs should include timestamps, node IDs, process IDs, and training step numbers. In multi-node scenarios, inconsistent log formats make it hard to align records across machines. All processes should write logs in a unified format, and logs should be centrally collected.

    6.3 Checkpoint Strategy

    Long training runs must save checkpoints regularly. A checkpoint should include at least model parameters, optimizer states, learning rate scheduler states, random seeds, and the current training step. Save frequency must balance storage overhead against the risk of loss.

    Checkpoints need to be verified periodically. Verification means restoring from a checkpoint and confirming that the loss curve continues smoothly. A checkpoint that is saved but never verified may be unusable when actually needed.

    6.4 Failure Recovery Flow

    Design the following recovery flow for training tasks:

    1. Detect abnormal process exit or node disconnection.
    2. Stop remaining processes and release resources.
    3. Verify the integrity of the most recent complete checkpoint.
    4. Restart all processes from that checkpoint.
    5. Record the fault time, cause, and recovery duration.

    The recovery flow should be rehearsed in a test environment to ensure every step works correctly.

    7. Acceptance Criteria for the 400-Step Test

    The 400-step run is the benchmark for this pipeline validation. Reaching this benchmark indicates that the pipeline can run continuously on two nodes with 16 cards for a meaningful period. Evaluate the following dimensions:

    • Completeness: training proceeds continuously from step 1 to step 400 without interruption due to communication or memory issues.
    • Numerical stability: the loss generally decreases or stays within a reasonable range, with no persistent NaN or unbounded growth.
    • Resource stability: per-card memory usage is steady, with no continuous growth over steps.
    • Recoverability: at least one checkpoint can be loaded correctly and training resumes from it.
    • Traceability: logs are complete and allow reconstructing the key state of every step.

    A pass requires all five dimensions to be satisfied. If any dimension fails, identify the root cause before deciding whether to scale up.

    8. Common Troubleshooting

    8.1 Stuck During Initialization

    Symptoms: processes start but produce no output for a long time. Common causes include an incorrectly configured primary node address, a port that is occupied or blocked by a firewall, or inconsistent environment variables between nodes. The troubleshooting order is: use basic network tools to verify node connectivity, then check the port, and finally compare environment variables.

    8.2 Communication Timeouts

    Timeouts can stem from network jitter, high load on one node, or a card that is significantly slower than others. First check network error counters on each node, then check for slow nodes. If one node slows down the entire run, inspect the hardware state of that node.

    8.3 Loss Becomes NaN

    NaN loss is often related to a too-high learning rate, outliers in the data, or insufficient numerical range under mixed precision. Review the gradient norms from recent steps to see if there is unusual amplification; also check the input data distribution. Once identified, lower the learning rate, add gradient clipping, or adjust data cleaning rules.

    8.4 Continuous Memory Growth

    Memory increasing over steps usually indicates a tensor is not being released somewhere, such as accumulating computation graphs or log objects inside a loop. Record memory usage step by step to identify the step where growth begins, then correlate with the code.

    9. Summary

    Completing two-node, 16-card training on domestic AI accelerator cards is less about any single parameter and more about end-to-end consistency and observability. Unified environments, controllable communication initialization, parallel strategies that match hardware topology, and complete monitoring plus checkpoints are the four pillars that determine whether training runs stably to completion. The 400-step acceptance test covers the critical phases—initialization, communication, computation, saving, and recovery—while giving the team a reusable checklist.

    When scaling up later, keep the same acceptance approach: validate the pipeline at a small scale first, then incrementally add nodes, using the same set of criteria to judge readiness at each stage.