How to Choose and Deploy Chinese LLMs: A Practical Engineering Guide

    This guide explains how to evaluate and deploy large language models based on scenario fit rather than benchmark rankings. It covers hands-on observations across five capability dimensions—long and structured document understanding, structured instruction following, intelligent triggering for RAG, the real limits of code generation, and integration and ecosystem maturity—alongside a reusable evaluation method, a low-cost self-development architecture with a unified adapter layer, and an actionable checklist for building a controllable, observable, and evolvable LLM stack.

    1. The Real Problem: Not “Which Model Is Best,” but “Which Model Fits the Scenario”

    When choosing a model, many teams ask a broad question: which domestic model is the most promising. From an engineering deployment perspective, this framing is hard to act on. Model capability is a multi-dimensional vector, and strength across dimensions is inconsistent: one model may excel at long-document summarization yet clearly lag in multi-step code reasoning; another may follow instructions only moderately well but offer more stable APIs and a more mature ecosystem for production integration.

    A more rigorous approach is to break the business down into measurable capability items, run small-scale benchmarks for each one, and then make a weighted decision that also accounts for engineering factors such as integration cost, concurrency quota, context length, and observability. This article follows that approach.

    2. Hands-On Observations Across Five Key Capability Dimensions

    1. Long-Document and Structured Document Understanding

    PDF parsing is the first hurdle for document-centric use cases. In real scenarios, a PDF often contains multi-column layouts, tables, headers and footers, and scan noise, so the model must first reconstruct the layout and then perform semantic summarization. In testing, a simple extractive prompt (asking for “key conclusions + key data + supporting passages from the source”) was enough to produce a usable structured summary, showing that mainstream models are already engineering-viable for “single document, single turn, clearly defined goal” tasks.

    Practical advice: do not expect one prompt to solve every layout problem. A more robust pipeline assigns layout and table reconstruction to the parsing layer and leaves only semantic summarization and key-point extraction to the model layer. Decoupling the two layers lowers replacement cost.

    Illustrative prompt structure:

    1. Role: Document analysis assistant
    2. Input: {parsed plain text of the document}
    3. Task:
    4. 1. Output no more than 5 key conclusions;
    5. 2. After each conclusion, note the paragraph number of the supporting passage in the source;
    6. 3. For anything that cannot be inferred from the source, explicitly output "Not mentioned".
    7. Constraint: Do not introduce external knowledge.

    2. Structured Instruction Following

    Early domestic models were generally unstable on complex structured prompts (multi-level nesting, conditional branches, role constraints, output-format constraints), often executing only part of them. The broad recent improvement is that models can now reliably follow structured instructions that are “shallow in hierarchy and explicit in constraints”—for example, outputting fixed fields, selecting a branch based on a condition, or respecting length limits.

    The engineering response is to externalize complex constraints: assemble prompts with a template engine, and use schema validation (such as JSON Schema validation) at the application layer to intercept non-compliant output, then retry or fall back on failure. This is more controllable than repeatedly tuning the prompt.

    1. import json, jsonschema
    2. schema = {
    3. "type": "object",
    4. "required": ["summary", "risks"],
    5. "properties": {
    6. "summary": {"type": "string", "maxLength": 200},
    7. "risks": {"type": "array", "items": {"type": "string"}}
    8. }
    9. }
    10. def safe_call(llm, prompt, retry=2):
    11. for _ in range(retry + 1):
    12. raw = llm(prompt)
    13. try:
    14. data = json.loads(raw)
    15. jsonschema.validate(data, schema)
    16. return data
    17. except Exception:
    18. continue
    19. return {"summary": "", "risks": []} # Fallback response

    3. Intelligent Triggering for Retrieval-Augmented Generation

    A common implementation of retrieval-augmented generation (RAG) retrieves unconditionally: every request first queries the vector store and then concatenates the context. This creates two problems: irrelevant retrieval introduces noise that actually degrades answer quality, and latency and cost increase.

    A more mature approach adds a “does this need retrieval” decision step: first judge intent and knowledge boundaries, and trigger retrieval only for questions involving facts, time-sensitive information, or private data, letting the model answer the rest directly. The decision can be a rule placed up front or a lightweight classification call. This design matters especially for cost-sensitive businesses.

    4. The Real Boundary of Code Capability

    Code is the dimension with the most obvious gap. The observation is that most models answer simple, local, pattern-based code questions correctly (utility functions, routine CRUD, syntax fixes), while complex requirements involving cross-file dependencies, implicit constraints, and multi-step reasoning tend to produce output that is “superficially correct but not actually runnable”—undefined variables, nonexistent dependencies, missing boundary conditions.

    There are three countermeasures: first, make tasks small and have the model change only one function at a time; second, enforce test-driven work by writing test cases first and then having the model complete the implementation; third, feed compilation and test execution results back to the model to form a closed correction loop. The value of toolchains (AI coding tools, command-line assistants) lies precisely in carrying this loop, not in merely generating code.

    5. Engineering Integration and Ecosystem Maturity

    In real projects, the model is only one link in the chain. Evaluation should consider whether API access and quota are predictable, whether streaming output is supported, whether the context length is sufficient for long documents, whether conversation history retrieval is available, and whether there is an active community with reusable examples. These “non-model capabilities” often determine how fast you can deploy. For scenarios that require building a personal knowledge base locally, if one provider’s API is hard to obtain, substituting another API that can be reliably accessed is the more pragmatic choice.

    3. A Reusable Evaluation Method

    Do not rely on subjective impressions. Build a small benchmark set of 30–50 samples from your own business, covering five task types: document summarization, structured extraction, instruction following, code generation, and multi-turn consistency. Give each sample a reference answer and automated validation rules, and record three metrics: accuracy, average latency, and cost per turn. After three rounds of iteration, the selection conclusion becomes very clear.

    Also explicitly test “context retention”: in a multi-turn conversation, insert an unrelated topic and then return to the original task, and observe whether the model loses earlier constraints. Most application sides have no switch to control context, so this capability must be backstopped at the application layer through session state management.

    4. An Engineering Paradigm for Low-Cost In-House Development

    When the budget is limited, in-house development is often more cost-effective than purchasing. A typical path is to first define the business form (for example, a self-service booking and access-control mini program), then use AI coding tools to build the main body of the code, calling models on demand, forming a front-end/back-end separated SaaS structure.

    Reference layering:

    • Access layer: a mini program or web front end handling interaction and authentication;
    • Service layer: stateless API services handling business orchestration, prompt template management, and output validation;
    • Model layer: a unified adapter layer wrapping different model providers to make canary rollout and switching easy;
    • Data layer: a document database for business data, object storage for files, and vector retrieval for the knowledge base;
    • Operations layer: a logging service recording the prompt and response of every call, with monitoring and alerting covering failure rate and latency.

    The unified adapter layer is the key design, illustrated below:

    1. // Unified adapter layer: hides provider differences for canary rollout and fallback
    2. async function chat({ messages, temperature = 0.2, stream = false }) {
    3. const provider = pickProvider(); // Select by policy
    4. return provider.chat({ messages, temperature, stream });
    5. }

    Combined with timeouts, retries, circuit breaking, and caching (identical questions hit the cache and return directly), you can significantly reduce call costs without sacrificing experience.

    5. Conclusion and Action Checklist

    Back to the original question: rather than judging who is most promising, build your own evaluation and adaptation system. The actionable checklist is as follows:

    1. Run a five-dimension evaluation with your own sample set, quantifying rather than relying on gut feeling;
    2. Decouple parsing from semantics to lower replacement cost;
    3. Externalize complex constraints into templates and schema validation;
    4. Trigger retrieval on demand to control noise and cost;
    5. Keep code tasks small and introduce an execution loop;
    6. Integrate through a unified adapter layer, preserving canary rollout and fallback;
    7. Complete logging and monitoring so quality can be continuously optimized.

    In related practice at Baidu AI Cloud, the same layering and unified-adapter approach applies: composing general capability categories (model services, object storage, vector retrieval, logging service, monitoring and alerting) into a controllable, observable, and evolvable solution is the reliable path through cycles of model iteration.