Getting Large Model Training Working on Domestic AI Accelerators: A Practical Guide

    This article walks through the practice of getting a full large model training pipeline running on domestic AI accelerators, using a two-node, sixteen-card, 400-step run as a verifiable baseline. It explains why a closed-loop pipeline matters more than peak performance, breaks down six key areas (environment consistency, data pipeline, parallel strategy partitioning, communication and gradient synchronization, numerical stability, and checkpointing with observability), and outlines a layered approach to diagnosing common failures. Readers will learn a repeatable, measurable, and regression-friendly method for validating training before moving on to throughput and optimization work.

    1. Why “Getting the Pipeline Working” Matters More Than “Hitting Peak Performance”

    When adapting large-scale model training to domestic AI accelerators, the first challenge a team faces is usually not performance but whether the pipeline can close the loop. “Getting it working” means the full flow, from data loading, forward computation, and backpropagation through gradient synchronization, optimizer updates, and checkpoint saving, can run continuously for several hundred steps without interruption, with the loss curve staying within a reasonable range. Only when the pipeline is stable do subsequent throughput optimization and parallel partitioning adjustments become meaningful.

    Two nodes with sixteen cards and 400 steps represent a typical “small-scale, verifiable” setup: it is large enough to expose most engineering issues such as multi-node communication, memory overflow, and numerical anomalies, yet small enough to complete in hours, making it suitable as a regression baseline. The industry commonly refers to this kind of validation as a small-scale smoke test, and its value lies in moving uncertainty from long-cycle training forward into short-cycle iteration.

    2. Six Key Steps to Get the Pipeline Working

    1. Environment Consistency

    The driver, runtime, communication library, and framework versions must be identical across both machines. In practice, the most common failure is not a code error but a communication initialization hang caused by version drift between nodes. It is recommended to freeze the environment into a unified image and run a consistency check before startup.

    1. # Example: verify environment fingerprints match across nodes before launch
    2. import hashlib, os, subprocess
    3. def env_fingerprint():
    4. raw = subprocess.check_output(
    5. ["bash", "-lc", "pip freeze | sort"], text=True
    6. )
    7. return hashlib.sha256(raw.encode()).hexdigest()[:16]
    8. local = env_fingerprint()
    9. print(f"node={os.uname().nodename} fp={local}")
    10. # Launch the training process only after all nodes report the same fingerprint

    2. Data Pipeline

    On the data side, ensure shards do not overlap, ordering is reproducible, and read throughput does not become a bottleneck. A common approach is to pack small files into large, sequentially readable blocks, combine them with multi-process prefetching, and overlap data loading with computation. If data reading fluctuates, it shows up as “idle compute,” which is easily mistaken for insufficient hardware performance.

    3. Parallel Strategy Partitioning

    Within a single machine, prefer data parallelism; across machines, layer on tensor or pipeline parallelism. The choice of partitioning dimensions follows two principles: first, keep dimensions with heavy communication inside the machine to use high-bandwidth interconnects; second, balance the load per card to avoid any single card becoming a long tail. For pipeline parallelism, also watch the bubble ratio, since overly fine stage division amplifies bubble overhead.

    4. Communication and Gradient Synchronization

    Gradient synchronization is usually done in buckets: buckets that are too large raise peak memory usage, while buckets that are too small increase the number of communication rounds. Gradient accumulation can be enabled to dilute synchronization frequency, and higher-precision accumulation should be retained for precision-sensitive parts.

    5. Numerical Stability

    Mixed-precision training needs to maintain a master copy of the weights, and loss scaling must be adjusted dynamically. If loss spikes or non-numeric values appear, first check the scaling factor, the normalization layer implementation, and accumulation precision, rather than rushing to swap hardware.

    6. Checkpoints and Observability

    The 400-step validation must leave evidence: save checkpoints periodically, and record per-step loss, gradient norm, per-card memory, and throughput. Metrics should be collected uniformly into a logging service and a monitoring and alerting system to make it easy to compare different configurations side by side.

    3. Common Failure Modes and Diagnosis Order

    It is recommended to troubleshoot in the order of “environment first, then data, then computation”: first confirm that environment fingerprints match across nodes and that the network is connected; second, use a tiny model with a fixed random seed to verify whether the loss decreases monotonically; third, gradually scale up the batch size and parallelism while watching for inflection points in memory and communication. This layered approach can significantly shorten the time it takes to converge on a problem.

    4. From Working to Usable

    Once the pipeline is stable, you can proceed with throughput baseline measurement, operator fusion and computation graph optimization, and evaluation of memory reuse and recomputation strategies. It is worth emphasizing that any optimization should take pipeline regression as a prerequisite, change only one variable at a time, and keep a rollback-capable configuration. If elastic resources are involved, you can combine a container platform with object storage to handle environment delivery and data distribution, and rely on a unified logging and monitoring system for observability. These are all general capability categories and do not point to any specific product.

    5. Conclusion

    The significance of two nodes, sixteen cards, and 400 steps lies not in the numbers themselves but in establishing a repeatable, measurable, and regression-friendly engineering method. By getting environment consistency, data pipeline, parallel partitioning, numerical stability, and observability solidly in place, migrating large model training to domestic AI accelerators shifts from “relying on luck” to “advancing through a defined process.”