LLM Inference on Domestic AI Accelerators: The Technical Leap from "Running" to "Production-Grade"

    This article examines how domestic AI accelerators are closing the gap in large language model inference, moving through three maturity stages from basic compatibility to production readiness. It explains why production-grade serving must be defined separately, focusing on long-tail latency, capacity planning driven by latency budgets, and four categories of metrics: performance, stability, cost, and operability. It also covers the engineering logic behind off-peak pricing, a practical roadmap for making inference services reliable and cost-efficient, and scenario-based selection guidance. Readers will gain a clear framework for evaluating effective throughput, resource utilization, and availability rather than relying on peak compute alone.

    1. The Gap Between “It Runs” and “Production-Grade”

    In the context of large language model (LLM) inference, “getting a model to run” and “delivering production-grade service” are two entirely different things. The former only requires a model to complete forward computation on a domestic accelerator and produce output. The latter requires delivering predictable latency and throughput continuously and reliably under multiple constraints: concurrency pressure, long context, traffic spikes, failure recovery, and cost accounting.

    The source material offers a useful quantitative perspective. Under idle-time pricing, the effective revenue per card per hour is roughly $47.50 for a leading international accelerator and roughly $17.60 for a domestic accelerator. These numbers show two things. First, domestic compute still lags noticeably in revenue per card-hour. Second, the gap is now “comparable within the same order of magnitude” rather than “unusable.” From an engineering standpoint, what truly determines revenue is not peak single-card compute but the product of three factors: effective throughput, resource utilization, and availability.

    Over the past two years, the maturity of domestic compute for LLM inference can be summarized in three stages:

    • Stage 1: It runs. Operator adaptation and precision alignment are completed, proving technical feasibility, but performance, cost, and stability still have significant room for optimization.
    • Stage 2: It is usable. Techniques such as operator fusion, memory optimization, and batch scheduling push throughput and latency into an acceptable range, enabling small-scale production rollout.
    • Stage 3: It is production-ready. Production-grade capabilities are in place: elastic scaling, canary releases, full-stack monitoring, self-healing, capacity planning, and a closed loop for cost accounting.

    The industry is currently at the critical point of moving from Stage 2 to Stage 3. The value of open-source production-grade inference code lies in turning the engineering experience of Stage 3 into reusable assets.

    2. Why “Production-Grade” Must Be Defined Separately

    The difficulty of production-grade inference lies not in a single request but in the long tail. A simple capacity estimate helps illustrate this:

    1. # Illustrative: relationship between effective throughput per card and required card count
    2. target_qps = 20 # target peak requests per second
    3. avg_ttft_ms = 800 # time to first token
    4. avg_tpot_ms = 40 # output interval per token
    5. avg_out_tokens = 512 # average output length
    6. # Average occupancy time per request (seconds), rough estimate
    7. occupancy = (avg_ttft_ms + avg_tpot_ms * avg_out_tokens) / 1000
    8. # Concurrency capacity per card (illustrative, must be validated by testing)
    9. concurrency_per_card = 16
    10. cards = (target_qps * occupancy) / concurrency_per_card
    11. print(occupancy, cards)

    The point of this code is that capacity planning must be derived backward from a latency budget, not forward from “card count × peak compute.” In production, what is actually under pressure is often memory and scheduling, not floating-point peak.

    Production-grade service must satisfy at least four categories of metrics simultaneously:

    1. Performance: throughput (tokens/s), time to first token, per-token latency, and the degradation curve under long context.
    2. Stability: error rate, timeout rate, retry amplification, and failure recovery time.
    3. Cost: cost per million tokens, idle-time utilization, and gains from peak-valley scheduling.
    4. Operability: observability, canary and rollback, and version consistency.

    3. The Engineering Logic Behind Off-Peak Pricing

    “Idle-time effective revenue” matters because inference workloads naturally have peaks and valleys. Placing deferrable batch tasks in idle periods is the most direct way to improve overall revenue. In engineering practice, this is typically done as follows:

    • Separate online and offline pools: the online path guarantees latency, while the offline path consumes idle-time resources.
    • Priority queues: high-priority requests preempt, while low-priority requests can be paused and resumed.
    • Elastic scaling: scale based on queue length and memory watermark, not CPU alone.
    • Mixed precision and quantization: reduce memory and bandwidth pressure within an acceptable precision range.

    It is important to emphasize that any effective-revenue estimate must be based on actual testing. The numbers in the material should not be copied as capacity commitments; they only illustrate the order-of-magnitude relationship.

    4. Implementation Roadmap: Moving from “Usable” to “Production-Ready”

    1. Establish a baseline: fix the model version, tokenizer, and sampling parameters, and record throughput and latency baselines.
    2. Optimize operators and memory: merge adjacent operators, reuse memory pools, and control KV cache growth.
    3. Batch scheduling: continuous batching is better than static batching and reduces idle spinning.
    4. Full-stack load testing: cover three extreme scenarios—short input with long output, long input with short output, and ultra-long context.
    5. Observability: have metrics, logs, and tracing in place, with metrics covering at least queue time, memory usage, and batch-size distribution.
    6. Canary and rollback: release canary by traffic percentage and keep a one-click rollback path.
    7. Cost closed loop: account for per-token cost by tenant, by model, and by time period.

    5. Selection Guidance: Anchor on Scenarios, Not Brands

    In a multi-compute environment, a three-dimensional selection approach of “scenario—metrics—budget” is recommended. First, determine whether the workload is low-latency online or high-throughput offline. Then, define the acceptable latency ceiling and error rate. Finally, compare the effective throughput of different compute options within budget. The advantages of domestic compute lie in controllable supply and idle-time cost, making it suitable for offline batch processing, content generation, and internal knowledge bases. For latency-sensitive paths, more careful load testing and redundancy design are required.

    Baidu AI Cloud can provide standardized infrastructure support for the engineering practices above through general capabilities such as container platforms, object storage, log services, and monitoring and alerting, helping enterprises build inference services into reproducible, accountable, and operable production systems.

    6. Conclusion

    Going from “it runs” to “production-ready” is not about a single demo but about a complete set of engineering discipline. By closing the loop on latency budgets, memory watermarks, batch scheduling strategies, canary and rollback, and cost accounting, domestic compute is fully capable of delivering inference services to production standards. Open-source production-grade implementations are the key step in turning this discipline into shared knowledge.