How to Validate Large Language Model Training Pipelines on Domestic AI Accelerators

    As large model training moves into an era of heterogeneous, multi-vendor compute, more teams are asking how to select and validate domestic AI accelerators for real training workloads. Rather than focusing on single-card peak performance, this article breaks down "getting a training pipeline running" into an executable, verifiable, and reproducible engineering process. It explains how to define hardware and software boundaries, how to check operator coverage, communication library adaptation, and framework integration, and how to design multi-node distributed training. It also shows how to judge whether the pipeline is correct and efficient, provides a practical accelerator checklist with common bottlenecks, walks through a step-by-step method for troubleshooting NaN loss, and offers engineering recommendations for moving from pipeline validation to stable training.

    As large model training enters a stage of heterogeneous, multi-vendor compute, more and more teams are asking: How do we choose a domestic accelerator? How do we validate the training pipeline on a domestic accelerator? What errors commonly show up when training on domestic GPUs? This article does not discuss single-card peak performance. Instead, it breaks “getting a training pipeline running” into an executable, verifiable, and reproducible engineering process, helping developers judge whether domestic compute has the foundational capability to take on real large model training workloads.

    1. First, Define Hardware Boundaries: Domestic Accelerators Are Not Interchangeable

    Under a domestic compute environment, the first step is not to launch training immediately, but to confirm the hardware and software boundaries. Common domestic accelerators include training cards, inference cards, cards from different compute generations, cards with different memory capacities, and products with different interconnect capabilities. The differences between card models are reflected not only in compute and memory capacity, but also in driver versions, firmware versions, collective communication libraries, operator libraries, compiler toolchains, and framework adaptation branches.

    Therefore, before validating the training pipeline, it is recommended to record the following information first:

    • Accelerator type: whether it is a training card or an inference card, and whether it supports long-running, high-load training.
    • Per-card memory and inter-card interconnect: whether it supports high-speed inter-chip interconnect, and whether high-speed networking is used between machines.
    • Driver and firmware versions: different versions may cause differences in device visibility, communication stability, or operator behavior.
    • Framework adaptation version: you must use the vendor’s adaptation branch, official patches, or a verified community version, and pin the version number and commit record.
    • Communication library and operator library versions: the collective communication library, operator library, and compiler must match the framework version.
    • Hardware deployment boundaries: single-node multi-card, dual-node multi-card, and cross-datacenter multi-node scenarios differ significantly, and conclusions drawn from a small-scale setup should not be directly extrapolated to large scale.

    For training pipeline validation, it is not advisable to focus only on “whether the program can start.” A more reasonable criterion is: whether it can complete the forward pass, backward pass, parameter update, gradient synchronization, and checkpoint saving under fixed data, fixed hyperparameters, and a fixed random seed, while keeping the loss curve on a credible downward trend.

    2. Core Checkpoints for Training Pipeline Adaptation: Operators, Communication Libraries, and Framework Integration

    1. How to Determine Whether Operators Are Adapted?

    Large model training relies heavily on operators. Common key operators include matrix multiplication, multi-head attention, Softmax, LayerNorm, RMSNorm, activation functions, Dropout, and optimizer updates. When adapting a domestic accelerator, it is not enough to check only “whether it runs”; you must also check “whether it is efficient, whether it is stable, and whether precision is controllable.”

    It is recommended to focus on three types of problems:

    First, operator coverage. Are there native implementations for the operators required by training? If not, can they be implemented by combining basic operators? Is the performance of the combined implementation acceptable? For hot operators, prioritize confirming whether the vendor provides an efficient implementation.

    Second, numerical precision. In mixed-precision training, the forward and backward passes commonly use FP16, BF16, or FP32. You need to confirm whether the hardware natively supports the target precision and whether the accumulation precision meets the training requirements. If some operators do not support low precision, their precision fallback strategy should be clarified.

    Third, fusion optimization capability. Whether operators such as attention, normalization, and activation can be fused directly affects memory read/write counts, kernel launch overhead, and per-step time. For domestic accelerator adaptation, operator fusion is often not a question of “whether it exists” but “whether it has been validated and is stable and usable.”

    2. Which Equivalent Capabilities Should Communication Library Adaptation Focus On?

    Multi-card and even multi-node training relies on collective communication primitives, including AllReduce, AllGather, ReduceScatter, All-to-All, and so on. The communication path of a domestic accelerator is typically composed of inter-chip interconnect, PCIe, inter-machine high-speed networking, and the vendor’s collective communication library.

    In a domestic accelerator environment, communication library adaptation requires confirming the following:

    • Whether it provides capabilities equivalent to mainstream collective communication interfaces, such as gradient synchronization, parameter aggregation, and sharded communication.
    • Whether it supports the current parallelism strategies, including data parallelism, tensor parallelism, pipeline parallelism, and combined parallelism.
    • Whether it is topology-aware, including inter-card interconnect, intra-node topology, NICs, ports, and rank assignment.
    • Whether there are clear version requirements; the collective communication library must match the driver, firmware, framework, and network environment.
    • Whether it supports topology-detection parameters, such as rank mapping, NIC selection, port configuration, communication timeouts, and retry policies.

    If the communication library version does not match, problems such as AllReduce hanging for a long time, communication timeouts, throughput jitter, or multi-node jobs failing to exit properly may occur. Therefore, communication adaptation cannot rely only on a passed single-card operator test; multi-card and multi-node communication stress tests are also required.

    3. How to Judge Portability at the Framework Integration Level?

    Mainstream training frameworks typically interface with underlying hardware through device abstraction, backend plugins, operator registration, and distributed launchers. When a domestic accelerator adapts to a framework, common work includes interfacing with the device runtime, operator registration and scheduling, mixed-precision strategy support, distributed launcher compatibility, and coordinating vendor patches with framework versions.

    The goal of framework-level integration is not to modify all business code, but to let upper-layer modeling code migrate with as few changes as possible. If migration requires extensive changes to model code, optimizer code, or parallelism strategy configuration, it indicates that framework integration has not yet reached an engineering-reusable level.

    3. How to Design Multi-Node, Multi-GPU Distributed Training?

    Two nodes with sixteen cards is a typical entry-level scenario for multi-node training and can cover the key path of cross-node communication. When designing distributed training, the parallelism strategy must be defined clearly.

    Data parallelism is suitable as a basic validation method. Each card holds a full model replica, processes different data batches, and keeps parameters consistent through gradient synchronization. It is simple to implement, but memory usage and communication volume grow as the number of cards increases.

    Tensor parallelism is suitable for splitting the computation of a single layer across multiple cards and is better suited to intra-node high-speed interconnect scenarios. It requires higher bandwidth and is often used to split compute modules such as attention and linear layers.

    Pipeline parallelism splits the model across different devices by layer, forming a pipelined execution. It can reduce per-card memory pressure but requires handling bubbles, scheduling, and load balancing.

    In practice, combined parallelism is often used. The following is a piece of illustrative pseudocode, used only to explain parallelism configuration logic and not tied to any specific framework:

    1. # Parallelism strategy illustration: data parallelism + tensor parallelism + pipeline parallelism
    2. parallel_config = {
    3. "data_parallel_size": 8,
    4. "tensor_parallel_size": 2,
    5. "pipeline_parallel_size": 1,
    6. }

    This example represents a total of sixteen devices distributed across two machines. In practice, you need to launch through the vendor’s adapted framework. Common launch methods include the framework’s native launcher, distributed launch commands, or a job submission tool provided by the vendor. Minimum environment dependencies typically include the driver, firmware, accelerator runtime, collective communication library, operator library, framework adaptation version, compiler toolchain, network configuration, and training scripts.

    In cross-node scenarios, gradient synchronization goes through the inter-machine network. Therefore, communication-computation overlap is critical. If communication cannot be hidden by computation, throughput will be noticeably affected. During validation, observe communication time, computation time, gradient synchronization time, and end-to-end per-step time to determine whether there is obvious waiting.

    4. How to Determine Whether the Training Pipeline Is Truly Running?

    After the pipeline is running, you also need to answer “Is it correct, and is it good?” It is recommended to evaluate from the following dimensions.

    First, loss convergence. Observe whether the loss decreases steadily as the number of training steps increases, and compare it against a reference implementation. The reference baseline should come from the same model structure, the same hyperparameters, the same data order, and the same precision mode.

    Second, numerical consistency. Under the same random seed and the same data, compare whether the loss, gradients, and parameter updates produced by different hardware show abnormal deviations. If the deviation exceeds tolerance, investigate operator precision, communication synchronization, or initialization logic.

    Third, training throughput. Common metrics include tokens processed per second, time per step, and per-card throughput. When measuring, it is recommended to fix the card type, driver version, framework version, precision mode, parallelism strategy, and global batch size.

    Fourth, stability. During continuous runs of several hundred steps, check whether issues such as memory leaks, communication timeouts, process hangs, or corrupted checkpoints occur.

    Fifth, scalability. From single card to multi-card and from single node to multi-node, check whether efficiency scales reasonably with size. If throughput drops significantly after scaling up, investigate communication bottlenecks, topology configuration, or parallelism partitioning strategy.

    Regarding the validation goal of “completing four hundred training steps,” it is recommended to add a clear definition. For example: on a certain model of domestic training card, with two nodes and sixteen cards, a model scale of about 7 billion parameters, a sequence length of 4096, BF16 precision, a fixed global batch size, and fixed data preprocessing, train continuously for four hundred steps. A pass criterion can be defined as: no NaN, no Inf, and no OOM during training; the loss shows a downward trend with a deviation from the reference baseline controlled within an acceptable range; throughput reaches a high proportion of the same-hardware baseline or the vendor’s reference value; no communication timeouts or process hangs; and checkpoints can be saved and loaded normally. Such a validation goal can cover the complete loop of startup, forward, backward, synchronization, update, and saving at a limited cost.

    5. Domestic Accelerator Adaptation Checklist and Common Bottlenecks

    In practical adaptation, it is recommended to build a domestic accelerator checklist covering the full process from environment setup to long-term stability.

    Environment check: whether the driver, firmware, runtime, framework, communication library, and operator library versions are consistent. Device check: whether the accelerator is visible, whether memory is normal, and whether inter-card interconnect is normal. Operator check: whether key operators are covered, whether the precision mode is supported, and whether operators are missing. Communication check: whether single-node multi-card and multi-node multi-card communication are normal, whether topology detection is accurate, and whether communication timeouts can be located. Framework check: whether framework patches are installed, whether the device abstraction takes effect, and whether the launcher supports multiple nodes. Precision check: whether FP16, BF16, and FP32 work as expected and whether loss scaling is effective. Long-stability check: whether continuous training of several hundred steps shows memory growth, communication jitter, process hangs, or abnormal logs.

    Common bottlenecks include: insufficient performance of hot operators, limited cross-node communication bandwidth, excessive memory pressure, numerical instability in mixed precision, and unreasonable parallelism partitioning. Corresponding optimization methods include operator fusion, memory access optimization, kernel tuning, gradient compression, communication-computation overlap, activation recomputation, optimizer state sharding, loss scaling, and precision whitelist strategies.

    6. A Typical Troubleshooting Case: What to Do When Loss Becomes NaN?

    Suppose the loss becomes NaN after dozens of steps. You can troubleshoot in the following order.

    Step one, fix the reproduction conditions. Record the random seed, data order, model initialization, hyperparameters, driver, firmware, framework, communication library, and operator library versions to ensure the problem is reproducible.

    Step two, disable or switch the precision mode. If NaN appears under FP16, try BF16 or FP32 to determine whether it is a precision overflow or a numerical operator problem.

    Step three, check individual operator precision. Run unit tests on key operators such as matrix multiplication, normalization, attention, and optimizer updates to confirm whether there is abnormal output.

    Step four, check the optimizer and gradients. Confirm whether gradient clipping, loss scaling, weight decay, and learning rate scheduling are configured correctly, and rule out abnormal optimizer states.

    Step five, check communication synchronization. If NaN appears after multi-card parallelism, confirm whether gradient synchronization is correct, whether communication is out of order, and whether parameter updates are consistent.

    Step six, retain logs and localize layer by layer. Collect logs at the four levels of framework, operator, communication, and precision, and avoid guessing based on symptoms alone.

    The following is a minimal debugging command example; when using it, replace the vendor device interface as needed:

    1. # Check the framework version
    2. python -c "import torch; print(torch.__version__)"
    3. # Check whether the device is available; for a domestic device, replace with the vendor's adapted interface
    4. python -c "import torch; print(torch.cuda.is_available())"
    5. # Reproduce with a small batch, a single step, or mixed precision disabled
    6. python debug_train.py --steps 1 --batch_size 1 --mixed_precision off

    If single-step debugging works normally but multi-card training fails, prioritize checking the communication library version, topology configuration, inter-machine network, rank mapping, and synchronization logic.

    7. Engineering Recommendations: From Pipeline Validation to Stable Training

    For teams that want to complete large model training pipeline adaptation on domestic compute, it is recommended to follow a path of small-before-large and baseline-before-optimization. First, use a small-scale model and a dual-node multi-card setup to get the pipeline running; second, fix the data, hyperparameters, and random seed to establish a reproducible baseline; third, troubleshoot layer by layer across framework, operator, communication, and precision; fourth, build observability capabilities to collect memory usage, communication time, throughput curves, loss curves, and process status; fifth, persist checkpoints, logs, and datasets to facilitate resume-from-checkpoint training and result review.

    Against the backdrop of diverse compute coexisting, getting the training pipeline running is not just about making the program error-free, but about verifying whether domestic accelerators have the ability to stably take on real training workloads. Through clear hardware boundaries, an executable checklist, measurable evaluation criteria, and a reproducible troubleshooting process, teams can more robustly accomplish the leap from pipeline validation and performance optimization to production deployment.