How to Choose Chinese Large Language Models: A Developer’s Evaluation and Deployment Checklist

    A practical guide to selecting Chinese LLMs based on business requirements, real-world testing, latency, cost, security, and integration architecture. It covers inference delivery options, benchmark interpretation, evaluation metrics, gateway design, and common deployment mistakes.

    The Short Answer: A Three-Step Selection Process

    Model selection can be handled in three steps.

    First, define the requirements that are essential for your business scenario, such as multi-turn conversation coherence, code-generation pass rates, and structured-output parsing success rates. Second, test every candidate model with the same set of real-world samples, recording quality, latency, and cost. Third, place a gateway in front of the models so that application code remains decoupled from any specific provider or model.

    Following this sequence usually narrows the list to two or three candidates. The final decision should be based on production-relevant test data.

    1. Three Ways to Consume Inference Services

    In the past, developers often had to download open-source model weights and build the inference stack themselves. Today, most teams access models through inference platforms, which package computing resources, inference engines, and model weights behind standardized APIs.

    Use the following comparison when choosing a delivery model:

    Dimension Self-Hosted Inference Managed Inference Platform Direct Provider API
    Operations effort High; your team manages GPUs and inference frameworks Low; the platform manages scaling Lowest
    API compatibility Depends on your framework Often available in an OpenAI-compatible format Formats may differ by provider
    Billing model Usually based on hardware usage time Usually token-based Usually token-based
    Data boundaries Data remains on-premises or within a private network Review the service agreement and deployment region Review data-retention and training terms
    Rate limits and quotas Controlled by your team Set by the platform; increases may be available on request Set by the provider and can vary significantly

    For most teams, a managed platform or direct API is the best starting point because it reduces experimentation costs. Once traffic becomes stable and data sensitivity increases, evaluate self-hosting or deployment in a dedicated private cloud environment.

    2. How to Interpret Evaluation Leaderboards

    Web-development leaderboards typically use automated test cases to evaluate a model’s ability to generate code. These rankings can indicate performance on specific tasks, but they do not directly predict results for your own application.

    Before citing or relying on leaderboard data, verify three items:

    1. The exact model version.
    2. The test date.
    3. The scoring methodology.

    Leaderboard results can change as models are updated, so older data may no longer be representative.

    Long-context capabilities also require careful validation. Some flagship models advertise context windows ranging from 128K to 1M tokens. The exact figure should be confirmed in the official documentation. A stated context-window size does not mean that information at every position in a long document can be retrieved reliably.

    The validation method is straightforward: insert several known facts into your own long documents, ask questions at different document lengths, and record the point at which retrieval accuracy begins to decline significantly.

    3. Evaluation Dimensions and Test Checklist

    The table below outlines common evaluation methods. Passing criteria should be adjusted to match your team’s baseline; the values shown are only starting points.

    Scenario Core Metrics Test Method Example Passing Criterion
    Intelligent customer service and multi-turn dialogue Contextual coherence, refusal accuracy Replay 200 real conversations and use blind human evaluation Average score is no lower than the current solution, with no safety violations
    Developer assistance and code generation Unit-test pass rate Generate code from historical requirements and run the test suite Pass rate reaches the team’s predefined baseline
    Structured output JSON parse success rate Use 100 fixed inputs and count successful parses Parse-failure rate remains below the threshold, such as 1%
    Long-document question answering Key-information recall rate Insert known facts into real documents and test retrieval Test documents in length segments and record the point of degradation

    Measuring Latency

    Measure latency in a controlled test environment. Keep the data center and network conditions fixed, and test concurrency levels of 1, 10, and 50. Sample input and output lengths according to the distribution of real workloads.

    Record time to first token (TTFT) and generated tokens per second (TPS), and calculate the P50, P95, and P99 percentiles. Averages can hide long-tail requests, which are often the requests users perceive as slow or unresponsive.

    Calculating Cost

    The cost of a single task can be estimated with the following formula:

    1. Single-task cost =
    2. average input tokens × input price
    3. + average output tokens × output price
    4. + token usage from retries and failed requests

    Reasoning models may generate hidden thinking tokens, which are often billed as output tokens. Before deployment, confirm whether these tokens are included in the provider’s billing rules. Otherwise, your budget estimate may be too low.

    Security and Compliance Checks

    • Classify data by sensitivity, such as public, internal, or sensitive.
    • De-identify sensitive fields before sending requests.
    • Confirm whether the provider uses request data for model training and understand its data-retention period.
    • Do not record raw prompts in logs. Record only metadata such as model name, duration, and status code.
    • Define responsibility boundaries for private or dedicated-cloud deployments in the contract.
    • Retain audit records, including model version, request time, and caller identity.

    4. Use a Gateway to Decouple Applications from Models

    A gateway centralizes model names, timeout policies, and retry logic. Application code calls a unified interface, while model upgrades can be handled by changing routing configuration rather than modifying business logic.

    The following example uses an OpenAI-compatible chat/completions interface. The gateway URL and API key are read from environment variables instead of being embedded in the code.

    1. import logging
    2. import os
    3. import time
    4. import requests
    5. logger = logging.getLogger("llm_router")
    6. # Read model names from environment variables so upgrades only require configuration changes
    7. ROUTE_TABLE = {
    8. "complex_reasoning": os.getenv("MODEL_REASONING", "your-reasoning-model"),
    9. "code_generation": os.getenv("MODEL_CODER", "your-coder-model"),
    10. "general": os.getenv("MODEL_LITE", "your-lite-model"),
    11. }
    12. RETRYABLE_STATUS = {429, 500, 502, 503, 504}
    13. class LLMRouter:
    14. def __init__(self, gateway_endpoint, api_key,
    15. timeout=(3.05, 60), max_retries=3):
    16. if not api_key:
    17. raise ValueError("Missing API key. Set LLM_GATEWAY_API_KEY.")
    18. self.endpoint = gateway_endpoint
    19. self.timeout = timeout # (connection timeout, read timeout); streaming requires a longer read timeout
    20. self.max_retries = max_retries
    21. self.session = requests.Session()
    22. self.session.headers.update({
    23. "Authorization": f"Bearer {api_key}",
    24. "Content-Type": "application/json",
    25. })
    26. def route_and_invoke(self, prompt, task_type="general", max_tokens=2000):
    27. model_name = ROUTE_TABLE.get(task_type, ROUTE_TABLE["general"])
    28. payload = {
    29. "model": model_name,
    30. "messages": [{"role": "user", "content": prompt}],
    31. "temperature": 0.2,
    32. "max_tokens": max_tokens,
    33. }
    34. last_error = None
    35. for attempt in range(1, self.max_retries + 1):
    36. try:
    37. resp = self.session.post(self.endpoint, json=payload,
    38. timeout=self.timeout)
    39. except (requests.Timeout, requests.ConnectionError) as exc:
    40. last_error = exc
    41. self._backoff(attempt, model_name, type(exc).__name__)
    42. continue
    43. if resp.status_code in RETRYABLE_STATUS:
    44. last_error = RuntimeError(f"Gateway returned {resp.status_code}")
    45. self._backoff(attempt, model_name, resp.status_code)
    46. continue
    47. if resp.status_code >= 400:
    48. # 4xx errors are usually caused by the request or API key, so retrying is not useful.
    49. # Do not log the response body to avoid exposing the prompt.
    50. raise RuntimeError(
    51. f"Gateway rejected the request, status code {resp.status_code}"
    52. )
    53. try:
    54. content = resp.json()["choices"][0]["message"]["content"]
    55. except (ValueError, KeyError, IndexError) as exc:
    56. raise RuntimeError(
    57. "Gateway response format is not as expected"
    58. ) from exc
    59. logger.info("model=%s task=%s attempt=%d status=ok",
    60. model_name, task_type, attempt)
    61. return content
    62. raise RuntimeError("Retry limit exhausted") from last_error
    63. def _backoff(self, attempt, model_name, reason):
    64. logger.warning("model=%s attempt=%d failed: %s",
    65. model_name, attempt, reason)
    66. if attempt < self.max_retries:
    67. time.sleep(2 ** (attempt - 1)) # Exponential backoff: 1 second, 2 seconds
    68. if __name__ == "__main__":
    69. logging.basicConfig(level=logging.INFO)
    70. router = LLMRouter(
    71. gateway_endpoint=os.getenv(
    72. "LLM_GATEWAY_URL",
    73. "https://your-gateway.example.com/v1/chat/completions"
    74. ),
    75. api_key=os.getenv("LLM_GATEWAY_API_KEY"),
    76. )
    77. answer = router.route_and_invoke(
    78. "Implement a debounced search box component in React.",
    79. task_type="code_generation",
    80. )
    81. print(answer)

    The gateway should also be integrated with logging, monitoring, and alerting services. Track request success rates, latency distributions, and costs by model name. These metrics provide the evidence needed when evaluating or replacing a model.

    5. Common Mistakes

    • Looking only at leaderboard rankings without testing your own samples.
    • Using demo data for evaluation and discovering after launch that real inputs are longer and more inconsistent.
    • Ignoring output-token and reasoning-token charges, resulting in an underestimated budget.
    • Omitting timeouts, allowing slow requests to accumulate and overwhelm the service.
    • Hard-coding API keys or committing them to a code repository.
    • Failing to record model versions after launch, making it impossible to trace the cause of quality changes.

    Conclusion

    Selecting a Chinese large language model requires evaluating business scenarios, engineering architecture, and cost constraints together. Once requirements are defined and real-world testing is complete, the candidate list can usually be narrowed to two or three models.

    Several risks still require ongoing attention. Model updates can change output behavior, provider terms and data policies can be revised, and network latency can vary by region. By preserving the evaluation set, gateway, and monitoring system, your team can quickly validate and replace models as the ecosystem evolves.