Running Large Model Training on Domestic AI Accelerators: A Practical Guide

    Migrating large model training from mainstream accelerators to domestic AI accelerators is often mistaken for a simple hardware swap. In practice, success depends on how maturely the software and hardware work together across the entire training pipeline. This guide explains what it means to get that pipeline working end to end, the core adaptation challenges (framework and runtime integration, operator coverage and numerical alignment, and collective communication), how to configure hybrid data, tensor, and pipeline parallelism for multi-node, multi-GPU setups, why sustaining hundreds of training steps is a key health signal, and best practices for tuning and troubleshooting on heterogeneous platforms.

    1. Why Getting the Training Pipeline Working Is the First Hurdle

    As AI compute moves toward greater self-reliance, migrating large model training from mainstream accelerators to domestic AI accelerators is often treated as a simple matter of “swapping hardware.” Engineering practice, however, shows that what really determines success or failure is not paper specifications like single-card compute or memory capacity, but the maturity of hardware-software co-design. A complete training pipeline spans many stages—data loading, forward computation, backward propagation, gradient synchronization, parameter updates, and checkpoint saving—and any deviation at any one of these stages on a heterogeneous platform can prevent training from starting or produce incorrect results.

    For this reason, “getting it working” is itself a milestone-level engineering goal. It means the framework can correctly load the model on the new hardware, that operator computations match expectations, that communication between multiple cards is stable, and that the loss function decreases sensibly over hundreds of iterations without producing NaN or Inf. Only once the training pipeline runs stably from end to end does the question of “can it train” give way to “can it train fast and train well.”

    2. Core Challenges in Adapting the Training Pipeline

    Framework and Runtime Adaptation

    Mainstream deep learning frameworks are designed around mature ecosystems, and their underlying acceleration interfaces, memory management, and device abstractions are often tightly coupled to specific hardware. Migrating to domestic accelerators usually requires an adapter layer or plugin mechanism provided by the vendor to redirect the framework’s device calls to the target hardware. The key at this step is preserving semantic consistency: given the same operator inputs, the new platform should produce numerically equivalent outputs (within a tolerance range); otherwise, precision risks are introduced.

    Operator Coverage and Numerical Alignment

    Large models rely on a large number of custom or high-performance operators—attention mechanisms, normalization, activation functions, and the communication-computation fusion operators required by various parallelism strategies. A common problem during adaptation is that some operators are missing, or exist but fail to meet precision or performance targets. A typical engineering strategy is “fall back to generic implementations, then progressively replace them with high-performance operators”: first use the framework’s native operators to guarantee correctness and get the pipeline running, then swap in validated accelerated operators one by one and compare the numerical differences.

    Integrating the Collective Communication Library

    Multi-card training depends on collective communication primitives (such as all-reduce, broadcast, and All-to-All) to complete gradient synchronization and activation exchange. Domestic platforms generally provide collective communication implementations that are on par with mainstream communication libraries. The focus of adaptation is to point the framework’s communication backend correctly at that implementation and to verify cross-node bandwidth, latency, and stability.

    3. Key Configuration for Multi-Node, Multi-GPU Distributed Training

    A typical configuration like “two nodes, sixteen cards” is essentially a hybrid parallelism scenario that combines data parallelism with model parallelism. Understanding the division of labor among parallelism strategies is the prerequisite for configuring it correctly.

    • Data parallelism: Each card holds a complete copy of the model and processes a different data shard, keeping parameters consistent through gradient synchronization. It is simple to implement and scales well, but memory usage grows linearly with model size.
    • Tensor parallelism: Splits the matrix computations within a single layer across multiple cards, reducing per-card memory pressure, but demands high inter-card communication bandwidth and is usually deployed within a single node.
    • Pipeline parallelism: Splits the model across devices by layer and improves utilization through micro-batching, but requires careful handling of the pipeline “bubble.”

    In cross-node scenarios, mapping a sensible parallel topology is especially important. A practical rule is to keep the most communication-intensive tensor parallelism constrained within a single node’s high-bandwidth interconnect, and to place the data parallelism or pipeline parallelism that incurs higher cross-node overhead between nodes. This reduces the drag that slow links place on overall throughput.

    1. # Illustration: hybrid parallelism launch configuration (pseudocode, showing configuration dimensions)
    2. config = {
    3. "tensor_parallel_size": 8, # tensor parallelism within a single node
    4. "pipeline_parallel_size": 2, # pipeline parallelism across nodes
    5. "data_parallel_size": 1, # remaining dimension used for data parallelism
    6. "micro_batch_size": 1, # micro-batch size, controls memory usage
    7. "gradient_accumulation": 16, # gradient accumulation, effectively enlarges the global batch
    8. "mixed_precision": "bf16", # mixed-precision strategy
    9. "backend": "collective_comm_lib", # collective communication backend
    10. }

    Note that the values above are only structural illustrations. Actual values must be determined by weighing model size, per-card memory, interconnect bandwidth, and global batch size together, and refined through empirical tuning.

    4. Stability Validation: What Running Hundreds of Steps Really Means

    “Running four hundred steps” may look like just a number, but it is a key signal of training pipeline health. It turns a one-time “can start” into a sustainable “can converge,” and specifically validates several things:

    1. Numerical stability: The loss function shows no NaN, Inf, or violent oscillation over hundreds of steps, indicating that the mixed-precision scaling strategy, gradient clipping, and overflow handling are configured correctly.
    2. Resource stability: No leak-like growth in memory and no communication deadlocks, indicating that memory management and synchronization logic work correctly on the heterogeneous platform.
    3. End-to-end closure: Checkpoint saving, log output, learning rate scheduling, and other stages all work, proving the pipeline not only “computes” but also “stores and recovers.”

    In engineering practice, it is advisable to proceed at a pace of “small-scale quick validation → progressively scale up”: first get all stages working on a small model and small dataset to confirm there are no functional or numerical issues; then gradually increase the degree of parallelism and model size; and finally enter long-cycle training. At each stage, watch whether the loss curve decreases smoothly, and connect key metrics to monitoring and alerting so that problems can be located quickly when anomalies occur.

    5. Best Practices for Tuning and Troubleshooting on Heterogeneous Platforms

    • Correctness first, then performance: Any optimization should build on numerical correctness. Keeping a “reference implementation” for comparison is the most effective way to troubleshoot precision problems.
    • Localize performance bottlenecks layer by layer: First use performance analysis tools to distinguish compute, communication, and data-loading bottlenecks, then optimize accordingly rather than tuning parameters blindly.
    • Control communication overhead: Set gradient accumulation and batch size reasonably to reduce synchronization frequency; prefer fused operators to lower the cost of switching between communication and computation.
    • Strengthen observability: Connect key metrics such as throughput, memory usage, communication time, and loss into a unified logging and monitoring system, with alerting to detect and address problems early.
    • Establish a reproducible environment: Pin the adapter layer version, operator library version, framework version, and configuration so that issues can be reproduced under the same environment. Team collaboration and knowledge accumulation both depend on this.

    6. Summary

    Getting a large model training pipeline working on domestic AI accelerators is a classic systems engineering task that tests a team’s combined understanding of framework mechanisms, parallelism strategies, the operator ecosystem, and numerical stability. From framework adaptation and operator alignment, to distributed communication and mixed precision, to the closed-loop validation of “stably running hundreds of steps,” each step demands rigorous validation and tuning. For teams that want to conduct large model training on heterogeneous compute, rather than chasing single-point specifications, it is better to invest energy in polishing a reproducible, observable, and scalable training pipeline—that is the solid step toward truly realizing compute self-reliance.