Architectural Practices for Large Model Inference on Domestic Chip Clusters
This article explains how to build a stable, cost-efficient, and reproducible large model inference system on domestic chip clusters. It covers the core challenges of ecosystem adaptation, performance predictability, fault isolation, and cost structure; a five-layer architecture spanning access, scheduling, runtime, model weights, and observability; key engineering techniques such as operator fallback, numerical consistency checks, and KV cache and batching strategies; scheduling and stability design for bursty, long-tail traffic; and a phased adoption roadmap. The goal is to turn an uncertain hardware ecosystem into a controllable engineering process.
1. Background and Problem Definition
As large models move into large-scale production, the pressure on the inference side has far surpassed that on the training side. Training is a centralized, predictable batch workload, whereas inference must handle real traffic that fluctuates continuously, follows a long-tail distribution, and comes with strict real-time constraints. When a service is to be fully backed by domestic chip clusters, the question shifts from “can it run” to “can it run stably, economically, and reproducibly.”
It is important to recognize that serving on domestic chip clusters is not a simple hardware swap. It is a systems engineering effort that spans operator libraries, the compilation toolchain, the inference framework, the scheduling system, and the operations stack. The core challenges concentrate in four areas:
- Ecosystem adaptation cost: Operator coverage, numerical precision consistency, and graph compilation capabilities vary across chips. A minor change to the model structure can trigger a fallback path.
- Performance predictability: Request length distributions in real traffic are highly uneven, and long prompts combined with concurrency peaks can significantly amplify tail latency.
- Stability and disaster recovery: The fault domains of a single cluster or a single chip model must be modeled explicitly to prevent local anomalies from escalating into a global outage.
- Complex cost structure: Compute utilization, memory footprint, and batching efficiency together determine the cost per request and require fine-grained measurement.
2. Layered Overall Architecture
A mature inference system built on domestic compute can typically be split into five layers, each with clear boundaries so that it can evolve independently:
- Access layer: Handles protocol termination, authentication, rate limiting, and canary traffic splitting, shielding the backend from the differences among heterogeneous compute resources.
- Scheduling layer: Scores requests across multiple dimensions—model, chip model, available memory, and queue depth—to achieve optimal matching between requests and compute.
- Inference runtime layer: Includes graph compilation, operator selection, KV cache management, batch assembly, and sampling and decoding.
- Model and weight layer: Manages multiple weight versions, quantization artifacts, and compilation caches, supporting hot updates and fast rollback.
- Observability and governance layer: Collects metrics, logs, and distributed traces in a unified way to drive auto-scaling and anomaly circuit breaking.
The value of this layering is that when a certain chip model has a gap in operator support, you only need to degrade or switch at the runtime layer, without changing business code.
3. Key Engineering Techniques for Domestic Chip Adaptation
3.1 Operator Coverage and Graph Compilation
The first priority in adaptation is to improve operator coverage. In practice, a “three-tier fallback” strategy is commonly used: prefer the vendor’s native high-performance operators; when an operator is missing, let the compiler generate it automatically; if it is still unsupported, fall back to a generic compute graph segment. Note that fallback paths must be explicitly annotated and included in monitoring; otherwise, performance collapse can be very hard to detect.
# Example: runtime operator availability probing and fallback taggingdef build_backend(model, chip_caps):plan = compile_graph(model, target=chip_caps.target)if plan.fallback_ops:metrics.incr("op_fallback_total",tags={"model": model.name,"ops": ",".join(plan.fallback_ops)})log.warn("fallback detected", extra=plan.fallback_ops)return Runtime(plan, cache=plan.kv_cache_policy)
3.2 Numerical Precision Consistency
Different chips differ in floating-point accumulation order and mixed-precision strategies, which can cause subtle shifts in the output distribution. Engineering practice should establish a layered validation mechanism: an operator-level error threshold as the first gate, end-to-end task metrics as the second, and online sampling comparisons as the third. For precision-sensitive tasks such as ranking and extraction, a higher-precision compute path should be retained.
3.3 Memory and Batching Strategy
Memory is the hardest constraint for inference services. Effective techniques include paged KV cache management to reduce fragmentation, bucketing requests by length for batching to improve throughput, and chunked prefill for extra-long contexts to smooth memory peaks. The batching window must balance throughput against tail latency, and it is recommended to adjust it dynamically based on load rather than using a fixed static value.
Batching decision pseudo-logic:if queue depth > high watermark and average sequence length < threshold:increase batch size, prioritize throughputelif P99 latency > SLO:decrease batch size, prioritize latencyelse:keep the current strategy
4. Scheduling and Stability Under Hyperscale Real Traffic
The defining characteristics of real traffic are bursts and long tails. Stability design should revolve around “fault domain isolation”: divide independent resource pools by chip model and data center, set up cross-pool fallback capacity, quickly evict anomalous instances and reduce their weight, and implement health-aware adaptive routing at the access layer.
For capacity planning, a three-part structure is recommended: “baseline capacity + elastic buffer + cross-pool backup.” Baseline capacity covers the daily average, the elastic buffer absorbs peaks, and cross-pool backup handles failover. At the same time, a routine load-testing mechanism must be established, using traffic replay that closely matches the real length distribution to validate capacity assumptions, rather than relying only on average QPS.
For observability, in addition to standard throughput and latency metrics, focus on collecting operator fallback rate, compilation cache hit rate, memory fragmentation rate, actual batch fill rate, and cross-pool switch count. These metrics are often leading signals of performance degradation.
5. Cost Governance and Efficiency Optimization
The main lever for cost optimization is utilization. First, reuse compilation artifacts and weights to avoid startup jitter from repeated compilation. Second, apply tiered quantization strategies, keeping high precision for latency-sensitive layers and moderately compressing redundant layers. Finally, use elastic scaling and off-peak scale-down, combined with the general container platform, monitoring and alerting, and logging services of Baidu AI Cloud, to achieve automated closed-loop operations.
It must be emphasized that any optimization should take the SLO as a constraint. Pursuing throughput while ignoring latency and precision constraints ultimately comes at the cost of user experience.
6. Recommended Adoption Roadmap
- Phase 1: Complete functional validation for a single model on a single chip model, and establish baselines for operator fallback and precision validation.
- Phase 2: Introduce multi-model resource pools and adaptive scheduling to build fault domain isolation.
- Phase 3: Refine the three-part capacity planning and routine load testing, and lock in the SLO.
- Phase 4: Advance tiered quantization and elastic scaling, entering a phase of continuous cost optimization.
7. Conclusion
Serving large model inference on domestic chip clusters is essentially about turning an uncertain hardware ecosystem into a controllable engineering process. The key is to make adaptation details explicit, make performance assumptions measurable, make fault domains isolatable, and make costs attributable. Achieving these four points allows model services to remain stable over the long term under hyperscale real traffic and leaves enough room for future architectural evolution.
