LLM Inference Deployment on Domestic AI Accelerators: Selection and Migration Practices
This article presents a vendor-neutral framework for selecting domestic AI accelerators for large language model inference and migrating an existing inference stack to a new compute backend. It explains why inference hardware selection differs from training, breaks evaluation into five dimensions (operator coverage and graph compatibility, numerical accuracy, memory capacity and bandwidth, software stack maturity, and ecosystem and staffing costs), outlines a six-step migration process, and lists common pitfalls along with a troubleshooting checklist. Readers will gain a practical methodology for controlling performance and accuracy risk during backend replacement.
1. Why Inference Chip Selection Is Harder Than Training
A clear trend of the past two years is that large model engineering teams have shifted their attention from “can we train it” to “can we serve it reliably and cheaply.” In that shift, compute selection for inference deployment has moved to the foreground, and domestic accelerators have gone from being a fallback option to a mandatory question.
Inference and training place different demands on hardware. Training is throughput-driven, extremely sensitive to interconnect bandwidth, and runs long-lived tasks. Inference is constrained more by per-request latency, memory capacity, and memory bandwidth, while traffic shows pronounced peaks and troughs. This leads to a counterintuitive conclusion: an accelerator that performs well on a training cluster will not necessarily deliver the same cost-performance in inference. So the discussion around “whether a given class of domestic accelerator is suitable for LLM inference” is fundamentally a systems engineering problem, not a simple comparison of hardware specifications.
Note that this article does not benchmark or recommend any specific vendor’s chips or frameworks. Instead, it abstracts this kind of migration into the industry-standard methodology for adopting heterogeneous computing: how to replace the compute backend of an existing inference stack while keeping performance and accuracy risk within acceptable bounds.
2. Evaluation Framework: Five Dimensions That Determine Migration Feasibility
2.1 Operator Coverage and Graph Compatibility
The computation graph of LLM inference consists of attention, normalization, element-wise operations, matrix multiplications, and various fused operators. Domestic backends typically ship their own graph representation and compilation pipeline, so the first step is not benchmarking but checking whether the graph can be fully lowered. In practice, export the model to an intermediate representation first, then measure the proportion of operators that fall back when targeting the new backend.
A typical fallback report script looks like this (pseudocode, conveying the idea only):
report = compiler.profile_fallback(model_ir, backend="domestic_accelerator")print(report.total_ops, report.fallback_ops)for op, cnt in report.fallback_by_type.items():print(f"{op}: {cnt}")
If the fallback operators concentrate in a few hot spots (such as the attention kernel or normalization), they can usually be filled in with custom operators. If fallbacks are scattered across dozens of small operators, migration cost rises sharply, and the expected return should be re-evaluated.
2.2 Numerical Accuracy and Result Consistency
Backends differ in floating-point accumulation order, mixed-precision strategy, and handling of denormal numbers, which causes small drift in outputs. The more reliable engineering approach is to build a layered alignment baseline: align single-layer outputs first, then subgraphs, and finally end-to-end logits, with quantifiable tolerance thresholds rather than subjective “looks fine” judgments.
2.3 Memory Capacity and Memory Bandwidth
The decode phase is a memory-bound workload, and the KV cache grows linearly with context length and concurrency. The evaluation must take “maximum context × concurrency” as an input and account for memory footprint and the bandwidth ceiling; otherwise it is easy to pass load tests and fail immediately after launch. A common practice is to give an analytical estimate of memory usage and then calibrate it with measurements:
kv_bytes ≈ 2 × layers × kv_heads × head_dim × seq_len × batch × bytes_per_elem
The factor of 2 accounts for the two caches, keys and values. This formula is product-agnostic and is a general capacity estimation method.
2.4 Software Stack Maturity and Observability
Compiler error readability, profiling tools, and how logs and monitoring alerts are integrated often affect delivery timelines more than peak compute does. During selection, verify that operator-level timing can be collected, that memory timelines are available, and that integration with the existing monitoring and alerting system is possible.
2.5 Ecosystem and Staffing Costs
Whether the team can write custom operators, how complete the community and documentation are, and how long issue response takes all translate into real costs. Migration is not a one-off project but a long-term maintenance responsibility.
3. Migration Path: A Standard Six-Step Process
- Lock the baseline: On the existing backend, pin the model version, precision configuration, input distribution, and load test scripts, producing a reproducible performance and accuracy baseline.
- Offline compilation validation: Complete graph conversion and compilation, collect the list of fallback operators, and address hot operators first.
- Operator and subgraph alignment: Compare layer by layer using the tolerances above to locate the source of drift.
- End-to-end accuracy regression: Use a fixed corpus and a fixed random seed, and compare output distributions rather than individual samples.
- Performance load testing and tuning: Cover different input lengths and concurrency levels, watch both the time-to-first-token and steady-state throughput curves, and adjust batching and caching strategies when needed.
- Canary rollout and rollback plan: Shift traffic gradually at a small percentage, keep the ability to switch back to the old backend with one action, and configure monitoring alert thresholds and automatic rollback triggers.
4. Common Pitfalls and Troubleshooting Checklist
- Looking only at peak compute: Ignoring bandwidth and cache hierarchy, so actual throughput falls far below expectations.
- Unrealistic load test input distribution: Load testing with uniform short inputs, then losing control of latency in long-context scenarios after launch.
- Deferring accuracy work: Leaving alignment to the end, so defect localization cost grows exponentially.
- No rollback design: Coupling migration with stability validation, leaving no way to limit damage quickly during an incident.
- Missing capacity estimation: Memory overflow after concurrency increases, triggering cascading restarts.
When troubleshooting, fix three things: the input, the random seed, and the compiler options. Once those three are fixed, the vast majority of performance and accuracy anomalies can be reproduced reliably, which is the most time-saving lesson in debugging heterogeneous backends.
5. Recommendations for Decision Makers
The benefits of migrating inference to domestic compute backends come mainly from supply controllability and long-term cost structure, while the costs concentrate in one-time engineering investment and ongoing maintenance. A sound strategy is “run two backends in parallel and tier by workload”: keep mature backends on core paths, migrate new and offline workloads first, and expand the proportion after accumulating an operator library and tuning experience. If an organization already uses general capabilities such as the container platform, object storage, logging service, and monitoring and alerting offered by Baidu AI Cloud, the canary, rollback, and observability steps above can be implemented directly, reducing the burden of building infrastructure in-house.
