How to Evaluate Large Language Models: A Practical Framework for Overall Capability
A reliable LLM evaluation should go beyond public leaderboards or a single benchmark score. This guide presents a reproducible framework for decomposing model capabilities, building layered test sets, automating objective checks, conducting blind human reviews, weighting results, and interpreting quality alongside cost and latency. It also includes a minimal Python evaluation example.
Introduction
When selecting a large language model, teams often ask: Which model provides the best overall experience? Although the question sounds straightforward, it is difficult to answer with a single conclusion. Models differ in language understanding, knowledge coverage, reasoning, coding, long-context processing, and other capabilities. Business scenarios also assign different levels of importance to each capability.
Instead of asking which model is “the best,” a more effective approach is to establish a reproducible and explainable evaluation method, then use it to compare candidate models.
This article presents a practical framework covering capability decomposition, test-set construction, automated checks, human review, and result aggregation. It also includes sample code.
1. Why “Overall Experience” Is Difficult to Quantify
“Experience” is a subjective combination of multiple capabilities. A conversation may feel smooth because the language is natural. An answer may seem reliable because its facts are correct, its reasoning is rigorous, and its wording is appropriately cautious. Looking at only one metric can therefore produce misleading conclusions.
Three problems are especially common.
First, evaluation samples may not reflect real business scenarios. For example, using general-purpose casual conversation prompts to evaluate enterprise document question answering does not provide meaningful evidence.
Second, evaluator preferences can affect the results. Longer answers and cleaner formatting may receive higher scores even when they do not provide more accurate or useful information.
Third, model versions and parameters change rapidly. A conclusion based on a single evaluation may become outdated soon after the test is completed.
An effective evaluation framework should therefore satisfy three requirements:
- Cover the relevant capability dimensions.
- Use samples that are close to real business needs.
- Make the process reproducible.
2. Decomposing Model Capabilities
Overall capability can be divided into the following eight dimensions.
Language understanding: Can the model correctly identify user intent, references, and implicit conditions? For Chinese-language scenarios, it may also be necessary to evaluate omitted words in conversational language, dialect expressions, and classical quotations.
Knowledge accuracy: How accurately does the model answer factual questions, and can it recognize when it is uncertain? Fabricated content produced under uncertainty can be more difficult to detect than a straightforward incorrect answer.
Reasoning: Can the model handle multi-step logic, mathematical calculations, and conditional constraints? Prompts should require intermediate steps so that the final answer can be checked against the reasoning process.
Programming: Can the model generate code, locate defects, and explain implementation details? Code should be executed and its output verified during evaluation rather than judged only by its appearance.
Long-context processing: Can the model locate key information in a long input, summarize content across sections, and remain consistent throughout its response? One approach is to place important facts at different positions in a long document and test whether their location affects retrieval and use.
Instruction following: Does the model comply with constraints such as output format, length limits, field order, and prohibited words? These requirements can often be evaluated automatically with stable results.
Multi-turn conversation stability: Can the model maintain context across multiple turns, avoid contradictions, and correctly revise its answer after receiving user corrections?
Safety and compliance: Does the model handle sensitive requests appropriately without refusing normal requests excessively, exposing private information, or generating prohibited content?
The importance of each dimension depends on the business scenario. Customer service applications may place greater emphasis on instruction following and safety. Developer-assistance tools may prioritize programming and reasoning. Knowledge-based question answering may focus more on factual accuracy and the reliability of information sources.
3. Building a Layered Evaluation Set
The evaluation set is the foundation of the entire process. A three-layer structure is recommended.
The first layer is a general capability set. It contains common questions covering the eight dimensions above and is useful for quickly comparing models across a consistent baseline.
The second layer is a business scenario set. It should be derived from real support tickets, documents, code repositories, or conversation logs, with sensitive information removed before use.
The third layer is an adversarial set. It should focus on cases where models are likely to fail, such as confusing entities with similar names, solving counterintuitive mathematics problems, or responding to questions that contain misleading assumptions.
The following practices help improve the quality of the evaluation set:
- Every sample should have a clear evaluation criterion. Use automated checks whenever the result can be determined by rules.
- Avoid duplicate samples and include a range of difficulty levels for each capability.
- Keep part of the test set separate from all tuning and prompt optimization activities to prevent inflated results caused by memorization.
- Assign version numbers to samples so that results can be reproduced and traced over time.
The dataset does not need to be large from the beginning. Several dozen to one hundred high-quality samples per dimension are often enough to reveal clear capability differences. The clarity of the evaluation criteria matters more than the total number of samples.
4. Example of Automated Checks
For dimensions that can be evaluated with explicit rules, automation provides high efficiency and stable results. The following is a minimal evaluation framework. The generate function represents the team’s own model-calling implementation and must be adapted to the actual integration method.
import jsonimport refrom dataclasses import dataclassfrom typing import Callable@dataclassclass TestCase:dimension: strprompt: strcheck: Callable[[str], bool]def check_json_format(answer: str) -> bool:"""Require valid JSON containing both title and summary fields."""try:data = json.loads(answer)except json.JSONDecodeError:return Falsereturn isinstance(data, dict) and {"title", "summary"} <= data.keys()def check_char_limit(answer: str, low: int, high: int) -> bool:"""Count non-whitespace characters and check the specified range."""length = len(re.sub(r"\s", "", answer))return low <= length <= highdef run_suite(cases: list[TestCase], generate: Callable[[str], str]) -> dict:results: dict[str, list[bool]] = {}for case in cases:answer = generate(case.prompt)passed = case.check(answer)results.setdefault(case.dimension, []).append(passed)return {dim: sum(flags) / len(flags) for dim, flags in results.items()}
The check function can be replaced according to the capability being evaluated. For mathematics problems, the evaluator can extract the final numeric value and compare it with the reference answer. For coding tasks, the generated code can be executed against unit tests.
Code execution should take place in an isolated environment. This is particularly important because generated code must not be allowed to access sensitive local resources.
Automated checks also have limitations. They can cover questions with clearly defined answers, but open-ended writing and recommendation tasks still require human review.
5. Blind Human Evaluation and Scoring Criteria
Open-ended tasks are well suited to blind human evaluation. The following practices are recommended.
First, hide the model identities. Format responses consistently and remove obvious model-specific markers so that reviewers focus on the content.
Second, create a specific scoring rubric. For example, reviewers can score accuracy, completeness, readability, and safety on a scale from one to five. Each score should have a written definition so that reviewers understand the difference between each level.
Third, have at least two reviewers score every sample independently. Inter-rater agreement should be calculated, and samples with significant disagreements should be sent to a third reviewer for arbitration. Large disagreements may also indicate that the scoring criteria are ambiguous and need revision.
Blind testing should also address position bias. Reviewers may favor the response they see first, so the display order should be randomized.
6. Aggregating and Interpreting Results
When combining scores from different dimensions into an overall score, the weights must be explicit. Weighting should reflect business priorities rather than personal intuition.
One example is:
- Instruction following: 20%
- Knowledge accuracy: 20%
- Reasoning: 15%
- Programming: 15%
- Language understanding: 10%
- Long-context processing: 10%
- Multi-turn conversation stability: 5%
- Safety and compliance: 5%
These weights are provided only to demonstrate the method. Actual weights should be adjusted according to the business scenario.
When interpreting the results, consider at least three factors.
First, determine whether the difference between models is larger than the evaluation’s margin of variation. Repeated runs can be used to estimate this variation.
Second, examine whether a weakness in one dimension could cause serious business consequences. For example, a model with a low safety score may be unsuitable for deployment even if its overall score is high.
Third, consider cost and response latency. The highest-quality option is not necessarily the most suitable option for production.
7. Common Mistakes
Treating Public Leaderboard Scores as Business Performance
The distribution of questions in a public leaderboard may differ significantly from the data and tasks encountered in a real application. Leaderboard scores should therefore be treated as a reference, not as a direct measure of business performance.
Drawing Conclusions from a Single Run
Model outputs may be stochastic. The same prompt should be sampled multiple times to evaluate output stability.
Using Samples That Are Too Easy
If almost every model answers a simple question correctly, the sample cannot reveal meaningful capability differences. Evaluation sets should include sufficiently challenging tasks and a clear range of difficulty.
Ignoring Prompt Effects
Prompts can significantly affect model performance. Evaluation should use clearly defined and versioned prompts, and changes to prompt wording should be recorded so that results from different runs remain comparable.
