Chinese Open-Source LLM Inference Deployment: Model Selection and Implementation
This article explains how to select and deploy Chinese open-source LLMs for inference in production. It covers inference microservices, task-based evaluation, hosted API versus private deployment, total cost of ownership, gateway architecture, operational safeguards, and strategies for managing multiple models.
Chinese Open-Source LLM Inference Deployment: Model Selection and Implementation
1. Starting with the “Model Marketplace”: Understanding Inference Microservices
Before discussing specific model choices, it is worth clarifying a foundational concept: inference microservices.
As the large model ecosystem matures, the industry has gradually developed a standardized service model: pretrained or fine-tuned models are packaged as out-of-the-box inference services. Developers do not need to manage underlying compute scheduling, model loading, memory management, request queuing, or other complex details. They simply call a standardized API to obtain inference capabilities.
The essence of this model is a “model marketplace”:
- Items on the shelf: various open-source models, including general chat models, code models, multimodal models, and lightweight edge models. These include open-weight models widely used by the international community as well as Chinese open-source models that have risen rapidly in recent years.
- Unified billing: charging by call volume, usually input and output tokens, or by instance duration.
- Logistics and after-sales support: the cloud platform handles elastic scaling, high availability, version upgrades, monitoring, and alerting.
In recent years, Chinese open-source LLMs have continued to improve on public benchmark leaderboards. Some flagship models have reached the top tier in dimensions such as code generation, general reasoning, and long-text processing, and they have appeared on mainstream inference service platforms. This means developers now have significantly more options, but it also raises a new question: when multiple models have similar capabilities, how should you select and implement them scientifically?
2. Core Evaluation Dimensions for Model Selection
2.1 Capability Fit: Define the Task First, Then Look at Models
The first step in model selection is not to look at leaderboards, but to clarify your own business task types. Different models may vary greatly in performance across different tasks:
- Code generation and engineering assistance: focus on code completion accuracy, cross-file context understanding, and multilingual support.
- General chat and knowledge Q&A: focus on instruction-following ability, semantic understanding, refusal behavior, and safety alignment.
- Long-text processing: focus on effective context length, recall, and reasoning degradation under long contexts.
- Agents and tool calling: focus on the stability of function-calling formats and the reliability of multi-turn tool orchestration.
Practical advice: do not look only at comprehensive leaderboards; look at task-specific leaderboards. More importantly, do not rely only on leaderboards; run your own evaluation set. Comprehensive leaderboards reflect a model’s average performance on public datasets, while real business data distributions often differ. Building an internal evaluation set containing 50 to 200 typical business samples is the model-selection action with the highest return on investment.
2.2 Deployment Form: API Calls vs. Private Deployment
| Dimension | Hosted API Service | Private Deployment |
|---|---|---|
| Startup cost | Low; register and use | High; requires your own compute and operations |
| Data compliance | Data leaves your environment; compliance risks must be assessed | Data is fully controlled; suitable for sensitive scenarios |
| Customization space | Limited; usually only prompt and parameter adjustments | Supports fine-tuning, quantization, and deep optimization of inference engines |
| Elasticity | Platform scales automatically | Capacity must be planned by yourself |
For data-sensitive enterprises in finance, healthcare, government, and other fields, private deployment is often a hard requirement. For startup teams and rapid validation scenarios, hosted APIs are a more agile starting point. The two are not mutually exclusive. Many teams adopt a two-stage strategy: first validate with hosted APIs, then migrate to private deployment.
2.3 Cost Structure: Calculate the Total Cost of Ownership
The cost of model services goes far beyond API unit price. A complete cost ledger includes:
- Inference call cost: input and output token billing, estimated based on the average length of real requests.
- Compute cost for private deployment: GPU instance costs and the concurrency ceiling determined by memory usage.
- Engineering cost: integration changes, prompt engineering, evaluation system development, and fallback handling.
- Migration cost: regression testing and interface adaptation when models are upgraded or vendors are changed.
One commonly overlooked point is quantization and throughput optimization. After INT8 or INT4 quantization, the inference cost of the same model may drop significantly, but you need to assess whether the capability loss caused by quantization is acceptable for the business.
3. Key Deployment Architecture Points
3.1 Typical Access Architecture
A standard production practice is to add a gateway layer between the business side and the model service:
# Example: use a unified gateway to abstract underlying model differencesclass LLMGateway:def __init__(self):self.providers = {"primary": "https://llm-gateway.internal/v1","fallback": "https://llm-gateway-backup.internal/v1",}async def chat(self, messages, model="default"):try:return await self._call(self.providers["primary"], messages, model)except TimeoutError:# Primary model timed out; automatically fall back to the backup modelreturn await self._call(self.providers["fallback"], messages, model)
This design brings three benefits:
- Model replaceability: changing the underlying model only requires adjusting gateway configuration, with zero changes to business code.
- Fault-tolerant fallback: automatically switch when the primary model service fails, ensuring availability.
- Unified observability: request logs, latency statistics, and cost accounting are centralized at the gateway layer.
3.2 Key Engineering Support
- Rate limiting and queuing: LLM inference is a resource-intensive operation. Use token bucket rate limiting to protect the backend and handle long requests asynchronously.
- Streaming output: time to first token (TTFT) directly affects user experience, so streaming responses should be enabled.
- Caching strategy: for high-frequency repeated requests such as fixed scripts and common questions, introduce semantic caching or exact caching to significantly reduce costs.
- Monitoring and alerting: integrate with logging and monitoring systems. Core metrics include QPS, P95 latency, error rate, and token consumption.
4. Practical Strategies for Running Multiple Models
At a time when Chinese models are iterating rapidly, “betting on a single model” carries high risk. A more robust strategy is:
- Abstraction layer: route all model calls through a unified OpenAI-compatible interface to avoid deep binding to a specific vendor.
- Routine A/B evaluation: after a new model is released, run a comparison on the internal evaluation set and use data to decide whether to switch.
- Scenario-based routing: route simple tasks to lightweight models for lower cost and latency, and route complex tasks to flagship models, achieving the best balance between cost and quality.
- Canary release: when switching models, use small-traffic canary releases and observe online metrics before full rollout.
5. Conclusion
The entry of Chinese LLMs into mainstream inference service platforms marks the maturity of the open-source ecosystem and upgrades “how to select a model” from a technical question to an engineering governance question. There are three core conclusions:
- Selection should be task-oriented: leaderboards are only for initial screening; the internal evaluation set is the basis for decisions.
- Architecture should be decoupling-oriented: the gateway layer abstracts model differences and preserves the freedom to switch at any time.
- Cost should be viewed globally: put call, compute, engineering, and migration costs into the same ledger.
Models will continue to update, but the methodology of “task definition—evaluation validation—decoupled access—continuous monitoring” remains effective over the long term. Making model selection a repeatable process rather than a one-time decision is the right way to respond to rapid model iteration.
