Full-Pipeline LLM Training on 16 Accelerator Cards Across Two Servers: A 400-Step Stability Walkthrough

    This practical walkthrough shows how to run a complete large language model training workflow on two servers with 16 accelerator cards in total, covering launch, running, checkpoint saving, and recovery across the full 400 steps. It explains how to plan hardware topology, keep software environments consistent, configure parallelism, verify multi-node communication, shard data, build fault-tolerant checkpoints, monitor training stability, and troubleshoot common hangs and anomalies. The steps are written so that teams with similar setups can reproduce them.

    Background and Goals

    Large model training has moved from single-machine experiments to multi-machine, multi-card production workloads. A single machine often cannot hold the growing parameter counts and data volumes that training requires, so multi-node collaboration has become a standard choice. The difficulty of multi-node training goes beyond adding up compute. Differences between nodes in environment, communication topology, data loading, and checkpoint consistency can each cause a training job to hang midway or produce distorted results.

    The goal of this practice was clear: on two servers with 16 accelerator cards in total, make the full training pipeline work end to end, covering launch, running, saving, and recovery, and run stably for 400 steps. This article does not use a single performance figure as its conclusion. Instead, it breaks the validation process into reproducible engineering steps for teams with similar needs. The article does not provide absolute values for throughput or memory usage. Readers should measure these on their own hardware and with their own model configuration.

    1. Hardware Topology and Resource Planning

    The first step in multi-node training is defining the resource topology. The 16 cards are spread across two machines. The number of cards per machine, the interconnect between cards, and the network bandwidth between machines together determine the upper limit of the parallelism strategy.

    Before you start, confirm the following three items:

    • Consistent card count: Both machines should have the same number and model of accelerator cards. If they differ, overall training speed is limited by the slowest node.
    • Intra-node interconnect: Cards within the same machine connect through a high-speed bus. Communication latency is lowest here, so this is the right place for tensor parallelism, which communicates most frequently.
    • Inter-node network: Cross-machine bandwidth is much lower than intra-machine bandwidth. Reduce high-frequency synchronization across machines, and limit cross-machine communication to gradient synchronization for data parallelism.

    Assuming each machine has 8 accelerator cards, the 16 cards split into two nodes. The planning table below records the resource allocation so you can check it quickly when troubleshooting.

    Item Node A Node B
    Accelerator cards 8 8
    Node IP Assigned per the actual network plan Assigned per the actual network plan
    Role Primary node (coordination) Worker node

    2. Software Environment Consistency

    The problem most often overlooked in multi-node training is environment inconsistency. If the driver version, runtime library version, deep learning framework version, or dependency package version differs on even one node, the launch may succeed while the job fails later during collective communication or operator calls.

    The common engineering approach has three parts:

    1. Deploy all nodes from the same image or the same environment configuration file.
    2. Before launch, run a version-check script on each node. The script prints the driver, runtime, framework, and key dependency versions, then compares them with a baseline.
    3. Fix the random seed and numerical precision settings so that default configuration differences between nodes do not produce incomparable results.

    The following is an example version-check script. Replace the checks with those for your own environment.

    1. import sys
    2. import importlib.metadata as md
    3. # Example: collect key dependency versions on this node for cross-node comparison
    4. REQUIRED = {"numpy": "1.26.4", "pyyaml": "6.0.1"} # Example values, fill in for your environment
    5. def check_versions():
    6. mismatches = []
    7. for pkg, expected in REQUIRED.items():
    8. try:
    9. actual = md.version(pkg)
    10. except md.PackageNotFoundError:
    11. actual = "not installed"
    12. if actual != expected:
    13. mismatches.append((pkg, expected, actual))
    14. return mismatches
    15. if __name__ == "__main__":
    16. bad = check_versions()
    17. if bad:
    18. for pkg, exp, act in bad:
    19. print(f"Version mismatch: {pkg} expected {exp}, actual {act}")
    20. sys.exit(1)
    21. print("Version check passed")

    Run the script once on every node. If any node fails, abort the launch so that training does not start with a broken environment.

    3. Parallelism Strategy and Calculation

    The total parallelism of the 16 cards must be split across three dimensions: data parallelism, tensor parallelism, and pipeline parallelism. The product of the three must equal the total number of cards. This is a hard constraint on the parallel configuration.

    • Tensor parallelism: Splits the weight matrices within a single layer across multiple cards. It communicates frequently, so keep it inside one machine.
    • Pipeline parallelism: Splits the model layer by layer into stages. Stages pass activations to each other, and the communication volume is relatively small, so stages can be deployed across nodes.
    • Data parallelism: Each replica processes a different data batch, and gradients are synchronized at the end of each step. This is the main way to scale throughput.

    A common split is tensor parallelism of 2, pipeline parallelism of 2, and data parallelism of 4, so 2 × 2 × 4 = 16. This split keeps tensor-parallel communication within each node. Cross-node traffic mainly comes from passing data between pipeline stages and from gradient synchronization in data parallelism.

    The final choice also depends on memory constraints. Low parallelism can leave a single card short of memory. High parallelism increases the share of time spent on communication and lowers training efficiency. A sound approach is to first validate memory use and speed with a small configuration, then scale up to the target size step by step.

    4. Multi-Node Communication Setup

    The communication configuration determines whether multiple nodes can actually work together. Common problems include nodes that cannot discover each other, firewalls blocking ports, and incorrect network interface selection that sends traffic over a slow management network.

    To troubleshoot communication problems, follow this order:

    1. Confirm that each node can resolve and reach the other nodes by hostname and IP address.
    2. Explicitly specify the network interface used for training communication, so that the system does not select the management interface automatically.
    3. Before the formal run, execute a collective communication connectivity test to confirm that all cards can complete one global synchronization.
    4. Check firewall rules and allow the port range used by the training processes.

    The purpose of the communication test is not to measure speed. It confirms that the topology is complete and that no card is missing. If the global synchronization completes, all 16 cards have joined the same communication group.

    5. Launch and Parameter Design

    A multi-node launch depends on giving each process its global index, its node, and the size of the communication group. The example configuration below shows how these parameters can be organized. Confirm the exact field names against the documentation for the framework you use.

    1. # Example config: 16 cards, 2 nodes, 400 training steps
    2. train_config = {
    3. "num_nodes": 2,
    4. "devices_per_node": 8,
    5. "world_size": 16, # Must equal num_nodes * devices_per_node
    6. "tensor_parallel_size": 2,
    7. "pipeline_parallel_size": 2,
    8. "data_parallel_size": 4, # 2 * 2 * 4 = 16
    9. "global_batch_size": 256, # Example value
    10. "micro_batch_size": 4, # Example value
    11. "max_steps": 400,
    12. "checkpoint_interval": 50, # Save a checkpoint every 50 steps
    13. "log_interval": 10,
    14. }
    15. def validate(cfg):
    16. total = cfg["tensor_parallel_size"] * cfg["pipeline_parallel_size"] * cfg["data_parallel_size"]
    17. assert total == cfg["world_size"], f"Parallelism product {total} does not match total cards {cfg['world_size']}"
    18. assert cfg["num_nodes"] * cfg["devices_per_node"] == cfg["world_size"], "Cards per node do not match total cards"
    19. # Global batch size must be divisible by data_parallel_size * micro_batch_size
    20. assert cfg["global_batch_size"] % (cfg["data_parallel_size"] * cfg["micro_batch_size"]) == 0, \
    21. "global_batch_size must be divisible by data_parallel_size * micro_batch_size"
    22. return True
    23. validate(train_config)

    Checking parameters before launch catches most basic errors. The assertions above cover three common problems: the parallelism product, the cards per node, and batch size divisibility.

    6. Data Loading and Consistency

    In multi-node training, each data-parallel replica should read a non-overlapping shard of the data. Otherwise, the same samples are trained more than once, which distorts convergence judgments. A common approach is to shard the dataset by data-parallel rank and shuffle with a shared random seed at the start of each epoch.

    The data pipeline also needs attention in a few areas:

    • Store data on shared storage, or at a path that is identical on every node, so that no node reads an outdated version.
    • Run preprocessing offline where possible to reduce CPU load during training.
    • Use prefetching in the data loader so that accelerator cards do not wait for data.

    The sharding logic can be expressed as follows:

    1. def get_shard_indices(total_samples, dp_rank, dp_size, seed, epoch):
    2. # Example: shard by data-parallel rank so that replicas receive non-overlapping samples
    3. import random
    4. indices = list(range(total_samples))
    5. random.Random(seed + epoch).shuffle(indices) # All nodes use the same seed to shuffle
    6. return indices[dp_rank::dp_size]

    7. Checkpointing and Fault Tolerance

    A 400-step run is long enough to encounter interruptions such as node restarts, network fluctuations, or resource preemption. A checkpoint strategy is therefore a required part of the training pipeline.

    A checkpoint must contain all of the following:

    • Model parameters, saved per parallel shard
    • Optimizer state
    • Learning rate scheduler state
    • Current step count and data read position
    • Random number generator state

    When saving, write to a temporary directory first. After all files are written and verified, rename the directory to its final name. This prevents a write interruption from leaving a corrupted checkpoint. When restoring, check whether the parallel configuration of the checkpoint matches the current configuration. A checkpoint saved with a different configuration cannot be loaded directly. You must reshard it first.

    In this practice, a checkpoint was saved every 50 steps. This interval balances save overhead against the cost of an interruption. Shorter intervals use storage and bandwidth too often. Longer intervals lose too much training progress when a failure occurs.

    8. Runtime Stability Monitoring

    Once training is running, the goal of monitoring is to detect anomalies early. At a minimum, track these metrics:

    • Loss trend: If the loss jumps suddenly or keeps diverging, pause the run and investigate the data and learning rate.
    • Gradient norm: An abnormal increase often signals numerical instability.
    • Step time on each node: If one node is clearly slower, the cause is often hardware throttling, network congestion, or a data loading bottleneck.
    • Accelerator utilization and memory usage: Low utilization for long periods means cards are waiting. Memory close to the limit calls for checking for fragmentation or leaks.

    Send monitoring data to a centralized monitoring and alerting system, and set threshold alerts so that you do not need to watch dashboards manually.

    9. Common Problems and Troubleshooting

    Multi-node training problems often show up as a hang rather than an error. Troubleshoot in the following order:

    1. Hang during launch: Usually caused by failed communication initialization. Check the primary node address, ports, and firewall.
    2. Hang midway through training: A common cause is that a process on one node has exited, while the other nodes wait for it at a synchronization point. Check the process status and logs on each node.
    3. Abnormal loss: First check whether data is duplicated or misaligned. Then check the learning rate and precision settings.
    4. Speed well below expectations: Check whether traffic is using a slow network path, whether data loading is the bottleneck, and whether the parallel split causes too much cross-node communication.

    Keep the complete logs and a configuration snapshot for every run. These records make it easier to compare runs and find the source of a difference.

    10. Summary and Recommendations

    The training pipeline ran stably for 400 steps on two servers with 16 accelerator cards. The result depended on careful attention to engineering details more than on any single technical breakthrough. Four areas form the foundation of multi-node training: environment consistency, correct parallelism configuration, complete communication topology verification, and recoverable checkpoints.

    Teams planning similar work can proceed in this order:

    1. Run the full workflow on a single machine at small scale first, including saving and restoring.
    2. Expand to two machines, and verify communication connectivity and version consistency first.
    3. Run the target configuration for the full number of steps, and record the logs and metrics for the entire run.

    Keep a reproducible record of every step. When training results drift from expectations, clear records help you locate the problem faster than experience alone.