Evaluating Chinese Large Language Models: Dimension Decomposition and Practical Methods
Selecting the right Chinese Large Language Model (LLM) requires looking beyond public leaderboards. This article breaks down the essential evaluation dimensions—including knowledge QA, long document processing, code generation, math reasoning, and multimodal capabilities—and outlines principles for designing a reproducible evaluation framework tailored to specific business needs. It also provides a minimal Python implementation to help you build your own evaluation suite.
1. Why Public Leaderboard Rankings Aren’t Enough for Model Selection
Public leaderboards aggregate multiple dimensions to provide a quick industry overview. However, rankings heavily depend on the test set composition, scoring rules, prompt templates, and evaluation timing. The same model might rank significantly differently across various test sets.
For specific business applications, the real questions are: How does the model perform on my tasks? Are the cost and latency acceptable? Is the output stable and controllable? Therefore, evaluation should start from the business perspective: define the task first, select the dimensions next, and design a reproducible process last.
2. Core Dimensions of Chinese LLM Capabilities
2.1 Knowledge QA
Knowledge QA measures the model’s mastery and articulation of factual knowledge. Key metrics include accuracy, hallucination rate, and whether the model appropriately chooses to refuse answering when uncertain.
In Chinese contexts, evaluation must additionally cover regional culture, industry jargon, and time-sensitive information. For recent events, a model might provide outdated details. It’s crucial to distinguish between “knowledge embedded in training data” and “the ability to retrieve latest information via external sources.”
Evaluation Focus:
- Cover general common sense, professional domains, and Chinese-specific expressions like idioms, proverbs, and classical literature quotes.
- Use exact answer matching or manual verification for factual questions, rather than just checking linguistic fluency.
- Separately track the refusal rate and the “confident but wrong” ratio.
2.2 Long Document Processing
Long document capabilities include information location, cross-paragraph reasoning, and summarization. While a long context window is necessary, it doesn’t guarantee performance. A model might accept extensive input but fail to utilize information in the middle effectively—a phenomenon known as “lost in the middle.”
A common testing method is the “needle in a haystack” approach: insert a fact at various depths in a long text, ask the model relevant questions, and measure recall across different positions and text lengths.
Other concerns for long document tasks:
- Is the truncation strategy reasonable when input exceeds the window?
- Does the summary omit critical numbers or conclusions?
- Does entity confusion occur during multi-document comparisons?
Many systems use Retrieval-Augmented Generation (RAG), splitting long documents into chunks and feeding them to the model on demand. The effectiveness of this approach depends on chunking granularity and retrieval quality. It should be evaluated separately against the full-text input approach, comparing both cost and accuracy.
2.3 Code Generation
Evaluating code generation focuses on functional correctness, not just code appearance. The standard practice is to equip each problem with unit tests, run the generated code in an isolated environment, and use the pass rate as the primary metric.
A common metric is pass@k, representing the probability that at least one out of n samples passes. Its unbiased estimator formula is:
pass@k = 1 − C(n−c, k) / C(n, k)
Where n is the total number of samples, c is the number of passing samples, and k is the number of samples examined.
Additional notes for code evaluation:
- The execution environment must be isolated to prevent generated code from accessing local files or external networks.
- Standardize timeout and memory limits to prevent individual samples from slowing down the overall evaluation.
- Perform basic security checks on generated code, such as detecting dangerous system calls.
2.4 Math Reasoning
Math evaluation checks if the final answer is correct and if the reasoning process is logical. In practice, answer extraction is often a major source of error. For example, if the model outputs “approximately 3.14” and the standard answer is “π”, a clear equivalence rule is required.
Recommended practices:
- Require the model to output the final answer in a fixed format for easy programmatic extraction.
- Normalize fractions, decimals, units, and symbols before comparison.
- Sample the same problem multiple times to observe result consistency.
2.5 Multi-turn Dialogue and Chinese Creative Writing
Multi-turn dialogue evaluation focuses on context consistency, instruction adherence, and role stability. Typical failures include forgetting the output format agreed upon in earlier turns or ignoring user-set constraints in longer conversations.
Chinese creative writing evaluation is relatively subjective but can be decomposed into verifiable sub-items: meeting word count, structural completeness, adherence to style, sentence fluency, and absence of repetition. Converting subjective feelings into a checklist significantly improves consistency among annotators.
If using another LLM as a judge, guard against judge bias—such as a preference for longer answers or answers similar to the judge’s own style. Randomly swapping the order of candidate answers and conducting random manual reviews can mitigate these biases.
2.6 Multimodal Capabilities
If the business involves image, table, or chart understanding, a separate multimodal subset should be established. Distinguish between two levels during evaluation: perceptual accuracy in recognizing content, and logical reasoning based on that content. Since the causes of failure differ, they should be tracked separately.
3. Principles for Designing an Evaluation System
- Isolation from Training Data: If test questions appear in training corpora, scores will be artificially inflated. Use a self-built test set and update it regularly.
- Fixed Evaluation Configs: Temperature, max output length, system prompts, and random seeds must be recorded to ensure reproducibility.
- Per-Dimension Statistics: Don’t just report a total score. Provide per-dimension scores, sample sizes, and confidence intervals. With small sample sizes, ranking differences might just be random noise.
- Alignment with Business Metrics: Customer service scenarios should focus on resolution and human handover rates; document scenarios on field extraction accuracy.
- Track Cost and Latency: Cost per call, time to first token, and overall throughput directly affect deployment viability.
4. Building a Reproducible Evaluation Framework
The following example provides a minimal framework, including a unified case structure, per-dimension statistics, weighted aggregation, and pass@k calculation. The query_model function needs to be implemented by the user based on their specific service interface.
from dataclasses import dataclassfrom math import combfrom typing import Callable@dataclassclass Case:dimension: str # Dimension, e.g., knowledge, math, codeprompt: str # Input promptchecker: Callable[[str], bool] # Function to check if output is correctweight: float = 1.0 # Sample weightdef query_model(prompt: str) -> str:"""Call the model under evaluation; implement based on your service."""raise NotImplementedErrordef run_suite(cases: list[Case]) -> dict[str, float]:buckets: dict[str, list[tuple[float, float]]] = {}for case in cases:output = query_model(case.prompt)hit = 1.0 if case.checker(output) else 0.0buckets.setdefault(case.dimension, []).append((hit, case.weight))return {dim: sum(h * w for h, w in items) / sum(w for _, w in items)for dim, items in buckets.items()}def weighted_total(dim_scores: dict[str, float], weights: dict[str, float]) -> float:total_w = sum(weights[d] for d in dim_scores)return sum(dim_scores[d] * weights[d] for d in dim_scores) / total_wdef pass_at_k(n: int, c: int, k: int) -> float:"""Unbiased pass@k estimation. n is total samples, c is passing samples, k is samples examined."""if n - c < k:return 1.0return 1.0 - comb(n - c, k) / comb(n, k)# Usage examplecases = [Case("knowledge", "Briefly describe the main products of photosynthesis.", lambda out: "glucose" in out.lower() or "oxygen" in out.lower()),Case("math", "What is 2 + 2?", lambda out: "4" in out)]
