Selecting Chinese LLMs and Integrating Inference Platforms: A Checklist

    This article provides a comprehensive checklist for selecting Chinese Large Language Models (LLMs) and integrating them with inference platforms. It covers defining selection goals, evaluating models across four dimensions, using inference microservice platforms, API integration with code examples, designing unified test sets, multi-model routing, and best practices for deployment and operations.

    1. Define Selection Goals

    Before selecting a model, the team needs to answer three questions: What is the business scenario? What are the acceptable latency and per-call costs? Can the data leave the internal network? Different answers will narrow down the pool of candidate models. For example, internal code reviews require high accuracy but can tolerate slower responses, whereas customer service Q&A prioritizes low latency and cost. Write these requirements down to establish a benchmark for subsequent evaluations.

    2. Four Dimensions for Capability Assessment

    When evaluating models, it is recommended to score the following dimensions separately rather than relying on a single overall score.

    1. Logical Reasoning: Provide multi-step business rules or math problems, and check whether the intermediate steps are self-consistent and whether the conclusions align with the premises.
    2. Code Generation and Engineering: Ask the model to generate runnable code, and check if dependencies, exception handling, and naming conventions comply with team standards.
    3. Long Context Processing: Feed real codebases or long document snippets into the context to check if the model can correctly reference function names, configuration items, and constraints.
    4. Cost and Latency: Record time to first token, overall completion time, and cost per 1,000 calls, and compare these alongside quality scores.

    Leaderboards can serve as an initial screening tool. When using them, record the leaderboard name, publication date, test set description, metric names, and specific scores. Conclusions lacking this information should not be included directly in the selection report. Since leaderboards update frequently and a model’s ranking may change over time, the query date must be noted in the report.

    3. Role and Boundaries of Inference Microservice Platforms

    Inference microservice platforms encapsulate computing power, model weights, and inference engines into standardized interfaces. Developers can call different models through a unified API without dealing with the differences in underlying hardware and inference frameworks.

    This encapsulation brings three practical benefits:

    • Unified Interfaces: Multiple models can share the same request format. When switching models, business code typically only needs a change in the model identifier.
    • Resource Management: Platforms often provide dynamic batching or continuous batching. Under specific loads, these mechanisms can improve throughput and reduce queue times, but the effectiveness depends on request length and concurrency. Testing with real traffic is necessary.
    • Version Upgrades: Once the platform adapts to a newly launched model, applications can switch to it via configuration changes.

    An inference platform solves deployment and invocation issues but cannot replace model evaluation. A platform listing a model only indicates that it can be called, not that it is suitable for your business needs.

    4. Integration Steps and Example Code

    The following example demonstrates a standard Chat Completions API call. The URL, model identifier, and API key in the example are placeholders and must be replaced with real values from the platform’s documentation.

    Preparation:

    1. Create an API key in the platform console, and ensure it only has permissions for the required models and APIs.
    2. Store the key in the environment variable INFERENCE_API_KEY. Do not hardcode it in source code or logs.
    3. Install dependencies: pip install "requests>=2.31".
    4. Copy the exact model identifier from the platform documentation, and confirm the model is activated under your account.
    1. import os
    2. import requests
    3. API_URL = os.environ.get("INFERENCE_API_URL", "https://<platform-provided-domain>/v1/chat/completions")
    4. API_KEY = os.environ.get("INFERENCE_API_KEY")
    5. MODEL_ID = os.environ.get("INFERENCE_MODEL_ID", "<model-identifier-on-platform>")
    6. if not API_KEY:
    7. raise SystemExit("Environment variable INFERENCE_API_KEY is not set")
    8. headers = {
    9. "Content-Type": "application/json",
    10. "Authorization": f"Bearer {API_KEY}",
    11. }
    12. payload = {
    13. "model": MODEL_ID,
    14. "messages": [
    15. {"role": "system", "content": "You are a backend engineer proficient in message queues and asynchronous task design."},
    16. {"role": "user", "content": "Implement an asynchronous task class in Python, including task publishing, consumption, and failure retry logic, and explain the retry strategy."},
    17. ],
    18. "temperature": 0.2,
    19. "max_tokens": 1500,
    20. }
    21. try:
    22. resp = requests.post(API_URL, headers=headers, json=payload, timeout=60)
    23. resp.raise_for_status()
    24. except requests.RequestException as exc:
    25. print(f"Request failed: {exc}")
    26. else:
    27. data = resp.json()
    28. print(data["choices"][0]["message"]["content"])

    Replacement notes: <platform-provided-domain> and <model-identifier-on-platform> must be replaced with values from the platform documentation. The response structure should also be based on the platform documentation, as field names may vary across platforms. A lower temperature helps produce more stable outputs, making it easier to compare different models.

    5. Designing a Unified Test Set and Scoring Criteria

    The same test set should be sent to all candidate models to ensure consistent comparison conditions. It is recommended that the test set includes 30 to 50 real tasks, covering standard requirements, edge cases, and known error-prone scenarios. Fix the prompt, temperature, and max output length for each task.

    Scoring is divided into three categories, each scored from 0 to 5:

    • Syntax Correctness: Can the code pass static checks or run successfully? Are API calls compliant with the documentation?
    • Logical Completeness: Does it cover every step required by the task, and are edge cases omitted?
    • Exception Handling Robustness: When encountering network timeouts, duplicate messages, or task failures, does the code handle them appropriately?

    Two or more reviewers should score independently and calculate the average. For items with a score difference exceeding 1 point, a discussion is required to unify the result. Record the pass rate and average completion time for each model, and include these data as an attachment to the selection report.

    6. Multi-Model Routing and Cost Control

    Enterprises typically do not need to rely on a single model. Routing rules can be configured based on task type and cost, for example:

    • Daily Q&A: Route to a low-cost, lightweight model.
    • Code Review or Complex Reasoning: Route to the model with the highest quality score during testing.
    • Primary Model Timeout or Error: Switch to a backup model after one retry.

    Routing rules must specify trigger conditions and thresholds, and should be periodically reviewed using the test set. Routing performance should be recorded on a monitoring dashboard, including call volume, failure rate, average latency, and per-call cost for each model.

    7. Common Practices for Deployment and Operations

    In a cloud-native environment, common practices include the following:

    • Inference services are deployed via containers, with auto-scaling policies based on request queue length or GPU utilization.
    • Long-running generation tasks are placed in message queues for asynchronous processing to prevent HTTP connections from being held for extended periods.
    • Logs record request IDs, model identifiers, latency, and error codes, but do not log complete sensitive user content. Desensitized failure samples can be used for subsequent evaluation and fine-tuning data preparation.

    Most cloud providers offer container, message queue, and logging services. Refer to their respective documentation for specific product names and configuration methods.

    8. Conclusion: Pre-Deployment Checklist

    Before going live, confirm the following items one by one:

    1. Every leaderboard conclusion in the selection report is annotated with the leaderboard name, date, and metric.
    2. Test set results are recorded, including three sets of data: quality, latency, and per-call cost.
    3. All placeholders in the example code have been replaced, and the API key is read exclusively via environment variables.
    4. Routing rules have clear trigger conditions and a backup model is configured for failures.
    5. Logging and monitoring cover call volume, failure rate, and latency, with sensitive data desensitized.

    Completing these five items provides a verifiable basis for your selection conclusions. Since models and platforms iterate continuously, it is recommended to retest using the same test set once a quarter.