How to Systematically Evaluate Next-Generation Large Language Models for Capability and Selection

    This guide explains how to evaluate large language models for real-world use. It covers why leaderboard scores are not enough for model selection, how to assess capabilities such as architecture, effective context length, multimodal input, long-horizon tasks, and cost and speed, and how to build a private evaluation set. It also includes sample code for an evaluation loop and cost estimation.

    1. Why Leaderboard Scores Should Not Be Used Directly for Model Selection

    Public leaderboards show how a model performs on a set of standard tasks, but these results are far from specific business needs. Leaderboards usually use fixed question sets, and some questions may overlap with training data. A single composite score also averages together abilities such as coding, math, and reading comprehension. A model that ranks highly in general question answering may not reliably make cross-file changes in your code repository.

    A sound approach is to first break business requirements into observable capabilities, verify each one with your own data, and then compare quality, speed, and cost in a single table.

    2. Breaking Down the Evaluation Dimensions

    2.1 Model Scale and Architecture

    Parameter count is often cited, but it only describes model capacity. It does not directly determine final performance. A common current design is the Mixture of Experts (MoE) architecture. Its total parameter count is very large, but each inference activates only a subset of expert networks. Under the same inference compute, this design can hold more knowledge. It also brings engineering challenges, such as high memory usage and uneven expert load. When evaluating, focus on performance per unit of cost rather than the parameter count.

    2.2 Effective Length of the Context Window

    The nominal context length is the maximum input a model can accept. The effective length is the range of information the model can use reliably. The two often differ. To test this, insert a retrievable fact at different positions in a long text, ask the model to answer, and measure the hit rate across positions and text lengths. If the hit rate drops noticeably beyond a certain length, plan your application around that shorter effective length, even if the nominal value is much larger.

    2.3 Multimodal Input Capabilities

    If your application processes screenshots, design drafts, charts, or video, test each input type separately:

    • Text recognition accuracy, especially for small fonts, tables, and handwritten content;
    • Reading numerical values from charts and identifying trends;
    • Generating runnable pages from design drafts, and checking whether the layout and interactions match the original image;
    • Temporal localization and summary quality for video content.

    Multimodal performance varies considerably across tasks. Build a separate sample set for each input type. Do not judge overall capability from a single example image.

    2.4 Long-Horizon Task Performance

    Single-turn Q&A does not reflect complex engineering work. Long-horizon tasks test whether a model can carry out several steps in sequence, such as reading requirements, locating files, modifying code, running tests, and correcting its work based on error messages. Measure these metrics:

    • First-pass success rate: the share of tasks that pass tests without manual intervention;
    • Average correction rounds: the number of iterations needed to go from the first output to a usable result;
    • Recovery from interruption: whether the model can continue after a tool call fails or the context is truncated.

    2.5 Inference Cost and Speed

    Model API costs usually consist of input and output charges. Many platforms charge a lower price for input tokens that hit the cache, so repeated system prompts and long document prefixes can significantly affect total cost. Output tokens are generally priced higher than input tokens, so calculate them separately when generating long content. For speed, monitor both time to first token and output tokens per second, since each affects the interactive experience differently.

    3. Building a Private Evaluation Set

    A private evaluation set is the most reliable basis for model selection. Follow three principles: draw samples from real business scenarios, cover different difficulty levels, and use judging criteria that can be automated wherever possible.

    3.1 Sample Design

    Divide samples by task type, with 20 to 50 samples per category:

    Category Example Judging Method
    Code fixing Given a failing test and source code, fix the bug Unit tests pass
    Feature generation Generate a module from a requirements document Test cases plus code review
    Page reproduction Generate an interface from a design image Screenshot comparison plus manual scoring
    Document analysis Read a long report and answer detailed questions Compare against reference answers

    3.2 Evaluation Framework Example

    The code below shows a minimal evaluation loop. The model call uses a placeholder function. In practice, replace it with the client for your chosen platform.

    1. import time
    2. from dataclasses import dataclass, field
    3. from typing import Callable
    4. @dataclass
    5. class EvalCase:
    6. case_id: str
    7. prompt: str
    8. judge: Callable[[str], bool] # Takes the model output and returns whether it passes
    9. tags: list[str] = field(default_factory=list)
    10. def call_model(model_name: str, prompt: str) -> str:
    11. # Placeholder implementation: replace with the actual model client call
    12. raise NotImplementedError
    13. def run_eval(model_name: str, cases: list[EvalCase]) -> dict:
    14. passed, latencies = 0, []
    15. for case in cases:
    16. start = time.perf_counter()
    17. output = call_model(model_name, case.prompt)
    18. latencies.append(time.perf_counter() - start)
    19. if case.judge(output):
    20. passed += 1
    21. return {
    22. "model": model_name,
    23. "pass_rate": passed / len(cases),
    24. "avg_latency_s": sum(latencies) / len(latencies),
    25. }

    Run the same sample batch on all candidate models in the same way, and fix sampling parameters such as temperature. Otherwise, the results cannot be compared. Generated output is inherently random, so run each sample several times and use statistical values.

    3.3 Interpreting the Results

    Do not rely on a single overall score. Report pass rates by task type, a list of failed samples, and cost data. If a model has a slightly higher overall score but a noticeably higher failure rate on key task types, base the decision on those key tasks.

    4. Cost Estimation Method

    Convert unit prices into the cost of a single task to compare the actual expense of different models. The function below calculates the cost of cache-hit input, cache-miss input, and output separately:

    1. def estimate_cost(input_tokens: int, cache_hit_ratio: float, output_tokens: int,
    2. price_hit: float, price_miss: float, price_out: float) -> float:
    3. """Prices are amounts per million tokens. Returns the cost of a single call."""
    4. hit_tokens = input_tokens * cache_hit_ratio
    5. miss_tokens = input_tokens - hit_tokens
    6. total = hit_tokens * price_hit + miss_tokens * price_miss + output_tokens * price_out
    7. return total / 1_000_000

    Estimate the cache hit ratio from your application’s real request structure. A code assistant that includes the same repository description and coding standards in every request usually has a high hit rate. Document Q&A, where each input differs, has a very low hit rate. The actual cost of the same model can differ several-fold between these two scenarios.

    5. Key Points for Engineering Integration

    5.1 Making Model Names Configurable

    Do not hardcode model names in business code. Manage them in a configuration file so you can switch models or run gradual rollouts without changing code:

    1. llm:
    2. default: model-large-v1
    3. routes:
    4. code_fix: model-large-v1
    5. summary: model-small-