The Engineering Path for Running Large Model Pre-Training on Domestic AI Accelerators

    This article examines what it takes to move large language model pre-training from foreign accelerators to domestic AI chips. It explains why pre-training is far more demanding than inference, then walks through the four core engineering challenges: operator and framework compatibility, parallel strategy and communication budgeting, numerical stability, and cost governance. It also includes practical self-check scripts, a phased rollout checklist, and the key takeaway that long-cycle stability matters more than peak compute.

    1. Why Moving Pre-Training to Domestic Accelerators Has Become a Must

    A notable signal has emerged in the industry recently: the next version of a major large model series plans to migrate its pre-training stage from foreign accelerators to domestic accelerators, whereas domestic chips previously handled mainly inference workloads in that system. The significance of this shift lies not in the hardware swap itself, but in the fact that the most demanding stage is being handed over for the first time.

    Pre-training and inference place completely different demands on hardware. Inference involves short sequences, small batches, latency sensitivity, and generous fault tolerance. Pre-training involves very long cycles, large-scale collective communication, and extreme sensitivity to numerical stability; a single mid-run loss anomaly can burn weeks of compute. So the real question behind “dare we put pre-training on it” is whether software stack maturity, operator coverage, communication library stability, and fault recovery capability have crossed the line of engineering usability.

    Three main drivers are at play:

    • Supply certainty: High-end accelerators face export controls and fluctuating delivery timelines, and single-point dependency makes training schedules unpredictable.
    • Cost structure: When the price per unit of compute drops by an order of magnitude, the logic of budget allocation gets rewritten, and more teams dare to run ablation studies and multiple candidate approaches in parallel.
    • Hardware-software co-design headroom: The optimization space for a general-purpose accelerator plus a mature framework is limited, whereas joint design of in-house chips and frameworks leaves extra margin in low-to-mid precision, operator fusion, and communication topology.

    2. The First Hurdle: Operator and Framework Compatibility

    The most common cause of migration failure is not insufficient compute but graph breakage caused by missing operators. A model often contains a few niche operators (custom normalization, special activations, sparse sampling, positional encoding variants) that lack high-performance implementations on the target backend and can only fall back to generic compute, creating performance black holes.

    The pragmatic approach is to run an “operator health check” first:

    1. Export the model’s computation graph and tally operator types and their time share (use the framework’s built-in profiler, output to a logging service, then aggregate).
    2. Sort by time cost, identify the top few hot operators, and confirm whether the target backend has native implementations.
    3. For missing operators, prioritize rewriting with equivalent compositions; then consider custom operators; and only as a last resort consider approximations with acceptable precision.

    An illustrative operator coverage self-check script (pseudocode, expressing the flow only):

    1. # Pseudocode: measure operator coverage on the target backend
    2. graph = export_graph(model)
    3. stats = profile(graph, warmup=3, steps=20)
    4. missing = []
    5. for op, cost in sorted(stats.items(), key=lambda x: -x[1]):
    6. if not backend.has_native(op):
    7. missing.append((op, cost))
    8. total = sum(stats.values())
    9. gap = sum(c for _, c in missing) / total
    10. print(f"Missing operator time share: {gap:.2%}")
    11. for op, cost in missing[:10]:
    12. print(op, cost)

    Rule-of-thumb threshold: only when the missing-operator time share is kept within a single-digit percentage does migration carry engineering value; beyond that range, fill the operator gaps before talking about training.

    3. Parallel Strategy: Budgeting for Communication on Domestic Cards

    The performance ceiling of pre-training is often determined by collective communication. When migrating to new hardware, inter-card interconnect bandwidth, topology, and cross-machine networking all differ from the original platform, and reusing the existing parallel configuration will almost certainly degrade performance.

    Four dimensions need to be recalculated:

    • Tensor parallelism degree: Limited by the scale of high-bandwidth interconnect within a single machine; cutting too deep sends the communication share soaring.
    • Pipeline parallelism degree: Coupled with global batch size and operator memory footprint, requiring a joint search.
    • Data parallelism and recomputation: Recomputation saves memory but adds roughly 30% forward overhead, so a balance must be struck between memory headroom and throughput.
    • Communication-computation overlap: Hiding gradient reduction and parameter synchronization inside the backward pass is a key means of raising effective compute.

    A simplified tuning loop:

    1. # Pseudocode: search parallel configs targeting effective throughput
    2. best = None
    3. for tp, pp, dp, recompute in search_space():
    4. cfg = build_config(tp, pp, dp, recompute)
    5. throughput = benchmark(cfg, steps=30) # tokens/s
    6. if fits_memory(cfg) and (best is None or throughput > best[0]):
    7. best = (throughput, cfg)
    8. print(best)

    Note: short benchmark runs easily overestimate performance, so always re-verify with a mid-length run of no fewer than several hundred steps, and watch whether the throughput curve decays over time (decay usually signals memory fragmentation or communication jitter).

    4. Numerical Stability: The Most Underestimated Risk in Migration

    After switching hardware, the most likely problems to surface in low-precision training are loss spikes and silent numerical errors. Different backends may differ in reduction order, mixed-precision strategy, and normalization implementation details, causing the same configuration to produce inconsistent convergence curves on two platforms.

    It is advisable to establish three lines of defense:

    1. Small-scale alignment experiments: Run several thousand steps on both backends with the same data and hyperparameters, comparing loss curves and gradient norm distributions; deviations should stay within an acceptable range.
    2. High-precision fallback on critical paths: Retain higher precision for sensitive stages such as normalization, loss computation, and optimizer state updates.
    3. Automatic anomaly circuit-breaking: Monitor gradient norms and loss jumps, and on hitting a threshold, pause and roll back to the most recent healthy checkpoint.
    1. # Pseudocode: training stability circuit breaker
    2. if grad_norm > max_grad_norm * spike_ratio:
    3. log_alert("grad spike", step=step, value=grad_norm)
    4. restore_from(checkpoint=last_healthy)
    5. adjust_lr(scale=0.8)

    5. Cost Governance: How to Spend Once Unit Compute Gets Cheaper

    When training cost drops by an order of magnitude, the most likely waste is “it’s cheap anyway, let’s run a few more rounds.” What really needs to be established is the metric of cost per unit of effective progress, rather than just the price per card-hour.

    Actionable definitions:

    • Define cost / effective token, where effective tokens are samples that pass quality filtering and actually participate in gradient updates.
    • Count failed experiments into cost, and use checkpoint resume to reduce duplicated investment.
    • Use elastic resource pools for interruptible tasks (data cleaning, hyperparameter sweeps), reserving stable resources for long-cycle main training.
    • Store checkpoints and datasets in tiered object storage with lifecycle policies to control storage overhead; monitoring and alerting should cover three core metrics: memory, throughput, and task failure rate.

    6. Phased Rollout Checklist

    • Phase 1 (1–2 weeks): Operator health check plus single-card and single-machine benchmarks to confirm the gap list and memory boundaries.
    • Phase 2 (2–4 weeks): Short-to-mid-range convergence alignment experiments to determine the parallel configuration and precision strategy.
    • Phase 3 (4–8 weeks): Thousand-card-scale stability stress testing to validate fault recovery, checkpoint frequency, and long-run throughput.
    • Phase 4: Formal pre-training, keeping a fallback plan and a dual-track small-scale control, while continuously tracking cost per unit of effective progress.

    7. Conclusion

    Handing pre-training to domestic compute is not a simple hardware swap but a systems engineering effort spanning operators, communication, numerics, cost, and operations. The real barrier has never been peak compute, but the ability to reliably produce usable models over long cycles. Get the four things solid—compatibility health checks, parallel re-tuning, numerical circuit-breaking, and cost definitions—and diversifying the compute foundation will turn from a slogan into reusable engineering assets. For most teams, this is also the technical reserve most worth investing in early, in an environment of uncertain hardware supply.