Domestic AI Compute for Inference: Why Open Source Code Matters More Than Peak FLOPS
This article examines whether domestic AI accelerators can deliver production-grade LLM inference by looking past single-card benchmarks. Using a public production observation, it breaks down Prefill and Decode throughput, shows how prefix caching and KV Cache retention reshape workloads, and converts latency and throughput into a unit economics model. It also explains why open-sourcing the full production inference stack is more valuable than benchmark claims, and outlines a reproducible evaluation method based on real traffic replay.
1. Asking the Right Question: Not “Have They Caught Up?” but “Does the Math Work?”
Public debate over whether domestic compute can deliver AI inference at the highest standard often falls into a binary split. One side looks at paper peak throughput and sees a gap of two to three times. The other looks at the live user experience and concludes it is already good enough. Both judgments are correct, yet neither is sufficient to support a procurement decision. What engineering actually needs to answer are three quantifiable questions: how large is the effective per-card throughput gap, is that gap offset by the request structure, and after the offset, does the cost per token fall within an acceptable range.
A public production observation offers a useful sample. A domestic accelerator card was compared against an overseas flagship card on the same model and the same service level. The raw compute gap excluding cache hits was clear, but under real live traffic the end-to-end experience did not fall behind, and each card still generated meaningful revenue per hour. Reading these three sets of numbers together, the conclusion is not “which one is stronger” but “under what traffic shape domestic compute already has commercial carrying capacity.”
2. Breaking Down Raw Compute: Prefill and Decode Are Two Different Resources
Inference workloads are usually split into two phases. The Prefill phase processes all input tokens at once; it is compute-intensive and consumes compute. The Decode phase generates tokens autoregressively one at a time; it is memory-intensive and consumes memory bandwidth. Because the bottlenecks differ, a single “combined benchmark score” cannot capture the picture.
In this sample, the overseas flagship card’s Prefill throughput was about 2.99 times that of the domestic card, and Decode was about 2.41 times. Dividing one by the other yields 1.24, which corresponds exactly to the domestic card’s 1.24:1 P:D card ratio. This number is self-consistent and informative: it shows that the domestic card’s relative weakness is concentrated on the compute side rather than the bandwidth side, so deployment needs slightly more Prefill nodes to level the waterline across the two phases.
The engineering takeaway is direct: capacity planning cannot apply a flat “card count” rule, but should be calculated separately by P:D ratio. An illustrative capacity estimation logic is shown below (values are for structural demonstration only):
# Illustrative calculation structure only, not real parametersprefill_nodes = ceil(target_prefill_tokens / per_node_prefill_throughput)decode_nodes = ceil(target_decode_tokens / per_node_decode_throughput)# If per_node_prefill is relatively low, prefill_nodes becomes the bottleneck firsttotal_nodes = prefill_nodes + decode_nodes
It is worth acknowledging that the imperfect data was laid out in full, rather than publishing only a vague “overall lead” report. For people doing selection, decomposable per-phase data is more useful than a single aggregate score.
3. Cache Scheduling: The Real Lever for Working Around the Compute Gap
The sample traffic had an average input length as high as about 98.44K tokens, typical of heavy long-context and AI coding tool traffic. The defining feature of these requests is highly repetitive prefixes: the same code repository, the same long document is fed into the model repeatedly.
Relying on KV Cache retention of more than 72 hours, the input cache hit rate was pushed to 97.20%, meaning that each request actually needed to hard-compute fewer than 3% new tokens. The Prefill compute disadvantage was therefore heavily diluted. The result was that with nearly a hundred thousand tokens of input, the median time to first token was compressed to 277 milliseconds and output speed was about 137.9 tokens/second—more than enough for the perceived smoothness of interactive and Agent-type tasks.
The key insight here is that cache hit rate is not a runtime accident, but a product of architecture and scheduling strategy. The engineering points that can be implemented include:
- Prefix normalization: place system prompts, tool definitions, and fixed context at the front in a stable order, avoiding dynamic content inserted into the middle of the prefix that breaks reuse.
- Cache tiering and eviction: memory, main memory, and optional external storage form a hierarchy, combined with an eviction strategy based on remaining lifetime and reuse probability, rather than simple LRU.
- Session affinity routing: route the same session to the same instance as much as possible to reduce cache migration; cross-instance shared cache needs evaluation of network and serialization overhead.
- Observability: make hit rate, average reuse depth, and eviction rate first-class metrics; a drop in hit rate often appears before latency degradation.
It should be noted that a 97% hit rate depends heavily on traffic shape. If the business is short-input, low-repetition conversation, the hit rate will fall significantly, the Prefill weakness will resurface, and both the P:D ratio and total card count must be recalculated.
4. Unit Economics: Converting Experience into Money
The sample observation window was chosen from 4 p.m. to 6 p.m., but revenue was conservatively converted at off-peak low prices (output at 4 RMB per million tokens), and each card could still collect about 117.9 RMB per hour; however, this figure is only about 37% of the overseas flagship card (corresponding to about 318.1 RMB). This means that to carry the same traffic, card count, racks, and power overhead all have to rise by two to three times.
The decision therefore converges to an inequality:
Total domestic cost ≈ 2.5 × per-card procurement + 2.5 × rack and power + operations laborIf total domestic cost ≤ 0.33 × competitor total cost → the math worksOtherwise → only valid in specific scenarios
So “whether it is worth it” is not a chip question, but a total cost of ownership question for the cluster. A practical accounting checklist should cover: accelerator cards and supporting network procurement, racks and power/cooling, memory and storage expansion needed for deep caching, operations labor and failure rate, and the revenue elasticity brought by cache hit rate fluctuations. Converting revenue at off-peak prices is a conservative but more credible method.
5. More Valuable Than Data: Open-Sourcing Production-Grade Code
The biggest friction in the past for domestic chip adoption was the gap between “adaptation completed” announcements and actual business runs: missing or numerically unstable operators, multi-card communication topologies that could not be brought up, no usable implementation for memory and cache scheduling, and paper performance that could not translate into live throughput. The long-tail cost of adaptation work was often several times the hardware itself.
Open-sourcing the entire inference service code that has withstood large-scale live traffic makes this implicit knowledge explicit: parallel strategy partitioning, communication and overlap, paged cache management, continuous batching and preemption, quantization and operator fallback paths, and load testing and canary methods. Other teams do not have to step into the same pits from scratch; the reproduction path is compressed to “deploy—load test—tune parameters.”
6. A Reproducible Evaluation Method
It is recommended to self-test with a unified method rather than trusting any single leaderboard:
- Replay real business traffic, preserving the original input length distribution and prefix repetition characteristics.
- Measure Prefill and Decode throughput separately by phase, recording them separately rather than merging into a single metric.
- Report the full latency distribution (P50/P90/P99 and time to first token), not the mean.
- Record cache hit rate, memory usage, and eviction rate at the same time, to explain throughput fluctuations.
- Output a unit economics model: cost per million tokens, revenue per card per hour, and the number of cards needed to meet the target SLA.
7. Conclusion
There is still a gap in raw single-card strength in the short term, and that is a fact. But in high-concurrency inference scenarios with long context and high prefix reuse, cache scheduling shapes the workload into a form that domestic compute is better at, so both experience and the numbers hold up at the same time. The real watershed is engineering reproducibility: when production-grade implementations are made public, the selection discussion can shift from “benchmark comparison” to “total cost of ownership accounting.” For teams preparing to deploy, the pragmatic path is to first establish a baseline with real traffic replay, then do capacity planning by P:D ratio and cache hit rate, and finally make decisions based on total cost rather than single-card metrics.
