Practical Guide to Running Large Model Training on Domestic AI Chips

    This article shares practical lessons from bringing up a full large model training pipeline on domestic AI accelerators, where the hardest problem is usually closing the loop rather than raw compute. It covers environment and version alignment, topology checks, choosing among data, tensor, pipeline, and sequence parallelism, handling numerical stability with mixed precision, checkpointing and fault tolerance, and building a minimal observability stack. The key takeaway is that completing 400 consecutive steps on two nodes with 16 cards matters because it proves the pipeline is closed, repeatable, and observable, turning hardware migration into a repeatable engineering process.

    1. Why Closing the Loop Matters More Than Raw Speed

    When adapting large model training to domestic AI accelerators, the most common blocker is not insufficient compute but a pipeline that never closes: single-node forward passes work, yet multi-node runs stall during communication initialization; small models train fine, but scaling beyond a billion parameters triggers numerical overflow; training starts, then the process silently exits hundreds of steps later. This is why completing 400 consecutive steps on two nodes with 16 cards is valuable—not for its performance numbers, but because it proves the entire pipeline is closed, repeatable, and observable in an engineering sense.

    A closed loop typically spans five layers: hardware and drivers, runtime and operators, distributed communication, training scripts and parallelism strategy, and monitoring and fault tolerance. A gap in any layer shows up as “it doesn’t run,” and the cost of diagnosis grows with each layer.

    2. Environment Setup: Reducing Uncertainty

    The first step is version alignment. Pin the driver, runtime, communication library, and framework versions in a manifest and bake them into a container image to avoid the “works on my machine” trap. An illustrative checklist:

    1. # Illustrative flow only; actual commands depend on your environment
    2. check_driver_version # Confirm driver and firmware match
    3. check_device_topology # Inspect inter-card interconnect topology and link bandwidth
    4. check_collective_smoke # Run a small-scale collective communication connectivity self-test

    Topology verification is especially important. In a two-node setup, intra-node traffic usually runs over a high-speed interconnect while inter-node traffic uses the network interface. Without topology awareness, the communication library may route traffic that should stay intra-node across the slower inter-node path, cutting bandwidth by several times. Start with a small-scale collective test to establish connectivity and a bandwidth baseline, decoupling “is the network healthy” from “can the model train.”

    3. Parallelism Strategy: Data, Tensor, and Pipeline Trade-offs

    Two nodes with 16 cards is a typical small-scale multi-node scenario, and the parallelism choice directly determines whether the pipeline runs:

    • Data parallelism: simplest to implement; memory usage grows linearly with model size; suited to dense models with manageable parameter counts.
    • Tensor parallelism: splits a single layer’s matrices across cards to reduce per-card memory pressure, but is sensitive to inter-card bandwidth and is generally used intra-node.
    • Pipeline parallelism: partitions by layer and uses micro-batch scheduling to improve utilization, at the cost of scheduling complexity and bubble overhead.
    • Sequence parallelism and recomputation: the former splits activations for long sequences, the latter trades compute for memory; the two are often combined.

    A practical rule of thumb: use tensor parallelism intra-node to saturate the high-bandwidth interconnect, use data or pipeline parallelism inter-node to tolerate higher latency, and keep the micro-batch size divisible by the number of pipeline stages to avoid wasted scheduling padding.

    4. Numerical Stability and Mixed Precision

    Most “it doesn’t run” failures in large model training come from numerical issues. Mixed precision typically keeps weights and optimizer states at higher precision, uses lower precision for forward and backward passes to accelerate computation, and applies loss scaling to prevent gradient underflow. Note that hardware support for low-precision formats varies: if an operator lacks a low-precision implementation, the framework falls back to higher precision, which shows up as speed jitter rather than an error. To locate it, enable operator-level logging and observe where the fallback occurs.

    1. # Illustrative: general pattern for mixed precision and gradient clipping
    2. scaler = GradScaler(enabled=True)
    3. for step, batch in enumerate(loader):
    4. with autocast(enabled=True):
    5. loss = model(batch).loss
    6. scaler.scale(loss).backward()
    7. scaler.unscale_(optimizer)
    8. clip_grad_norm_(model.parameters(), max_norm=1.0)
    9. scaler.step(optimizer)
    10. scaler.update()

    5. Checkpoints and Fault Tolerance: Making 400 Steps Repeatable

    Long training runs must assume failure will happen. Save checkpoints at fixed intervals, capturing model weights, optimizer state, learning rate scheduler state, and random number state so the curve stays continuous after recovery. Write checkpoints to high-throughput storage and use asynchronous writes to reduce training stalls. If a container platform handles scheduling, configure restart policies and health probes so faulty nodes are automatically isolated and replaced.

    6. Observability: Turning “It Feels Slower” into Metrics

    Once the pipeline runs, put in place a minimal observability stack: throughput (samples per second), per-step time breakdown (compute/communication/checkpoint I/O), memory and temperature, communication volume, and loss and gradient norm curves. Breaking down per-step time is key to finding bottlenecks; if communication consistently dominates, adjust the parallelism split or gradient accumulation strategy first rather than blindly adding cards. A logging service and monitoring alerts can handle metric aggregation and threshold notifications.

    7. Beyond 400 Steps: From “It Runs” to “It Reproduces”

    The significance of 400 steps is that it covers initialization, learning rate warmup, rapid loss descent, and mid-run fluctuation—enough to expose most adaptation defects. To move toward reproducibility, also fix the data sampling order, record an environment fingerprint, bring configuration under version control, and run two short alignment experiments with the same configuration to compare loss curve deviation. Only when the deviation falls within an acceptable range can you say the training pipeline truly stands on domestic hardware. For most teams, the value of this methodology exceeds any single benchmark run: it turns hardware migration from a one-time push into a repeatable engineering process.