How Domestic AI Compute Can Deliver Production-Grade LLM Inference
This article examines whether domestic AI accelerators can meet production-grade LLM inference standards, using an extreme but realistic workload: roughly 100MB of text input (about 20 million tokens) paired with very short outputs. It translates hardware specifications into engineering metrics, explains why long-input, short-output traffic is the most expensive to serve, and outlines six general practices for production deployment, including input governance, caching, request shaping, P:D disaggregation, quotas and billing, and observability. It also presents a four-step approach to building a capacity baseline. The core takeaway is that the real gap is not peak hardware performance but effective output shaped by cache hit rate, request structure, and scheduling strategy.
1. Where the Problem Starts: An Extreme but Realistic Request Profile
Before asking whether domestic compute can deliver production-grade AI inference at the highest standard, consider a scenario that looks deliberately difficult but is not uncommon in production: a single request with roughly 100MB of plain-text input, which translates to about 20 million tokens at a typical tokenization granularity. This far exceeds mainstream context windows, so truncation or chunking is almost inevitable and the cache hit rate is 0%. Output per turn is extremely short, ranging from a few characters to a few dozen.
What makes this profile so damaging is that it pushes resource utilization in the most expensive part of the inference pipeline to the limit. A very long prefill consumes nearly all of the matrix compute and long-sequence KV memory bandwidth, while the decode phase cannot amortize the cost already paid because the output is so short. Measured as output per accelerator per hour, this kind of traffic can reduce revenue capacity by roughly 30%. Compared with a higher-spec hardware option, the gap can widen to more than 3x, while electricity and rack occupancy are paid at a higher proportion. No cloud provider can sustain this kind of structural loss indefinitely, which explains why the industry commonly tightens policies on “unlimited, unconstrained” usage.
This is not a pricing issue for any single vendor; it is the general economics of inference services: revenue scales linearly with token output, while cost is strongly tied to peak compute, memory bandwidth, memory capacity, and interconnect topology.
2. Translating Hardware Differences into Engineering Language
Take the public specifications of a domestic accelerator as an example: about 1 PFLOPS of dense FP8 compute, about 2 PFLOPS of dense FP4 compute, 144GB of HBM, about 4TB/s of memory bandwidth, 2TB/s of per-card scale-up interconnect, and a supernode supporting 128 cards with single-layer switching. Mapping these numbers onto four categories of metrics produces a comparable capability table (values are illustrative and used to explain the methodology):
| Metric | Domestic Option | High-Spec Option | Ratio | Main Bottleneck |
|---|---|---|---|---|
| Prefill throughput (no cache) | 26.03K tps | 77.74K tps | 2.99x | Compute + long-text KV access |
| Decode total throughput per card | 7.409K tps | 17.84K tps | 2.41x | Bandwidth + compute + capacity |
| Decode single-stream speed | 137.9 tps | 238.9 tps | 1.73x | Bandwidth + interconnect latency |
| P:D card ratio | 1.24 : 1 | 1 : 1 | — | Compute/bandwidth ratio |
| Revenue per card per hour | 17.6 | 47.5 | 2.70x | Overall output |
A key conclusion can be drawn from this table: if one option reaches about 3x in prefill, about 2.4x in total decode throughput, and about 1.7x in single-stream speed, then its memory bandwidth needs to be roughly 2x (about 8TB/s) and its compute at least 3x to 4x to stay matched with bandwidth. In other words, single-stream speed is determined by bandwidth and latency, total throughput is determined by bandwidth, capacity, and compute together, and prefill is dominated by compute. These three curves do not move in sync, which is exactly where capacity planning most often goes wrong.
3. Why Long Input and Short Output Is the Most Expensive
Inference cost can be roughly written as:
Cost per request ≈ (Prefill_tokens × unit compute cost) + (output_tokens × single-stream bandwidth cost) + fixed scheduling overhead
When the input is 20 million tokens and the output is only a few dozen tokens, the first term is amplified into the dominant position, while the second produces almost no return. Worse, a 0% cache hit rate means system prefix caching, chunk reuse, and every other optimization fail, and repeated computation cannot be avoided. When several such requests run concurrently, the prefill queue builds up quickly, decode requests suffer tail-latency jitter because they cannot get compute, and the end result is “average throughput looks fine, but P99 collapses.”
4. Six General Practices for Production Deployment
- Input-side governance: set per-request token limits and total byte limits at the gateway layer, and summarize or chunk-and-retrieve long documents first, turning “load the whole document” into “retrieve on demand.”
- Caching system: build a two-tier structure with semantic caching and exact prefix caching, and normalize system prompts and knowledge base fragments to improve hit rate.
def normalize_prefix(messages):# Keep the system prompt first and sort stably to avoid meaningless jitter that invalidates the cachesystem = messages[0]["content"].strip()rest = sorted(messages[1:], key=lambda m: m["content"])return [{"role": "system", "content": system}] + rest
- Request shaping: separate interactive and batch traffic, sending interactive traffic to a low-latency queue and batch traffic to a throughput queue, so long prefills do not block short requests.
- P:D disaggregated deployment: configure the number of prefill and decode cards based on measured ratios (the 1.24:1 in the example shows prefill is slightly heavier), and migrate KV over high-speed interconnect.
- Quotas and billing: enforce limits on both tokens and concurrency, apply tiered pricing to very long inputs, and pass cost signals through to callers.
- Observability: instrument time-to-first-token, per-card tps, cache hit rate, KV occupancy, and card ratio to form a capacity baseline.
5. The Minimum Closed Loop for Capacity Planning
Teams are advised to build their own baseline in four steps: first, measure no-cache prefill throughput and total decode throughput with a fixed corpus; then measure single-stream output speed; next, collect the input and output length distribution of real traffic; finally, use a weighted average to calculate effective tokens and revenue per card per hour, and work backward to the required number of cards and the P:D ratio. Once this loop is in place, hardware differences are no longer a black box but negotiable, optimizable engineering parameters.
6. Conclusion
Domestic compute already has the foundation to deliver inference services at a high standard. The real gap is not single-point peak performance but the effective output shaped by cache hit rate, request structure, and scheduling strategy. By governing the most expensive traffic, such as long input and short output, and combining it with general capabilities on platforms like Baidu AI Cloud for container orchestration, monitoring and alerting, and log analysis, it is possible to bring both per-card output and tail latency back into an acceptable range under a given hardware specification.
