LLM Evaluation Systems: A Practical Guide to Benchmarks, Test Sets, and Automation

    This guide outlines a repeatable approach to evaluating large language models with your own data instead of relying only on vendor-published benchmark scores. It covers evaluation dimensions such as complex reasoning, code generation, long-context understanding, and multi-turn dialogue; test set design and data leakage prevention; scoring rubrics; and automated evaluation with human verification.

    The number of large language models (LLMs) is growing quickly, and both open-source and proprietary models continue to be updated. When selecting a model, developers and enterprises often rely only on official benchmark scores. These scores are usually produced on vendor-defined test sets and parameters and may not match their own business context. Teams therefore need a repeatable evaluation process that uses their own data to judge whether a model is suitable. This article focuses on evaluation dimensions, test set design, automation scripts, and human verification.

    1. How to Choose Evaluation Dimensions

    Before evaluating a model, define what you want to test. Most teams focus on three categories of capability: complex reasoning, code generation, and long-context and multi-turn dialogue. The closer the dimensions are to the business context, the more useful the results will be.

    1.1 Complex Reasoning

    Reasoning ability is one of the key indicators for judging how well a model handles complex problems. Test sets can include multi-step mathematical calculations, logical chain deduction, and commonsense causal analysis. Checking only the final answer is not enough; the reasoning process should also be reviewed for completeness. You can add distracting information to questions or hide key premises in long passages to see whether the model can identify the conditions that are actually needed.

    1.2 Code Generation and Execution

    Code capability should not be scored only by whether the syntax passes. Scoring can be divided into four parts: whether the code passes automated tests, whether boundary conditions are handled correctly, whether API calls are accurate, and whether the original logic is preserved during cross-language migration. Test questions should progress from basic algorithms, such as sorting and hash table operations, to engineering scenarios such as concurrency control and network request retries. Each question should include executable unit tests.

    1.3 Long-Context Understanding and Multi-Turn Dialogue

    Enterprise scenarios often require processing long contracts, technical documents, and customer service records that span several weeks. Long-context tests can use a needle-in-a-haystack design, placing a key piece of information in a long document and checking whether the model can extract it accurately. Multi-turn dialogue tests focus on whether the model maintains a consistent persona and follows constraints from earlier turns. When a model forgets information or fabricates content in a long context, record the specific turn and error type.

    2. Building Test Sets and Preventing Data Leakage

    Many models may have encountered public evaluation questions during pretraining, which can inflate their scores. To reduce this risk, teams can take the following steps:

    • Use anonymized real business logs or questions newly written by domain experts.
    • Update a portion of the questions each quarter and keep version numbers so historical results can be traced.
    • Do not place the entire test set in a public repository; publish only a sampled structure description.
    • Keep a set of hidden questions for use only during formal model selection.

    2.1 Test Case Template

    Each test case should include the following fields to support unified management and statistics:

    Field Description Example
    id Unique case ID REASON-013
    task_type Task type Reasoning / Code / Long context / Multi-turn
    prompt Input content Question or dialogue context
    expected Expected result or reference answer 42
    rule Scoring rule Keyword match / Unit test / Human scoring
    weight Weight 1 to 3

    2.2 Scoring Rubric

    For open-ended answers, a five-point scale is recommended for human scoring:

    Score Meaning
    5 Completely correct, complete process, no unnecessary errors
    4 Correct conclusion, minor gaps in the process
    3 Partially correct, key steps are wrong
    2 Incorrect conclusion, but the approach has reference value
    1 Irrelevant to the question or clearly fabricated

    Before human scoring, two raters should independently score the same batch of samples, and an agreement coefficient such as Cohen’s kappa should be calculated. If the coefficient is low, the scoring criteria need to be revised.

    3. Automated Evaluation and Human Verification

    Automated evaluation is efficient and suitable for first-round screening. For questions with standard answers, results can be compared directly. For open-ended tasks, another model can first act as a judge to provide preliminary scores, followed by human spot checks. Automatic judges may also have biases, so they should be calibrated regularly against human results.

    Below is an evaluation example based on an HTTP interface. The API key is read from an environment variable and is not written into the code. The request body uses the chat interface’s messages format and explicitly specifies the model name.

    1. import os
    2. import requests
    3. def call_model(api_endpoint, api_key, model_name, prompt, timeout=60):
    4. headers = {
    5. "Authorization": f"Bearer {api_key}",
    6. "Content-Type": "application/json",
    7. }
    8. payload = {
    9. "model": model_name,
    10. "messages": [{"role": "user", "content": prompt}],
    11. "temperature": 0.0, # Turn off randomness during evaluation for reproducibility
    12. "max_tokens": 1024,
    13. }
    14. resp = requests.post(api_endpoint, headers=headers, json=payload, timeout=timeout)
    15. resp.raise_for_status()
    16. choices = resp.json().get("choices") or []
    17. if not choices:
    18. return ""
    19. message = choices[0].get("message") or {}
    20. return message.get("content", "")
    21. def evaluate_model(api_endpoint, model_name, test_cases):
    22. api_key = os.environ["LLM_API_KEY"]
    23. results = []
    24. for case in test_cases:
    25. record = {"case_id": case["id"], "output": "", "score": 0, "error": None}
    26. try:
    27. output = call_model(api_endpoint, api_key, model_name, case["prompt"])
    28. record["output"] = output
    29. # Keyword matching is only a baseline; formal evaluation should use semantic judgment or unit tests
    30. record["score"] = 1 if case["expected_keyword"] in output else 0
    31. except Exception as exc:
    32. record["error"] = str(exc)
    33. results.append(record)
    34. return results