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.
import timefrom dataclasses import dataclass, fieldfrom typing import Callable@dataclassclass EvalCase:case_id: strprompt: strjudge: Callable[[str], bool] # Takes the model output and returns whether it passestags: list[str] = field(default_factory=list)def call_model(model_name: str, prompt: str) -> str:# Placeholder implementation: replace with the actual model client callraise NotImplementedErrordef run_eval(model_name: str, cases: list[EvalCase]) -> dict:passed, latencies = 0, []for case in cases:start = time.perf_counter()output = call_model(model_name, case.prompt)latencies.append(time.perf_counter() - start)if case.judge(output):passed += 1return {"model": model_name,"pass_rate": passed / len(cases),"avg_latency_s": sum(latencies) / len(latencies),}
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:
def estimate_cost(input_tokens: int, cache_hit_ratio: float, output_tokens: int,price_hit: float, price_miss: float, price_out: float) -> float:"""Prices are amounts per million tokens. Returns the cost of a single call."""hit_tokens = input_tokens * cache_hit_ratiomiss_tokens = input_tokens - hit_tokenstotal = hit_tokens * price_hit + miss_tokens * price_miss + output_tokens * price_outreturn 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:
llm:default: model-large-v1routes:code_fix: model-large-v1summary: model-small-
