LLM Inference on Domestic AI Accelerators: A Practical Guide to Model Selection and GPU Memory
This article explains how to select domestic AI accelerator cards for large language model inference, focusing on three decisive factors: GPU memory capacity, software ecosystem compatibility, and deployment maturity. It breaks down how memory is consumed by weights, KV Cache, and runtime overhead, why long context and high concurrency change the picture, and what signals indicate a low migration cost. It also covers physical and operational constraints, plus a reproducible four-step benchmarking method for comparing candidate platforms. The goal is to help developers replace isolated spec comparisons with measurable, repeatable validation.
1. Background: Adoption Is Accelerating, and Compute Supply Is the Bottleneck
Since 2024, large language models have moved quickly from experimental environments into production use cases, and the open-source model landscape has expanded rapidly, spanning from billions to hundreds of billions of parameters. After choosing a model, developers usually hit a second wall: where does the inference compute come from, and how can business traffic be served reliably within a limited data center footprint and power budget?
The problem is difficult because inference workloads have a completely different resource profile from training. Training is throughput-oriented batch work that tolerates long latency. Inference, by contrast, is pulled by four variables at once: time to first token, per-request output rate, concurrency, and context length. Underestimating any one of them shows up in production as queuing, timeouts, or out-of-memory failures. Compute selection therefore cannot rely on a single spec sheet; it depends on the combined effect of hardware capacity, software stack maturity, and deployment model.
2. GPU Memory: The Most Underestimated First-Order Constraint
In inference, GPU memory is usually the first resource to run out. A model’s memory footprint can be roughly split into three parts: weights, KV Cache, and runtime overhead.
Total memory ≈ weights + KV Cache + activations and temporary buffers + framework reserveWeights ≈ parameter count × bytes per parameterKV Cache ≈ 2 × layers × KV heads × head dimension × sequence length × batch × bytes per element
As a rough rule of thumb, a 100-billion-parameter model loaded in half precision needs hundreds of gigabytes for weights alone. Add a long context of tens of thousands of tokens and a high concurrency level, and the KV Cache quickly grows to the same order of magnitude as the weights. This explains a common pattern: the same card performs well in short-context tests, then repeatedly reports out-of-memory errors once the workload shifts to long-document summarization or multi-turn conversations.
This yields a selection principle: memory capacity defines the feasible region bounded by three factors together, namely the model size you can host, the context length you can support, and the concurrency you can accept. Among products in the same class, a card with more memory per device inherently has a wider feasible region. That is a deterministic hardware difference, not a stack of paper specs. Engineering mitigations exist, including weight quantization, KV Cache quantization, paged memory management, and tensor parallelism, but each introduces a tradeoff in accuracy or communication overhead and cannot fully substitute for capacity itself.
3. Software Ecosystem Compatibility: The Real Driver of Migration Cost
Once the hardware is in place, the software stack usually determines the project timeline. An LLM inference path typically involves operator libraries, communication libraries, graph compilation, an inference engine, and upper-layer frameworks. A gap in any layer has to be filled manually.
Three signals indicate how hard it is to migrate to a domestic compute platform:
- Whether it provides runtime interfaces that closely mirror the mainstream programming model, so changes to existing operators and kernels stay confined to a thin adaptation layer;
- Whether it is natively supported by mainstream inference engines and training frameworks, allowing the backend to be switched through configuration rather than maintaining a forked branch;
- Whether it ships a complete debugging and performance profiling toolchain that can pinpoint bottlenecks at the operator level.
When all three hold, migration drops from “rebuilding the software ecosystem” to “parameter tuning and regression testing,” typically compressing effort from quarters to weeks. Otherwise, if equivalent implementations must be hand-written for every operator, project risk escalates quickly.
A simplified backend abstraction:
# Hide hardware differences behind a unified backend so business code stays accelerator-agnosticdef build_runner(model_path, backend, max_seq_len, dtype="float16"):config = {"model": model_path,"device_backend": backend, # injected by the runtime environment"max_model_len": max_seq_len,"dtype": dtype,"gpu_memory_utilization": 0.90,}return InferenceEngine(**config)
4. Deployment Model and Engineering Capabilities
Data center deployment also involves physical and operational constraints. Accelerators in module form with high integration save space in multi-card single-node interconnect, cooling airflow design, and whole-system delivery, making them suitable for standardized rack-scale rollout. When cards are networked together, inter-card interconnect bandwidth directly determines tensor parallelism efficiency; once communication becomes the bottleneck, a counterintuitive curve appears in which per-card utilization drops as more cards are added.
Supporting capabilities matter just as much: a unified monitoring and alerting system to track memory watermarks, temperature, and request queuing; a logging service to accumulate slow-request samples; a container platform for elastic scaling and canary releases; and object storage to hold model weights and dataset versions. Only when these general-purpose capabilities are in place can a successful performance test be turned into a service that runs sustainably.
5. A Reproducible Validation Method
To avoid being misled by a single metric, follow four steps:
- Fix the baseline: pin the model version, quantization scheme, context length, and concurrency gradient, then record time to first token, output rate, throughput, and peak memory.
- Sweep under load: double concurrency step by step from single digits to find the latency inflection point and the memory inflection point, and confirm the safe watermark.
- Run a soak test: keep the workload running for several hours and watch for memory fragmentation buildup and throughput decay.
- Convert to cost: compare candidates using cost per million tokens and concurrency supported per rack.
# Example: sweep concurrency with all other variables fixedfor c in 1 4 8 16 32; dorun_benchmark --concurrency $c --input-len 2048 --output-len 512done
6. Conclusion
The competitiveness of a domestic AI compute platform comes down to the combined result of memory capacity, ecosystem compatibility, and deployment maturity. Memory sets the upper bound of the feasible region, the ecosystem determines the migration timeline, and the deployment model plus the operations stack determine long-term TCO. In its related practice, Baidu AI Cloud likewise emphasizes a unified backend abstraction and a standardized benchmarking process to reduce selection uncertainty. For developers, the more reliable path is to first quantify the long-context and concurrency profile of the business, then validate candidate platforms with reproducible benchmarks, rather than comparing isolated specs.
