LLM Compute Migration: Risks and Pathways for Switching Software Stacks
Migrating LLM training to a new accelerator is not a hardware swap—it is a full software stack migration. This article explains why the stack determines success, introduces a maturity model for assessing migration readiness, outlines key risks such as performance regression, numerical divergence, and communication bottlenecks, and presents an engineering approach built on reproducible baselines, dual-stack shadow training, staged rollouts, and rollback mechanisms—turning a high-stakes bet into a series of gated checkpoints.
Introduction: Switching Tracks Is Not Switching Chips
A model team plans to introduce a domestically developed accelerator into the pre-training of its next-generation model, and has already adapted multiple infrastructure components to the target platform through open source, covering operators, communication, compilation, and attention computation. At the same time, the new accelerator is still under testing, and larger-scale training will continue to rely on the existing accelerator ecosystem in the near term. This state can be summed up in one sentence: one foot remains in the old ecosystem while the other steps onto the new platform, and the space in between is the most fragile phase of migration.
Many discussions reduce compute migration to a “hardware replacement,” but LLM training actually depends on a complete software stack. The chip is merely the carrier of compute; what determines training efficiency, numerical stability, and long-run reliability is the coordination of operator implementations, collective communication, compilation optimization, parallelism strategies, data pipelines, fault tolerance and recovery, and observability. Getting inference to run does not mean pre-training will work; getting a single machine to run does not mean a thousand-card cluster will; aligning loss on small-scale runs does not mean a long training run will not diverge.
Therefore, whether a migration is viable cannot be judged by “can it run,” but by “can it run continuously at the target cost, target stability, and target accuracy.” Laying the path is only the beginning. Actually switching tracks still requires crossing three gates: validation, tuning, and risk control.
1. Why the Software Stack Determines Migration Success
The LLM training software stack can be roughly divided into six layers:
- Operator and kernel layer: implementations of matrix computation, normalization, attention, and activation functions. Different accelerators differ in memory hierarchy, parallelism granularity, and numerical behavior; the same mathematical formula may correspond to different accumulation orders and error characteristics.
- Communication and parallelism layer: data parallelism, tensor parallelism, pipeline parallelism, and collective communication. Topology, bandwidth, congestion control, and synchronization strategies directly affect scaling efficiency.
- Compilation and runtime layer: graph optimization, memory reuse, dynamic shape support, and operator fusion. Differences in compilation strategy can cause performance regression or additional memory peaks.
- Training framework and scheduling layer: computation graph execution, gradient synchronization, mixed precision, checkpoint saving and recovery. Insufficient framework adaptation amplifies low-level differences into training instability.
- Data pipeline layer: sample loading, preprocessing, sharding, and caching. Once training accelerates, insufficient data supply turns from a “secondary issue” into a throughput bottleneck.
- Operations and observability layer: logging, metrics, tracing, fault injection, alerting, and rollback. Without these capabilities, migration problems go from “diagnosable” to “inexplicable.”
Open-sourcing foundational components significantly lowers the adaptation barrier, because it lays down general-purpose capabilities such as operators, communication, and compilation in advance. But pre-training is a far more demanding scenario: long-duration, large-scale, tightly synchronized, high-throughput. Any numerical deviation, communication jitter, or memory leak gets amplified. Tiny differences that inference can tolerate may evolve into loss curve drift during pre-training. Component open source is therefore a necessary but insufficient condition; pre-training validation is the true dividing line of migration.
2. Migration Maturity: The Intermediate State Carries the Highest Risk
A simplified maturity model can help determine which stage a team is in:
- L0 Single-point validation: a small model runs on a single machine or small cluster, verifying that operators and the framework are basically usable.
- L1 Inference adaptation: the inference pipeline is stable with acceptable performance and accuracy, but training backpropagation and long-run stability are not covered.
- L2 Foundational components ready: operator libraries, communication libraries, and compilation components are adapted, providing the basis for building a training environment.
- L3 Small-scale pre-training validation: multiple training runs completed at the hundred-card scale or smaller, with loss curves, throughput, and recovery capability meeting the gates.
- L4 Production-grade dual-stack or full cutover: large-scale long-run training, gradual rollout, rollback mechanisms, and cost models are all mature.
The state in the original scenario is closer to somewhere between L2 and L3: foundational components are in place, the new hardware is under testing, but large-scale pre-training has not fully switched over. This stage is the most dangerous, because teams easily develop the illusion of “already usable” while production still depends on the old ecosystem as a safety net. Running dual stacks in parallel is not hesitation—it is rational risk control: use the old ecosystem to continue training larger models and guarantee business continuity, while using the new platform for shadow validation to accumulate evidence.
3. Key Risk Checklist
1. Performance regression and declining scaling efficiency. Meeting per-card performance targets does not guarantee linear cluster scaling. When communication topology, parallelism partitioning, and compilation optimization are mismatched, the larger the scale, the more visible the efficiency loss. Focus on throughput, per-sample cost, scaling efficiency, and memory peaks rather than single-operator benchmarks alone.
2. Numerical consistency and precision deviation. Differences in accumulation order, mixed-precision strategy, and reduction implementation can cause loss curve divergence. Validation should look beyond final metrics to gradient norms, loss spikes, activation distributions, and outlier ratios.
3. Communication bottlenecks. Collective communication is the lifeline of large-scale training. Bandwidth utilization, congestion, synchronization waits, and topology-aware scheduling all need stress testing. After a small cluster works, scale up step by step along a ladder of cluster sizes.
4. Compilation and runtime differences. Dynamic shapes, graph fusion, and memory reuse may introduce extra compilation time or memory peaks. Establish reproducible compilation caching and version locking mechanisms.
5. Long-run stability and failure recovery. Pre-training often lasts days or even weeks. Checkpoint frequency, recovery time, and retry strategies after node failures all affect effective training time. Without fault injection, a rollback mechanism is only a paper capability.
6. Ecosystem and talent risk. Insufficient debugging experience with the new stack lengthens problem localization time. Knowledge should be consolidated into runbooks, troubleshooting trees, and automated checks rather than depending on a few experts.
7. Cost and supply chain risk. Migration cost includes not only hardware procurement but also adaptation labor, dual-stack operation, performance losses, and opportunity costs. Build a model of unit effective training cost instead of comparing only peak compute.
4. Engineering Practice: Breaking the “Big Bet” into Stage Gates
4.1 Establish a Reproducible Baseline
First, fix the model architecture, data version, hyperparameters, random seeds, and evaluation sets on the existing ecosystem to form performance and accuracy baselines. Without a baseline, “acceptable” after migration cannot be defined. The baseline should include throughput, scaling efficiency, loss curves, checkpoint recovery time, and failure rates.
4.2 Dual-Stack Parallelism and Abstraction Isolation
Use a configuration layer to isolate backend differences, avoiding conditional branches scattered throughout training code. An illustrative configuration:
training:backend: dual_stackprimary: legacy_acceleratorcandidate: domestic_acceleratormode: shadowbaseline:throughput: recordedloss_curve: recordedrollback:enabled: truecheckpoint_interval: fixedobservability:metrics: [throughput, loss, grad_norm, memory_peak, comm_wait]
The goal of dual-stack configuration is not to maintain two codebases long-term, but to let the candidate backend run in shadow mode while the primary backend guarantees business continuity. The candidate backend starts with small-scale, short-duration tasks and scales up gradually.
4.3 Shadow Training and Gradual Rollout
Shadow training reproduces training on the candidate platform with identical data and hyperparameters, without carrying production output. Compare loss curves, gradient norms, and throughput stability. After passing the gates, roll out gradually along “single machine → small cluster → hundred-card → production scale.” Set stop conditions at each level—for example, loss deviation exceeding a threshold, abnormally rising communication waits, or unacceptable recovery time.
4.4 Rollback and Observability
Rollback must be a rehearsed capability, not just a configuration item. Checkpoints should be compatible with recovery on both stacks, and logs, metrics, and traces should be collected uniformly. Observability metrics should at least include: throughput, per-sample cost, communication wait, memory peak, loss spikes, gradient norms, and failure recovery duration. An isolated validation environment can be built on Baidu AI Cloud using general-purpose categories such as container platforms, object storage, log services, and monitoring/alerting—but a single point running in the cloud does not equal production readiness.
4.5 Cost Model and Decision Gates
A migration decision should answer four questions: What is the performance attainment rate? Is the precision deviation controllable? Does long-run stability meet the target? Is the unit effective training cost better? Only when all four pass the gates is it appropriate to increase the cutover ratio. Otherwise, keep the dual stack and continue optimizing the weak layers.
Conclusion: A Laid Path Does Not Mean the Switch Is Complete
The essence of LLM compute migration is software stack migration—a systems engineering effort spanning operators, communication, compilation, frameworks, operations, and cost models. Open-sourcing foundational components lowers adaptation cost, but pre-training validation, long-run stability, and rollback capability are the true production-grade thresholds. The dual-stack phase is the most fragile and demands the most engineering discipline: define acceptability with baselines, accumulate evidence through shadow training, control risk through gradual rollout, and provide a safety net with rollback and observability. Breaking the “biggest bet” into stage gates is the path from “it runs” to “it runs reliably over the long term.”
