Open-Source Chinese LLM Deployment Guide: From Capability Evaluation to Production Engineering

    A practical guide to evaluating and deploying open-weight large language models. It covers capability testing, custom evaluation sets, model selection, deployment architecture, long-context processing, cost and compliance considerations, and engineering practices for reliable inference services.

    1. Why Open-Source LLMs Deserve Systematic Evaluation

    Open-source and open-weight large language models allow development teams to deploy inference services in their own environments, maintain control over data flows, and fine-tune models for specific business scenarios. For industries such as finance, healthcare, and government, where data confidentiality is critical, this control can determine whether a solution is suitable for production.

    Several Chinese research organizations have recently released the weights and capability descriptions of new-generation models. Their improvements generally focus on instruction following, long-context understanding, long-horizon task execution, and deep research. These advances move models beyond single-turn question answering toward multi-step task processing, which means engineering teams must redesign both their evaluation methods and system architecture.

    Model release scale and community popularity do not necessarily translate into business value. Model selection should be based on measured performance against your own tasks.

    2. Breaking Down Model Capabilities

    1. Instruction following

    Instruction following describes whether a model can accurately understand and execute complex instructions that include formatting requirements, constraints, and multiple steps. Examples include generating JSON with a fixed schema, staying within a specified length, or listing steps in a required order.

    One useful engineering metric is the constraint satisfaction rate. For each instruction, check whether all constraints are satisfied simultaneously, then calculate the proportion of cases that pass.

    2. Long-context understanding

    Long-context understanding is the ability to locate information and perform cross-paragraph reasoning within a large context window. A common failure mode is declining retrieval accuracy for information located in the middle of the context. When critical content appears between the beginning and the end, models are more likely to overlook it.

    Evaluation should place key information at the beginning, middle, and end of the context. Compare retrieval accuracy across these positions to identify positional weaknesses.

    3. Long-horizon tasks

    Long-horizon tasks require a model to make consecutive tool calls, preserve intermediate state, and ultimately complete a goal. Examples include information gathering, code modification, and data cleaning.

    Key metrics include task completion rate, average number of steps, and the model’s ability to recover from errors.

    4. Deep research

    Deep research typically involves decomposing a question, searching multiple sources, cross-validating information, and producing structured writing. From an engineering perspective, citation traceability is essential. Every conclusion should be linked to a specific source passage.

    3. Build a Custom Evaluation Set

    Public benchmarks only reflect model performance on publicly available data. Teams should extract representative samples from real business workflows and build an evaluation set containing approximately 100 to 500 cases. The set should include normal inputs, boundary conditions, and invalid or abnormal inputs.

    Each case should contain:

    • The input
    • The evaluation rule
    • The relevant capability dimension
    • A difficulty label

    Whenever possible, use programmatic checks, such as regular-expression matching, JSON parsing, and field comparison. Human evaluation or an independent model can be introduced when programmatic validation is not feasible. Scoring consistency should then be reviewed periodically through random sampling.

    A basic evaluation loop can be structured as follows:

    1. import json
    2. from dataclasses import dataclass
    3. from typing import Callable
    4. @dataclass
    5. class EvalCase:
    6. case_id: str
    7. dimension: str # instruction / long_context / long_task / research
    8. prompt: str
    9. check: Callable[[str], bool]
    10. def run_eval(cases, call_model):
    11. results = {}
    12. for case in cases:
    13. try:
    14. output = call_model(case.prompt)
    15. passed = bool(case.check(output))
    16. except Exception:
    17. passed = False
    18. results.setdefault(case.dimension, []).append(passed)
    19. # Aggregate by dimension to prevent one weakness from being hidden by the average
    20. return {dim: sum(flags) / len(flags) for dim, flags in results.items()}
    21. def check_json_fields(output: str) -> bool:
    22. try:
    23. data = json.loads(output)
    24. except json.JSONDecodeError:
    25. return False
    26. return isinstance(data, dict) and set(data.keys()) == {"title", "summary", "tags"}

    Results should be reported separately for each capability dimension. An overall average can conceal a significant weakness—for example, strong instruction following combined with poor long-context retrieval.

    4. A Framework for Model Selection

    Model selection should compare several dimensions. Relying only on leaderboard rankings can lead to poor decisions.

    Evaluation dimension Key questions Data source
    Task performance What are the pass rates for each dimension on the custom evaluation set? Evaluation pipeline
    Context length Can real documents be provided in full? Document length statistics
    Inference cost How many input and output tokens are used per request, and what is the latency? Load-testing results
    License terms What are the requirements for commercial use, redistribution, and attribution? The license text
    Fine-tuning support Is parameter-efficient fine-tuning and iterative versioning practical? Engineering validation
    Operational complexity What hardware is required, and how frequently must versions be upgraded? Deployment trials

    A recommended process has three stages:

    1. Use the evaluation set to narrow the candidates to two or three models.
    2. Run a shadow test using real production traffic to compare latency and output quality. In a shadow test, production requests are copied to candidate models, but their results are not returned to users.
    3. Make the final decision based on cost and compliance requirements. Record the rationale so that the decision can be reviewed later.

    5. Deployment Architecture

    An inference service typically consists of multiple layers. Responsibilities should be clearly separated:

    • Access layer: Handles authentication, rate limiting, and request validation while exposing a consistent external interface.
    • Orchestration layer: Manages prompt templates, tool calls, and state persistence for multi-step tasks.
    • Inference layer: Hosts model services and batch scheduling, with horizontal scaling based on load.
    • Data layer: Stores vector indexes, conversation records, and evaluation results using appropriate object storage and relational database systems.
    • Observability layer: Uses logging and monitoring systems to record request latency, token counts, and error types.

    Service configuration must be injected through environment variables or a secret-management service. It should never be written directly into source code or logs:

    1. import os
    2. MODEL_ENDPOINT = os.environ["MODEL_ENDPOINT"]
    3. MODEL_API_KEY = os.environ["MODEL_API_KEY"]
    4. # Set the default according to the published context limit of the selected model
    5. MAX_CONTEXT_TOKENS = int(os.environ.get("MAX_CONTEXT_TOKENS", "8192"))

    6. Engineering for Long-Context Inputs

    When an input exceeds the model’s context limit, three common approaches are available:

    • Truncation: Simple to implement, but it can discard important information.
    • Chunking and sequential processing: Suitable for summarization and information extraction.
    • Retrieval before reading: Suitable for question-answering tasks and can significantly reduce interference from irrelevant content.

    Chunks should include a certain amount of overlap to prevent sentences or semantic units from being split:

    1. def split_text(text: str, max_chars: int = 3000, overlap: int = 200) -> list[str]:
    2. if overl