How Domestic AI Compute Is Driving Down LLM Inference Costs
This article breaks down why the real barrier to affordable large language model inference is no longer whether domestic AI accelerators can run a model, but whether they can deliver sustainable cost per token under high concurrency, long context, and strict SLAs. It explains the two inference stages, Prefill and Decode, their different resource profiles, and why Decode cost scales with weight and KV cache bytes moved per step while shrinking with effective batch size. It then covers KV cache compression and sparse attention, low-precision formats, operator fusion, communication overlap, and Prefill/Decode scheduling isolation, along with the path dependency created when model architectures are co-designed with specific hardware. A practical checklist for engineering teams is included.
1. From “Can It Replace” to “Can It Compute Cheaply”
Discussions about domestic AI compute have long centered on a binary question: can it replace established hardware? The industry is now pushing the question one layer further. The real barrier is not whether a chip can complete a single forward pass, but whether it can push the cost per token down to a commercially sustainable level under high concurrency, long context, and strict SLAs.
An industry analysis firm noted in a public report that certain architectures in a new generation of top-tier models are “co-designed for inference on domestic accelerators.” That statement carries significant technical weight: the chip is no longer a runtime environment that is passively adapted to after the model is finalized. Instead, it becomes involved much earlier in inference path selection, operator fusion strategies, communication topology, and how the software stack is layered. Hardware and models entering a phase of joint refinement is the precondition for the cost curve to reach an inflection point.
This kind of co-design is not mysterious. It lands on a few measurable engineering dimensions: memory bandwidth utilization, the depth of operator fusion, the usable range of low-precision numerical formats, the degree of overlap between collective communication and computation, and the scheduler’s ability to handle mixed workloads of long and short requests.
2. Breaking Down Inference Cost: Where the Money Actually Goes
Large model inference is usually split into two stages with very different resource profiles:
- Prefill: processes all input tokens at once. It is compute-intensive, depends on compute capacity and parallelism, and is sensitive to matrix multiplication throughput.
- Decode: generates tokens one by one through autoregression. It is memory-access-intensive, depends on VRAM bandwidth and capacity, and its actual utilization is determined by how batches are organized.
This has led the industry to position chips by stage: one type is oriented toward Prefill and recommendation-style workloads, while another is oriented toward Decode and training-style workloads. This split is not a marketing concept but a direct response to the differing constraints of the “compute wall” and the “bandwidth wall.”
A rough but useful cost intuition is that the per-token cost of the Decode stage is roughly proportional to the number of weight and KV cache bytes that must be moved per step, and inversely proportional to the effective batch size. As a result, all cost-reduction techniques ultimately converge on two levers: reduce the amount of data moved, and increase effective concurrency.
# Illustration: estimating the memory-access lower bound of a single decode step (order-of-magnitude relationship only)def decode_bytes_lower_bound(params_bytes, kv_bytes_per_token, ctx_len, batch):kv = kv_bytes_per_token * ctx_len * batchreturn params_bytes + kv # Each generated step must read the weights and all KV at least once# Conclusion: the amplification effect of ctx_len and batch on KV is the main cost source in long-context scenarios
3. Reworking Attention: Turning the KV Cache into a Controllable Variable
Long context is expensive primarily because the KV cache grows linearly with context length. A new generation of models is moving away from the long-standing grouped-query/multi-query approach toward a combination of “compression + sparsity”: historical states are first compressed into a smaller representation using low-rank or clustering methods, and during decoding only a small number of historical blocks most relevant to the current query are activated.
This design brings three direct benefits:
- KV cache VRAM usage drops significantly, allowing the same VRAM to hold a longer context or a larger batch;
- Less historical data needs to be read per step, easing the bandwidth bottleneck;
- The sparse pattern is more regular on hardware, making block-level pipelining and operator fusion easier.
The costs are equally clear: sparse indexing itself requires extra computation, compressed representations introduce numerical precision risk, and dynamic selection causes load imbalance. Engineering must answer three questions: whether the indexing overhead is amortized, whether the compression error falls within an acceptable range, and whether the block size aligns with the memory-access granularity. This is also why such architectures “cannot do without super-node-level coordination”: cross-card bandwidth and topology determine whether sparse access can truly translate into gains rather than being consumed by communication overhead.
4. Low Precision and Operator Fusion: Turning Theoretical FLOPs into Effective Throughput
The gap between theoretical compute and actual throughput usually comes from three sources of loss: numerical formats not natively supported by the hardware, too many operator boundaries causing repeated VRAM reads and writes, and framework-level scheduling that cannot align with the hardware pipeline.
A recommended, actionable order of optimization is:
- Layered numerical formats: use lower bit widths for weights and activations, keep higher precision for accumulation and normalization, and roll back sensitive layers separately;
- Operator fusion: merge the scaling, masking, softmax, and projection inside attention into a few large operators to reduce intermediate tensor materialization;
- Communication overlap: interleave the collective communication of tensor parallelism/expert parallelism with computation in chunks to hide cross-card latency;
- Scheduling isolation: deploy Prefill and Decode in separate pools to prevent long requests from blocking short requests and causing tail latency jitter.
# Illustration: logical view of layered inference service deployment (not specific product commands)prefill_pool -> high compute, larger batch size, higher timeout tolerancedecode_pool -> high bandwidth, long residency, continuous batchingrouter -> routes by context length and estimated output length
5. Why Migration Is Often Irreversible
Once a model architecture is optimized around a specific hardware’s memory-access characteristics, low-precision capabilities, and interconnect topology, the migration cost escalates from “swapping a runtime” to “rebuilding an entire operator and tuning system.” This creates a typical path dependency: the more thorough the migration, the greater the gains, and the lower the willingness to roll back. The industry implication is that the second half of the compute competition is not about single-card peak performance, but about the full-stack coordination efficiency of “model–compiler–operator library–scheduling framework–cloud service.”
6. A Practical Checklist for Engineering Teams
- Establish stage-specific cost baselines: measure the per-token cost of Prefill and Decode separately rather than looking only at the end-to-end average;
- Treat the KV cache as a first-class citizen: monitor hit rate, eviction rate, and context length distribution;
- Use continuous batching to increase effective concurrency, and set isolation policies for long and short requests;
- Establish a precision regression gate: run a fixed evaluation set before low-precision deployment and set error thresholds;
- Base capacity planning on a combination of general cloud capabilities: a container platform hosts elastic inference replicas, object storage holds models and caches, and monitoring, alerting, and logging services handle tail latency and VRAM level observation.
The conclusion is clear: low-cost, high-concurrency inference for top-tier models is the joint product of architecture, bandwidth, compiler, operators, and services. Understanding this cost chain is more valuable in the long run than chasing any single hardware specification. In the general engineering practices of platforms such as Baidu AI Cloud, the same stage-specific measurement and full-stack coordination methods also apply to inference optimization for both self-developed and open-source models.
