Production-Grade Inference on Domestic AI Accelerators: A Practical Analysis

    This article examines what it actually takes to run frontier-scale LLM inference on domestic AI accelerators in production. Instead of comparing paper peak numbers, it breaks the question into three layers: effective per-card throughput gap, how that gap behaves under real traffic, and cost per token once hardware, racks, power, and operations are included. It explains why the bottleneck sits mainly in prefill rather than decode, how a 1.24:1 prefill-to-decode card ratio follows from the measured throughput ratios, and how long-retention KV cache scheduling (97.20% hit rate on ~98.44K-token inputs) shifts load away from the weakest stage, yielding ~277 ms median TTFT and ~137.9 tokens/s. It also covers the unit-economics calculation, a reusable acceptance checklist, and the value of open-sourcing the full production inference stack. Readers get concrete engineering practices for cache key design, prefix normalization, tiered retention, equal-SLA cost comparison, and fault-injection validation.

    1. Framing the Question Correctly: Qualified Service per Unit Cost, Not Benchmark Comparisons

    Much of the debate over whether domestic accelerators can serve top-tier large models in production stays at the level of paper peak comparisons. A more rigorous framing splits the question into three layers: how large is the gap in effective per-card throughput; does that gap widen under real traffic characteristics; and once procurement, racks, power, and operations are counted, is the cost per token competitive. Only when all three hold can we talk about “delivering service to the highest standard.”

    That “highest standard” itself needs defining. It typically includes a stable median and tail time-to-first-token, predictable output rate, no degradation under long context, and the ability to isolate faults quickly and fail back. Without this definition, no benchmark result can support a conclusion.

    2. Hardware Details: Separating the Compute Gap from the Bandwidth Gap

    One notable pattern in public data: in a bare-compute scenario without cache hits, an overseas flagship card’s prefill throughput is about 2.99x that of a domestic flagship card, and about 2.41x in the decode stage. Dividing the two yields exactly 1.24, which matches the 1.24:1 prefill-to-decode card ratio given on the deployment side.

    This derivation has three engineering implications:

    • The domestic card’s relative weakness is concentrated in prefill (compute-intensive, dominated by matrix multiplication), not decode (memory-access-intensive, constrained by VRAM bandwidth).
    • Deployment should use a heterogeneous ratio rather than a symmetric one-to-one stack, using a small number of extra prefill cards to level the waterline on both ends.
    • Prefill/decode disaggregation (PD disaggregation) delivers more visible gains on domestic clusters, because it lets the two resource types scale independently.

    Illustrative ratio derivation:

    1. r_prefill = Throughput_competitor_prefill / Throughput_domestic_prefill # ≈ 2.99
    2. r_decode = Throughput_competitor_decode / Throughput_domestic_decode # ≈ 2.41
    3. ratio_pd = r_prefill / r_decode # ≈ 1.24
    4. # Meaning: for every 1 decode card, roughly 1.24 prefill cards are needed to align both ends

    Putting imperfect raw data directly on the table is more valuable than publishing a vague “overall leadership” report, because it makes reproduction possible.

    3. Cache Scheduling: The Real Lever for Working Around the Weakness

    Real production traffic averages about 98.44K input tokens, typically from long-context Q&A and coding-oriented AI agent tasks. These workloads share one trait: highly repeated prefixes, where the same code repository or the same specification document is brought into context over and over.

    With a KV Cache retention policy exceeding 72 hours, the input cache hit rate reaches 97.20%, meaning fewer than 3% of new tokens actually need to be hard-computed per request. This shifts load away from prefill directly, avoiding the stage where domestic cards are most disadvantaged. The result: with nearly 100K-token inputs, median time-to-first-token is about 277 ms and output rate is about 137.9 tokens/s.

    Reusable engineering practices:

    • Prefix normalization: place stable content (system prompts, tool definitions, repository context) first and variable content last to maximize prefix reuse.
    • Cache key design: build the key from a content hash plus model version, quantization config, and template version to avoid a version drift invalidating everything.
    • Tiered retention: a hot tier in VRAM, a warm tier in main memory, and a cold tier in external storage, combined with prewarming and scheduled backfill.
    • Eviction policy: evict by reuse frequency rather than plain LRU, with a separate quota for long-tail large prefixes.
    1. def cache_key(prompt_prefix: str, model_ver: str, quant: str, tmpl_ver: str) -> str:
    2. h = hashlib.sha256()
    3. for part in (prompt_prefix, model_ver, quant, tmpl_ver):
    4. h.update(part.encode("utf-8")); h.update(b"\x00")
    5. return h.hexdigest()

    It is worth stressing that a high hit rate is not a free lunch: it requires the business side to accept certain template constraints, and it requires the cache service to be highly available with fast rebuild capability. Otherwise, hit-rate jitter translates directly into latency spikes.

    4. The Business Math: Per-Card Revenue Is Only the Numerator

    The observation window was set from 4 to 6 in the afternoon, yet revenue is conservatively converted at off-peak low pricing (4 CNY per million output tokens). A single card still brings in about 117.9 CNY per hour; an overseas flagship card brings in about 318.1 CNY over the same period, so the domestic card is about 37% of that.

    This means that to carry the same scale of traffic, the domestic approach needs two to three times the cards, racks, and power. Whether it ultimately pays off depends on whether the total procurement plus operations cost of the domestic cluster can be pushed down to roughly one third of the comparison approach. The recommended judgment method is fixed at three steps:

    1. Compare at equal service quality under the same SLA (TTFT P50/P99, output rate, availability), not at equal card counts.
    2. Include total cost: accelerators, general compute, networking, storage, racks, power and cooling, operations headcount, and capacity redundancy caused by failures.
    3. Output cost per effective token (CNY per million effective tokens) and run a sensitivity analysis to observe the impact of fluctuations in hit rate, input length, and output length.
    1. cost_per_mtoken = (CapEx_amortization + OpEx) / (effective_output_tokens / 1e6)
    2. # If hit rate drops from 97% to 90%, both the denominator and prefill load worsen and must be reassessed

    5. The Most Valuable Output Is Not the Data but Open-Sourced Production Code

    The biggest long-standing friction in adopting domestic chips is the gap between an “adaptation complete” announcement and real business: missing or numerically anomalous operators, mismatched multi-card communication topology, and inadequate VRAM and cache scheduling mean paper performance never converts into online throughput. Open-sourcing the full inference code that already carries large-scale production traffic socializes the cost of hitting every pitfall, so other teams do not have to rebuild from scratch.

    Parts that can typically be borrowed directly include: the PD disaggregation scheduler, continuous batching and preemption policies, KV cache tiering and migration, quantization and parallelism configuration, and observability instrumentation plus load-test scripts.

    6. An Actionable Acceptance Checklist

    • Replay real traffic rather than synthetic short requests; the input length distribution must be close to production.
    • Fix random seeds and template versions to keep comparisons valid across hardware.
    • Record P50/P99 TTFT, output rate, cache hit rate, and per-card power at the same time.
    • Run fault injection: restart the cache service, take a single card offline, inject communication jitter, and verify fail-back time.
    • Produce CNY per million effective tokens and sensitivity curves on the cost side in parallel.

    7. Conclusion

    Being two to three times behind on per-card peak is a fact, but under real traffic with long context and high prefix reuse, cache scheduling works around the weakness and both the experience and the economics balance out. Combined with the reproduction capability that open-sourced production code brings, domestic compute has entered a stage where it can confidently take on commercial traffic at scale. If the deployment side uses the general container, monitoring and alerting, and logging services of a platform such as Baidu AI Cloud for unified orchestration and observability, the engineering barrier to this rollout can be lowered further.