How to Evaluate and Select Large Language Models: A Practical Methodology

    \$\$This article presents a general framework for evaluating and selecting large language models based on your own business needs rather than public leaderboards. It covers four core dimensions—accuracy, latency, token consumption, and cost—along with engineering practices for reproducible testing, version comparison, capability validation, and final selection guidance.

    1. Why Leaderboards Are Not Enough

    Large language models are iterating quickly. Context windows are expanding from the 128K level toward 200K tokens, and tool calling and agentic task orchestration during inference are becoming standard capabilities. Vendors often publish impressive single metrics, yet developers frequently find a gap between leaderboard rankings and real-world experience. The reason is simple: the question distribution, prompt style, and call parameters in public evaluation sets do not match your business scenarios.

    Model selection therefore cannot rely on a single score. You need an evaluation methodology built around your own business. This article abstracts a general framework covering four metric categories—accuracy, latency, token consumption, and cost—and provides a practical engineering implementation.

    2. Four Core Dimensions of the Evaluation Framework

    2.1 Accuracy: Layered Statistics Instead of a Single Total Score

    A single total score can hide structural weaknesses. Group questions by capability domain—for example, knowledge Q&A, logical reasoning, code generation, long-document understanding, and tool calling—then compute the pass rate for each domain and combine them into a weighted total. Only after layering can you answer whether a model actually works for your primary scenario.

    1. # Example: layered accuracy statistics
    2. domains = ["knowledge", "reasoning", "code", "long_context", "tool_use"]
    3. result = {d: {"pass": 0, "total": 0} for d in domains}
    4. for item in dataset:
    5. out = call_model(item["prompt"])
    6. ok = judge(out, item["gold"])
    7. d = item["domain"]
    8. result[d]["total"] += 1
    9. result[d]["pass"] += int(ok)
    10. score = {d: v["pass"] / max(v["total"], 1) for d, v in result.items()}

    2.2 Response Latency: Separate TTFT from End-to-End Time

    Average duration is skewed by long-tail requests. Record both time to first token (TTFT) and end-to-end duration, and observe P50/P95 percentiles. For interactive applications, TTFT determines perceived responsiveness; for batch jobs, end-to-end throughput matters more. A number like “59 seconds on average” alone cannot tell you whether the bottleneck is queuing, inference, or network.

    2.3 Token Consumption: Measure Input and Output Separately

    Average consumption is on the order of about 2851 tokens per call, and prompt engineering plus context trimming can create several-fold differences. During evaluation, record input and output tokens separately and fix the maximum output length; otherwise models are not comparable. In long-context scenarios, input tokens usually account for the vast majority, making retrieval augmentation and summary compression the main optimization approaches.

    2.4 Total Cost: Normalize to Cost per Thousand Calls

    Converting token unit price and call volume into “cost per thousand calls” is closer to budgeting than unit price. The 37.6 CNY per thousand calls in the example uses this kind of measure. Cost must be viewed together with accuracy: if accuracy improves by only 2 percentage points while cost doubles, cost-effectiveness actually declines.

    3. How to Read New vs. Old Version Comparisons

    Version upgrades commonly show three types of change: a small accuracy improvement (for example, from 66.6% to 68.7%, about 2.1 percentage points), a notable jump in ranking, and improved response speed. Keep three points in mind when reading such data:

    • A ranking jump is affected by competitors iterating at the same time and does not equal an absolute capability gain;
    • 2 percentage points may be statistically meaningful on a sample of tens of thousands, but a confidence interval should be provided;
    • A 40% speed improvement requires stating whether test conditions were identical; otherwise it is not comparable.

    The conclusion should land on “whether it meets the business threshold,” not “whether it is better than the previous version.”

    4. Engineering Validation of Capabilities

    • Long context: Use two question types—“needle retrieval” and “cross-segment reasoning”—to verify whether a 200K window is genuinely usable rather than merely able to fit content.
    • Tool calling: Build multi-turn function call chains and check parameter structure validity and error recovery.
    • Agentic tasks: Set up composite tasks requiring retrieval, computation, and file writing, and measure completion rate and redundant steps.
    • Writing style: Use human blind evaluation plus preference consistency scoring to avoid a single subjective judgment.

    5. Key Practices for Reproducible Evaluation

    1. Fix randomness parameters (such as temperature and sampling strategy) and the maximum output length;
    2. Archive the dataset, scoring scripts, and model version together to ensure traceability;
    3. Use concurrency-controlled calls to avoid rate limiting distorting latency data;
    4. Integrate evaluation into continuous integration so that model or prompt changes trigger regression;
    5. Aggregate cost data by period and observe it alongside call volume and cache hit rate.

    When deploying on the cloud, you can use a container platform to run evaluation jobs, object storage to save datasets and results, and logging and monitoring/alerting services to track latency and failure rate. Cloud platforms such as Baidu AI Cloud typically provide these general capability categories, making it easier to turn evaluation into a routine pipeline.

    6. Selection Recommendations

    If your business centers on long documents and agentic workflows, prioritize validating effective utilization of long context and tool-calling success rate; for high-concurrency interactive scenarios, prioritize TTFT and P95; if cost-sensitive, choose the lower cost-per-thousand-calls option while meeting the accuracy threshold. The final decision should be supported by layered data, confidence intervals, and business thresholds—not a single ranking or a one-off demo.