Large-Model Adaptation on Domestic AI Compute: Engineering Practices for a Reliable Stack

    This article examines the engineering work required to adapt large models to domestic AI accelerators, moving beyond basic portability to reliable, long-running production use. It outlines three migration layers—operators, frameworks, and communication—and discusses fault tolerance, topology-aware scheduling, observability, and evaluation metrics such as MFU, scaling linearity, and Goodput. It also presents a phased rollout roadmap and common pitfalls, helping technical teams assess and build a dependable domestic compute foundation.

    1. A Necessary Choice Under Constraints: From Usable to Reliable

    For years, large-model training has depended heavily on mainstream non-domestic GPU ecosystems. These ecosystems are mature and have well-developed toolchains, but they also bring two structural risks. The first is supply-side uncertainty: procurement and delivery of advanced-process chips can fluctuate. The second is ecosystem lock-in: model code, operator implementations, communication libraries, and vendor-specific programming interfaces are deeply coupled, and migration cost rises nonlinearly with scale.

    The industry’s choice is therefore not an emotional replacement of one vendor with another, but a calm engineering judgment. Once domestic AI accelerators enter a usable range in per-card compute, memory capacity, and inter-chip interconnect bandwidth, the real bottleneck shifts from “whether the hardware can run” to “whether the software stack can run efficiently, stably, and over the long term.” This is where the value of software-hardware co-design and reconstruction lies.

    2. The Real Cost of Migration: Three Layers of Reconstruction

    Many teams underestimate the migration workload because they see the problem as “swapping a card.” In practice, adaptation involves at least three layers:

    1. Operator layer: High-performance operators in mainstream frameworks are often hand-optimized for non-domestic hardware programming models. After a platform change, many operators degrade to generic implementations, causing sharp performance drops. The operator library must be rebuilt to cover hot paths such as attention mechanisms, normalization, mixed-precision matrix multiplication, and distributed communication fusion operators.
    2. Framework layer: Device abstraction, memory pools, graph compilation, and automatic parallelism strategies must be realigned. In distributed training, tensor parallelism, pipeline parallelism, and sequence parallelism partitioning are strongly related to the hardware interconnect topology.
    3. Communication layer: The implementation of collective communication primitives depends on the specific network and topology. The efficiency of gradient synchronization and parameter-shard aggregation directly determines scaling efficiency.

    Illustrative device abstraction layer code (pseudo-code, showing design intent only):

    1. # Hide backend differences behind a unified abstraction;
    2. # business code does not need to know the specific hardware.
    3. class DeviceBackend(Protocol):
    4. def alloc(self, size: int) -> MemoryBlock: ...
    5. def run_kernel(self, name: str, tensors: list[Tensor]) -> Tensor: ...
    6. def all_reduce(self, t: Tensor, group: CommGroup) -> Tensor: ...
    7. def train_step(model, batch, backend: DeviceBackend, group):
    8. with backend.autocast(dtype="bf16"):
    9. loss = model(backend, batch)
    10. grads = backend.backward(loss)
    11. grads = backend.all_reduce(grads, group) # Communication and computation overlap is scheduled by the backend
    12. return backend.optimizer_step(grads)

    The key is to converge hardware differences behind interfaces, keep model code single-source, and avoid the iteration fragmentation caused by maintaining two branches.

    3. Cluster Engineering: The Real Challenge at 100,000-Card Scale

    At scale, the problem shifts from “performance” to “the product of stability and efficiency.”

    • Fault domain design: When the single-card failure rate is multiplied by a 100,000-card scale, the number of daily interruptions cannot be ignored. The system must provide minute-level fault detection, automatic isolation, topology-aware elastic rescheduling, and high-frequency asynchronous checkpoints (sharded to object storage or a parallel file system). Goodput—the proportion of effective training time—must be treated as the primary metric.
    • Network topology alignment: Parallel partitioning strategies should match the actual interconnect hierarchy. Communication-intensive tensor parallelism should be confined to a single node or a single switch domain, while pipeline parallelism can span domains to reduce cross-layer hops.
    • Observability: Build layered monitoring for card-level temperature, power, and memory; node-level network retransmissions; and task-level throughput and MFU. Use unified logging and alerting to locate slow nodes instead of looking only at average throughput.
    • Elastic scheduling: Use container platforms and queue-based scheduling to achieve resource isolation and priority preemption across training, fine-tuning, and inference tasks, improving overall utilization.

    4. Evaluation Methodology: Do Not Fool Yourself with Peak Compute

    Evaluate migration success using three quantifiable dimensions:

    • Single-card effective compute utilization (MFU): Actual model floating-point operations divided by hardware peak, reflecting operator and pipeline quality.
    • Scaling linearity: The throughput growth ratio when the number of cards doubles, exposing communication bottlenecks.
    • Goodput: The share of net training time after deducting failures and restarts, reflecting engineering maturity.

    Only when all three metrics meet the target can the foundation be called usable. No single peak figure constitutes a conclusion.

    5. Phased Rollout Roadmap

    1. Validation phase: Select small and medium-sized models, complete operator coverage and precision alignment, and keep loss-curve deviation from the baseline within an acceptable range.
    2. Parallel phase: Validate parallel strategies and fault-tolerance mechanisms at the thousand-card level, and produce runbooks for failure drills.
    3. Scaling phase: Run stably at more than 10,000 cards, and establish checkpoints, canary upgrades, and rollback specifications.
    4. Platformization phase: Consolidate capabilities into standardized compute services on a cloud platform, together with common capabilities such as object storage, container platforms, and monitoring and alerting, so that underlying differences are shielded.

    6. Common Pitfalls

    • Validating only that the system “can run,” while ignoring long-term stability and operations costs.
    • Maintaining two code branches for migration, which slows model iteration.
    • Using peak metrics in external communication while hiding true Goodput.
    • Neglecting talent and toolchain accumulation, and treating migration as a one-time project.

    7. Conclusion

    The significance of an independent compute foundation is not to replace a particular supplier, but to give China’s AI industry infrastructure that is selectable, evolvable, and worthy of long-term investment. The technical essence of this path is software-hardware co-design as systems engineering: operators must be rewritten, frameworks must be decoupled, clusters must be fault-tolerant, and metrics must be honest. When these engineering capabilities are consolidated into platformized general services, the uncertainty of compute supply is truly transformed into sustainable technical certainty.