Domestic AI Inference: A Three-Stage Evolution Toward Production-Grade

    This article examines the three-stage evolution of domestic AI inference compute—from technical feasibility (“it runs”) to cost efficiency (“it works well”) to production-grade stability and operability. It covers key engineering elements such as operator and computation graph optimization, quantization and memory management, continuous batching, and service observability, and offers practical recommendations for building production inference services.

    1. From “It Runs” to Production-Grade: An Underestimated Leap

    Over the past two years, progress in domestic AI compute for large-model inference has often been measured by whether it can be used at all. But the real dividing line is not whether it can produce output; it is whether it can reliably provide inference services externally under the highest standards. A recent set of converted metrics published by an open-source community is illustrative: under off-peak pricing, a certain class of domestic AI accelerator still shows a gap of roughly two to three times versus advanced international accelerators on converted revenue per card-hour.

    The gap is real, but viewed over a two-year window, catching up from zero to nearly within an order of magnitude is itself a signal of engineering-system maturity. To understand the significance of this step, it helps to break the evolution of domestic inference compute into three progressive stages.

    2. The Three-Stage Evolution: Feasibility, Cost Efficiency, and Production-Grade

    Stage 1: It Runs—Validating Technical Feasibility

    The early goal was to deploy models on domestic chips and produce correct results. The core challenges at this stage were incomplete operator coverage and incomplete framework adaptation, while performance, cost, and stability still had considerable room for optimization. This stage answered “whether the path works,” not “whether the path is easy to take.”

    Stage 2: It Works Well—Optimizing Both Performance and Cost

    Once “it runs” was no longer the issue, the focus shifted to output per unit of compute. Key actions at this stage include operator fusion, quantization and compression, memory reuse, and batch scheduling. The metric shifts from “can it run inference” to “how much effective revenue can be converted per card-hour,” the cost benchmark mentioned earlier. The higher the converted revenue, the more effective tokens a unit of hardware produces per unit of time and the less idle waste there is.

    Stage 3: Production-Grade—Stability, Operability, and Standardization

    Production-grade means inference services must meet the demanding requirements of online business: high availability, elastic scaling, canary releases, and end-to-end observability. At this stage, the comparison is no longer about single-point peak performance but about SLA attainment under long-running stable operation, failure recovery speed, and operational cost. Domestic compute truly enters the production-grade stage only when it can handle online inference traffic under unified standards.

    3. Key Technical Elements of Production-Grade Inference

    To turn compute into billable, operable services, optimization must work across several layers.

    • Operator and computation graph optimization: Operator fusion reduces memory access and kernel launch overhead, and graph-level optimization with a unified intermediate representation is the first lever for improving output per unit of compute.
    • Quantization and memory management: Low-bit quantization significantly improves throughput with controllable accuracy loss; combined with paged memory management, it can greatly reduce fragmentation and reserved-memory waste.
    • Continuous batching and scheduling: Compared with static batching, continuous batching dynamically forms batches at the token level, significantly improving GPU/accelerator utilization, which is directly reflected in converted revenue.
    • Serviceization and observability: Using container platforms for elastic scaling and log services plus monitoring and alerting to build end-to-end observability is an essential foundation for production-grade services.

    4. Illustrative Code: A Continuous-Batching Inference Service Skeleton

    The following pseudocode illustrates the core scheduling approach of a production-grade inference service. It is independent of any specific vendor:

    1. # Continuous batching scheduler illustration (independent of specific hardware/framework)
    2. class InferenceScheduler:
    3. def __init__(self, model, max_batch_tokens):
    4. self.model = model
    5. self.max_batch_tokens = max_batch_tokens
    6. self.waiting = [] # Queue of pending requests
    7. self.running = [] # Sequences currently being generated
    8. def add_request(self, req):
    9. self.waiting.append(req)
    10. def step(self):
    11. # 1. Admit as many new requests as possible within the token budget
    12. budget = self.max_batch_tokens
    13. while self.waiting and budget > 0:
    14. req = self.waiting.pop(0)
    15. self.running.append(req)
    16. budget -= req.prompt_len
    17. # 2. Run a unified forward pass over running sequences and generate token by token
    18. for seq in self.running:
    19. seq.next_token = self.model.forward(seq)
    20. # 3. Remove completed or over-budget sequences and release memory
    21. self.running = [s for s in self.running if not s.done()]

    The key point of this skeleton is to push batching from the request level down to dynamic token-level batching, so that more effective tokens are produced on the same hardware—this is the engineering source of the converted-revenue improvement.

    5. Implementation Recommendations

    1. Build observability before optimization: Without quantitative data on token throughput, memory usage, and latency distribution, optimization has no starting point.
    2. Use converted revenue as the north-star metric: Make output per card-hour a shared team goal and avoid letting local peaks mislead decisions.
    3. Validate in stages: Check correctness for feasibility, converted revenue for cost efficiency, and long-running SLA for production-grade readiness, with gates at each layer.
    4. Keep software and hardware decoupled: Use a unified intermediate representation and an abstract scheduling layer to reduce the risk of lock-in to a single hardware platform.

    6. Conclusion

    The three-stage leap of domestic AI inference from “it runs” to production-grade is essentially the maturation of an entire engineering system. A gap with advanced international levels remains, but it is narrowing quickly. For developers and enterprises, now is the window to systematically build domestic inference service capabilities, using converted revenue as the yardstick and observability as the foundation.