Chinese LLM Selection Guide: From Evaluation to Integration
This guide presents a repeatable engineering process for selecting Chinese LLMs, covering requirement definition, evaluation, small-scale integration, and continuous monitoring. It explains the three-layer model access structure, six evaluation dimensions, how to build an in-house evaluation set, and practical steps for authentication, API key management, client configuration, and connectivity checks.
1. Why Selection Needs a Methodology
There are many Chinese LLMs, and each has different strengths in task capability, response speed, pricing, and API form. Making decisions based on impressions or a single leaderboard often leads to three common problems: leaderboard tasks do not match real business tasks, trial experience is affected by time of day and load, and switching models requires excessive code changes.
Selection should therefore be a repeatable engineering process with four stages: define requirements, build an evaluation, integrate at small scale, and monitor continuously. The following sections discuss each stage.
2. Understand the Three-Layer Structure of Model Access
Model access is usually divided into three layers:
- Model service platform: provides the model catalog, inference service, billing, and quota management.
- Unified API protocol: most platforms use a request format similar to mainstream chat APIs. The request contains a model identifier, a message list, and sampling parameters.
- Client: can be a graphical chat tool or business code.
When the API protocol is consistent, switching models usually requires only changing the model identifier and service address in the configuration, while business logic can remain unchanged. The model identifier should therefore be stored in a configuration file or environment variable, not hardcoded in business code.
3. Six Evaluation Dimensions for Selection
1. Task capability
Chinese understanding, code generation, long-text summarization, and logical reasoning vary significantly across models. The criterion should be your own business tasks, not a general ranking.
2. Response latency
Pay attention to time to first character (the time from sending a request to receiving the first character) and overall generation speed. Interactive scenarios are more sensitive to time to first character, while batch processing scenarios care more about overall throughput.
3. Stability and rate limiting
During peak hours, queuing, timeouts, or concurrency limits may occur. Record the failure rate and error code distribution over a period of time rather than relying on one or two test results.
4. Context length
The context window determines how much input a single request can contain. When processing long contracts, long reports, or multi-turn conversations, this metric directly affects feasibility.
5. Cost
Most platforms charge by number of calls or tokens and may offer a certain free quota; specific terms are subject to platform announcements. During selection, estimate monthly cost based on average daily request volume and average input/output length per request.
6. Compliance and data boundaries
Confirm whether data is used for model training, whether the service supports private deployment, and whether it meets industry regulatory requirements. When sensitive data is involved, this dimension often takes priority over capability comparison.
4. Use Your Own Evaluation Set Instead of a Single Leaderboard
The steps to build an evaluation set are as follows:
- Collect samples: extract 30 to 50 inputs from real business scenarios, covering common cases and edge cases. The sample size is only an empirical starting point and can be increased or decreased according to task complexity.
- Define scoring criteria: for subjective tasks, manual scoring can be used; for structured tasks, rule-based validation can be used, such as whether JSON is valid and whether key fields are present.
- Use consistent call parameters: candidate models should use the same temperature, maximum output length, and prompt template so that comparison is based on the same conditions.
- Aggregate multi-dimensional metrics: record quality scores, latency distribution, failure rate, and cost per call at the same time, instead of looking at only one metric.
The following code example counts successes, failures, and median latency for each model. It depends on the chat function in Section 5:
import timedef benchmark(models, prompts):report = {}for model in models:latencies, failures = [], 0for prompt in prompts:start = time.perf_counter()try:chat(model, prompt)latencies.append(time.perf_counter() - start)except Exception:failures += 1latencies.sort()report[model] = {"success": len(latencies),"failed": failures,"p50_seconds": latencies[len(latencies) // 2] if latencies else None,}return report
After evaluation, compare quality scores and cost with weighting. When the quality gap is small, prioritize the option with lower latency and more controllable cost.
5. Integration Process in Detail
5.1 Account and Authentication
- Register a platform account and complete email verification as prompted.
- Complete phone number or identity verification as required by the platform. Some platforms only grant inference access after verification, so confirm this in advance.
- Some regions or number types may not be supported. If you encounter problems, consult the platform documentation.
5.2 Create and Manage API Keys
- Create keys on the key management page in the console, and create separate keys for development, testing, and production.
- Set expiration dates and rotate keys regularly. Avoid long-lived keys to reduce the risk window after a leak.
- If the platform supports permission configuration, choose the minimum permissions that meet your needs.
- Keys are usually displayed only once. Save them immediately in a password manager or dedicated secret service.
- Do not write keys into source code, screenshots, chat logs, or public code repositories. If a leak is suspected, revoke the key in the console immediately, generate a new one, and check recent call logs.
5.3 Configure the Client
The table below lists the core items to configure during integration:
| Configuration item | Description | Example |
|---|---|---|
| Service address | Use the base URL provided in the platform documentation | <BASE_URL> |
| Key | Read from an environment variable; do not write it into code | LLM_API_KEY |
| Model identifier | Use the platform model list and place it in a configuration file | <model_id> |
| Temperature | Controls output randomness; keep it fixed during evaluation | 0.2 |
| Maximum output length | Limits the number of tokens generated per request | 512 |
Graphical client configuration interfaces usually include the same fields and are filled in the same way.
5.4 Connectivity Verification
After configuration, first use a simple request to verify that the connection works before moving on to business calls. If authentication fails, first check whether the key is complete and has not expired. If an address-related error is returned, check the path of the service address.
