How to Validate a Two-Node, 16-Card Training Pipeline on Domestic AI Accelerators

    A practical, hands-on guide to bringing up a distributed training pipeline across two nodes with 16 domestic AI accelerators. Rather than treating "it launched" as success, this article frames the work as an engineering health check around a 400-step acceptance test, and walks through the environment and version matrix, operator compatibility with graceful fallback, parallelism strategy and launch configuration, communication tuning, mixed-precision training, a 400-step acceptance checklist, checkpointing and fault tolerance on cloud infrastructure, and a quick-reference table for common failures. Teams get concrete configuration examples, checklists, and fault-isolation methods they can apply directly.

    How to Validate a Two-Node, 16-Card Training Pipeline on Domestic AI Accelerators

    How do you actually get distributed training running on domestic AI accelerators? How should you verify a two-node, 16-card training pipeline before scaling up? When training large models, 400 steps is not the target output of the model — it is an engineering health check of the training pipeline itself: whether the environment, operators, communication, mixed precision, fault tolerance, and monitoring are all usable at the same time.

    This article walks through a two-node, 16-card training pipeline on domestic AI accelerators and provides actionable configuration examples, checklists, and fault-isolation methods.

    1. Define “Working” First: The 400-Step Acceptance Goal

    Running a large model on domestic AI accelerators is not about whether the command exits with a success code. “Working,” at minimum, has to satisfy the following conditions:

    • Environment starts up: drivers, operator libraries, communication libraries, the framework, and the scheduler all load correctly.
    • Forward and backward pass execute: every layer can complete its computation and gradients can propagate back.
    • Parameters update: after the optimizer updates the weights, the loss shows a reasonable change.
    • The pipeline is repeatable: repeated launches do not produce random crashes, random timeouts, or numerical divergence.
    • Observability is in place: you can log loss, memory usage, throughput, communication time, and slow-node information.

    The core value of the 400-step validation is to expose problems such as out-of-memory (OOM), communication timeouts, missing operators, numerical divergence, slow nodes, and corrupted checkpoints at a low cost.

    2. Environment and Version Matrix: Rule Out Low-Level Compatibility First

    The first hurdle for a domestic AI accelerator training pipeline is not the algorithm — it is version consistency. Before launching training, it is recommended to build a version matrix like the one below and write the information into your experiment records.

    Component Key checks Sample check command Common problems
    OS Kernel, distribution, driver compatibility uname -a Driver does not match kernel
    Accelerator driver/firmware Whether the version matches the operator library Vendor device tool, e.g. vendor-smi Device not recognized
    Device visibility Whether all 8 cards are visible Vendor device-manager list-style command Only some cards detected
    Operator/math library Whether the version covers the target operators Vendor tool or framework check interface Missing operators or precision anomalies
    Communication library Inter-node communication, NIC detection, timeout settings Communication library version print command Communication timeout or hang
    Deep learning framework Whether it supports the target accelerator python -c "import torch; print(torch.__version__)" Framework falls back to CPU
    Container runtime Networking, device mounting, shared storage docker run --gpus all or the container platform equivalent Devices not visible inside the container

    Sample initialization commands (replace the concrete commands with the corresponding tools from your domestic accelerator vendor):

    1. # Check device count and status
    2. vendor-smi
    3. vendor-devinfo --count
    4. # Check framework and device availability
    5. python -c "import torch; print(torch.__version__); print(torch.cuda.is_available())"
    6. # Check distributed communication initialization status
    7. python -c "import torch.distributed as d; print(d.is_initialized())"
    8. # Set the communication NIC to avoid container multi-NIC communication timeouts
    9. export COLLECTIVE_SOCKET_IFNAME=eth0
    10. export COLLECTIVE_TIMEOUT=600

    If the pipeline fails to start, check these first: whether the device count is 8, whether the framework recognizes the accelerator, whether the communication library has selected the correct NIC, whether the container mounts the /dev devices, and whether the cross-node ports are reachable.

    3. Hardware Adaptation and Operator Compatibility: Probe, Fall Back, Locate

    On domestic AI accelerators, operator compatibility is usually the problem most likely to block the pipeline. A training framework depends on a large number of operators: matrix multiplication, normalization, attention, convolution, optimizer state updates, and so on. Some operators may not yet be natively supported, so it is recommended to adopt a “capability probe + graceful fallback” mechanism.

    1. def dispatch_op(op_name, *args):
    2. if backend.has_native_op(op_name):
    3. return backend.native_op(op_name, *args)
    4. return fallback_compose(op_name, *args)

    The fallback mechanism ensures training can start, but you also need to log it — otherwise performance problems will be hidden.

    Sample operator probe and fallback failure logs:

    1. [op_probe] op=layer_norm backend=vendor_native status=ok latency=0.82ms
    2. [op_fallback] op=custom_attention reason=not_implemented path=compose
    3. [op_fallback_warning] op=rotary_embedding fallback_count=17 latency_ratio=1.45
    4. [op_timeout] op=all_gather rank=7 timeout=10s retry=1

    How to locate the issue:

    • Missing operators: look for not_implemented. Prioritize pushing the vendor library to fill the gap, or use a composed implementation inside the framework.
    • Timeout operators: check the communication library, NIC, container network, timeout threshold, and retry policy.
    • Fallback performance loss: watch latency_ratio and fallback_count. If several hot-path operators fall back frequently, training throughput will drop noticeably.
    • Numerically abnormal operators: for layers that produce NaN, Inf, or zero gradients, reproduce them at the single-operator level and compare against CPU or a backup device.

    The guiding principle: secure correctness first, then replace the fallback operators. Get the 400 steps to run stably before doing performance optimization.

    4. Two-Node, 16-Card Parallelism Strategy: Configuration and Environment Variables

    Two nodes with 16 cards usually means 8 cards per machine, with the two machines forming a single distributed training job. A common parallelism combination is intra-node tensor parallelism and inter-node data parallelism.

    Using 16 cards as an example, the recommended baseline configuration is:

    Parallelism dimension Example configuration Notes
    Total cards WORLD_SIZE=16 8 cards per machine across two machines
    Intra-node tensor parallel TP=8 Suitable when single-layer parameters are large
    Pipeline parallel PP=1 Can be left off during small-scale validation
    Data parallel DP=2 Each machine holds a full model replica
    Local device LOCAL_RANK=0-7 Card index within each machine
    Global index RANK=0-15 Unique index across the whole job
    Node index NODE_RANK=0/1 First machine is 0, second machine is 1

    If inter-node communication becomes the bottleneck, you can also try:

    Option TP DP Applicable scenario
    Option A 8 2 Strong intra-node interconnect, limited inter-node bandwidth
    Option B 4 4 Heavy intra-node communication pressure, want more data parallelism
    Option C 1 16 Small model, focused on validating data-parallel scaling

    Sample launch environment variables:

    1. export MASTER_ADDR=10.0.0.1
    2. export MASTER_PORT=29500
    3. export WORLD_SIZE=16
    4. export NODE_RANK=0 # Set to 1 on the second machine
    5. export LOCAL_RANK=0 # Usually generated automatically by the launcher
    6. export NPROC_PER_NODE=8

    Sample launch command (replace with the corresponding launcher for your domestic framework):

    1. torchrun \
    2. --nnodes=2 \
    3. --node_rank=${NODE_RANK} \
    4. --nproc_per_node=8 \
    5. --master_addr=${MASTER_ADDR} \
    6. --master_port=${MASTER_PORT} \
    7. train.py \
    8. --tp-size 8 \
    9. --dp-size 2 \
    10. --seq-len 2048 \
    11. --micro-batch-size 1 \
    12. --max-steps 400

    The most common failures in a two-node, 16-card configuration are not in the code but in the environment variables: MASTER_ADDR unreachable, mismatched NODE_RANK, LOCAL_RANK conflicts, and WORLD_SIZE not matching the parallelism degrees.

    5. Communication Optimization: Don’t Get Stuck on Communication

    The bottleneck in multi-card training is often not compute but communication. In a two-node, 16-card training pipeline on domestic AI accelerators, pay particular attention to gradient aggregation, communication overlap, and communication precision.

    Sample communication parameters:

    1. comm_config = {
    2. "bucket_size_mb": 25,
    3. "overlap_comm": True,
    4. "grad_dtype": "float32",
    5. }

    Parameter comparison and tuning order:

    Parameter Effect of lowering Effect of raising Recommended order
    bucket_size_mb Smaller buckets give finer granularity, but scheduling overhead may increase Larger buckets favor bandwidth utilization, but increase memory pressure Start at 10-25MB, then try 50MB
    overlap_comm Turning it off makes communication waits obvious Turning it on overlaps compute and communication, reducing the communication share On by default
    grad_dtype Lower precision reduces communication volume but may hurt numerical stability Higher precision is more stable but costs more communication Start with fp32; try bf16/fp16 once stable
    Gradient compression Over-compression may slow convergence No compression increases bandwidth pressure Try in the final stage

    Tuning recommendations:

    1. First confirm the communication group partitioning is correct, and avoid unnecessary global synchronization.
    2. Then enable compute-communication overlap.
    3. Next, adjust the bucket size and watch throughput and memory.
    4. Finally, evaluate low-precision gradient communication or compression.

    If the communication share is too high, check: inter-node NIC bandwidth, container network mode, switch chip compatibility, communication library environment variables, and whether all ranks participate in the same communication group.

    6. Mixed-Precision Training: fp16, bf16, and Loss Scale

    Mixed-precision training is a common configuration for large-model training on domestic AI accelerators. Its goal is to raise throughput under limited memory while keeping numerics stable.

    Precision Characteristics Recommendation
    fp32 Best stability, high memory and bandwidth pressure Small-scale correctness validation
    fp16 Lower communication and compute pressure, but limited dynamic range Requires loss scale
    bf16 Larger dynamic range, more stable training Try first when the hardware supports it

    Common fp16 risks:

    • Gradients underflow to 0, so parameters stop updating.
    • Gradients overflow to Inf, causing loss scaling to fail.
    • Loss scale adjusts frequently, indicating numerical instability.
    • Loss suddenly becomes NaN, which may be a data, learning-rate, or operator issue.

    Loss-scale anomaly log characteristics:

    1. [grad] step=120 loss_scale=16384 inf_grad_count=0 overflow=false
    2. [grad] step=121 loss_scale=8192 inf_grad_count=3 overflow=true
    3. [grad] step=122 loss_scale=4096 inf_grad_count=0 overflow=false
    4. [loss] step=123 loss=nan

    Recommended order of handling:

    1. Check whether the data contains abnormal samples, empty labels, overly long sequences, or encoding errors.
    2. Try switching to bf16. If the hardware supports it and the loss is stable, prefer bf16.
    3. If you must use fp16, tune the initial loss scale and the dynamic adjustment strategy.
    4. Enable gradient clipping, for example clip_grad_norm=1.0.
    5. Do single-operator localization on the abnormal layers to confirm whether a specific operator is producing Inf.
    6. If the loss still diverges, lower the learning rate or reduce the batch size, then re-validate the 400 steps.

    7. The 400-Step Acceptance Checklist: Did the Pipeline Really Run Through?

    The 400-step validation should not rely on the last loss value alone. It is recommended to form an acceptance table like the following.

    Check item Suggested acceptance criteria Meaning of failure
    First 100 steps loss No NaN/Inf, overall stable or slowly decreasing Data, learning rate, or operator anomaly
    Loss decrease magnitude For simple tasks, at least a visible downward trend; for complex tasks, judge by a smooth curve Learning rate too low, gradients not updating, or optimizer broken
    Per-step time P95/P50 Less than 1.25 A slow node or communication jitter
    Cross-rank per-step time difference Max rank time / min rank time < 1.4 Uneven node load or a slow card
    Peak memory Below 85% of single-card capacity Fragmentation, batch too large, or activations not released
    Throughput samples/s Fluctuation < 10% within 400 steps Communication bottleneck, too many fallback operators, or storage I/O blocking
    Communication time share Kept within a reasonable range; excessively high inter-node communication needs priority optimization Insufficient network bandwidth or an unreasonable synchronization strategy
    OOM/timeout No OOM within 400 steps, no long periods with no progress Insufficient configuration or resources
    Checkpoints Saved successfully and restorable Storage permission or serialization errors
    Log fields Include step, loss, lr, grad_norm, mem, comm_time, rank Insufficient observability

    Recommended key log fields to record:

    1. rank, node_rank, local_rank, step, loss, lr, grad_norm,
    2. mem_used_mb, mem_peak_mb, step_time_ms, throughput_samples_s,
    3. comm_time_ms, loss_scale, overflow, errno, op_name

    If an error occurs during the 400 steps, do not immediately scale up. Fix the failing pipeline first, then re-validate.

    8. Fault Tolerance and Observability: A Reference Architecture on the Cloud

    Long-running training needs to rely on general cloud infrastructure for fault tolerance and monitoring, rather than building the entire operations stack in-house. A reusable reference architecture is as follows:

    Layer Components Role
    Scheduling Container scheduling, job queues, node affinity, fault isolation Manage training jobs and abnormal nodes
    Storage Shared file system, object storage, checkpoint directories Store models and logs
    Monitoring Metrics collection, alerting, dashboards Monitor memory, utilization, temperature, step time
    Logging Structured logs, search, tracing Reconstruct how errors occurred
    Checkpoint Model, optimizer, scheduler, data progress Support resuming from interruption

    Sample checkpoint path:

    1. CKPT_DIR=/shared/ckpt/${JOB_ID}/${EXP_NAME}
    2. mkdir -p ${CKPT_DIR}

    Save-frequency recommendations:

    • Save every 100 steps, or every 30 minutes, whichever comes first.
    • Keep at least the most recent 3 to 5 checkpoints to guard against a single corrupted file.
    • During the 400-step validation, save at least at steps 100, 200, 300, and 400.

    Sample resume command:

    1. python train.py \
    2. --resume_from ${CKPT_DIR}/ckpt-00400.pt \
    3. --start-step 400 \
    4. --max-steps 1000

    Permission requirements:

    • The training user has read/write permission on the checkpoint directory.
    • If writing to object storage, access credentials and bucket permissions must be configured.
    • Before resuming training, confirm the checkpoint path is readable, the files are complete, and the checksums pass.

    Resume conditions:

    • Model weights can be loaded.
    • Optimizer state can be restored.
    • Learning-rate scheduler state can be restored.
    • Mixed-precision loss scale can be restored.
    • Data-loading progress can be restored.
    • Random number state can be restored.
    • The distributed parallelism configuration matches the checkpoint.
    • The config hash, code version, and parallelism degrees match the job record.

    After resuming, it is recommended to run 10 steps first to confirm the loss is close to the value before the interruption, then proceed to formal training.

    9. Common Errors and a Quick-Location Table

    Symptom Possible cause Suggested action
    Training fails to start, all ranks waiting MASTER_ADDR/PORT unreachable, firewall or container network issue Check node connectivity, port availability, and container network mode
    Only some accelerators visible Devices not mounted, driver anomaly, container isolation Check the device list, driver status, and container device mapping
    OOM at the first step Batch too large, sequence too long, memory fragmentation Reduce micro-batch, enable activation recomputation, set a memory expansion strategy
    Communication timeout Wrong NIC selected, abnormal inter-node link, misconfigured synchronization group Specify the communication NIC, test inter-node bandwidth, check communication library logs
    loss is NaN Data anomaly, learning rate too high, unstable mixed precision Check data, switch to bf16, enable gradient clipping, locate the abnormal operator
    loss does not decrease Learning rate too low, gradients not propagating back, parameters not updating Print gradient norms, parameter deltas, and optimizer state
    Training noticeably slow Too many operator fallbacks, insufficient communication overlap, a slow node Check fallback logs, communication time, and per-card step time P95
    Abnormal loss after resuming Data progress, random seed, or optimizer state not restored Check checkpoint contents and resume parameters

    10. Summary: From “Runs” to “Runs Stably” to “Runs Fast”

    Bringing up a two-node, 16-card training pipeline on domestic AI accelerators is not a simple launch — it is an engineering acceptance process. The meaning of the 400-step validation is to confirm, at a relatively low cost, whether the hardware, drivers, operators, communication, parallelism strategy, mixed precision, checkpoints, and monitoring form a closed loop.

    Four recommendations for engineering teams:

    • Correctness first, performance second: get the 400 steps to complete without errors, then optimize throughput.
    • Single node first, then cross-node: scale up from a single card, to multiple cards on one node, and finally to two nodes with 16 cards.
    • Logs first, then tuning: without structured logs, do not blindly adjust communication and parallelism parameters.
    • Baseline first, then scale: capture the memory, step time, throughput, and loss curve of the 400 steps as a baseline.

    Once the training pipeline can run stably and repeatably on domestic AI accelerators, scaling up to larger scales, more nodes, or different hardware becomes much more reliable. This is the key step from “it runs” to “it works well.”