Practical Framework for Evaluating Large Language Models: A Task-Driven Selection Guide

    This article introduces a practical framework for evaluating and selecting large language models (LLMs) based on specific business tasks. It covers how to interpret model specifications, design custom evaluation datasets, understand public leaderboards, calculate API costs, and choose the right deployment method to ensure optimal model selection for your needs.

    1. Define Evaluation Goals First

    Before evaluating an LLM, answer one question: what type of work is the model meant to replace? The same score means completely different things for code completion, long document retrieval, and UI visual restoration. It is recommended to categorize business tasks into three types: single-turn Q&A, multi-step engineering tasks, and multimodal understanding. Each task type corresponds to different metrics. Scoring them collectively often leads to conclusions that lack practical guidance.

    2. Understand the Real Meaning of Specifications

    2.1 Parameter Scale and MoE Architecture

    Total parameters describe a model’s capacity, but inference cost depends primarily on the parameters actually activated during each forward pass. Models using the Mixture of Experts (MoE) architecture contain numerous expert subnetworks, routing each input to only a few of them. Therefore, a large total parameter count does not mean every call is expensive, nor does it guarantee better performance than a dense model of the same scale. When evaluating, you should look at total parameters, activated parameters, throughput, and latency simultaneously.

    2.2 Context Window: Capacity vs. Effectiveness

    A million-level context window only indicates the maximum input length the model can receive; its effective utilization rate must be measured separately. Two common practices exist. First, embed a retrievable fact at different positions within a long text to observe recall across various lengths. Second, have the model perform cross-file reasoning to test whether it can connect scattered information. The longer the input, the higher the time-to-first-token (TTFT) and cost usually are. Therefore, the benefits of a long context must be weighed against its costs.

    2.3 Multimodal Input

    For image and video understanding, three capabilities must be distinguished: the ability to correctly identify elements, the ability to understand temporal and causal relationships, and the ability to convert visual information into executable structured output (e.g., page layout descriptions, component lists, or code). Multimodal models with text output are suitable for UI review, chart interpretation, and video content summarization, but tasks requiring high pixel-level precision still need manual review.

    3. Design Your Own Evaluation Set

    Public leaderboards reflect general capabilities; business impact requires building your own evaluation set. A usable eval set typically contains 50 to 200 real tasks, covering normal samples, edge cases, and error-prone samples, with each sample accompanied by auto-verifiable criteria.

    Below is a simplified evaluation script to record pass rate, average latency, and total cost:

    1. import time
    2. from dataclasses import dataclass
    3. from typing import Callable
    4. @dataclass
    5. class Case:
    6. prompt: str
    7. check: Callable[[str], bool] # Receives model output text, returns whether it passed
    8. def run_eval(call_model, cases, price_in, price_out):
    9. """price_in and price_out are the unit prices per million tokens."""
    10. passed, total_cost, latencies = 0, 0.0, []
    11. for case in cases:
    12. start = time.perf_counter()
    13. resp = call_model(case.prompt) # Needs to return text, in_tokens, out_tokens
    14. latencies.append(time.perf_counter() - start)
    15. total_cost += (resp["in_tokens"] * price_in
    16. + resp["out_tokens"] * price_out) / 1_000_000
    17. if case.check(resp["text"]):
    18. passed += 1
    19. return {
    20. "pass_rate": passed / len(cases),
    21. "avg_latency_s": sum(latencies) / len(latencies),
    22. "total_cost": total_cost,
    23. }

    The validation function should be as deterministic as possible. Code tasks can run unit tests, structured outputs can validate JSON formats, and numerical questions can match exact answers. For subjective tasks like UI quality, it is appropriate to use a scoring rubric and conduct blind comparison tests by reviewers.

    4. Interpret Leaderboards Correctly

    Leaderboards provide filtering clues but cannot directly give conclusions. Note the following when reading them:

    • Verify the test time and model version. Models with the same name may be updated multiple times, and the scored version may not be the currently available one.
    • Verify the test conditions, including whether the toolchain, system prompts, and inference parameters are consistent.
    • Blind voting reflects human preferences, but the results are influenced by question distribution and reviewer demographics, which does not equate to accuracy.
    • Beware of data contamination. Public questions may have entered the training data, inflating the scores.
    • Change “what rank is it” to “how much does it differ on my task.” That is the basis for decision-making.

    5. Cost Calculation Methods

    Many API pricing schemes split input into cache-hit and cache-miss portions, calculating output fees separately. The total cost is calculated as follows:

    Total Cost = Cached Input Tokens × Cache Price + Uncached Input Tokens × Input Price + Output Tokens × Output Price

    The following figures are for demonstration purposes only and do not represent actual prices of any product. Assume a task includes 200,000 input tokens per request, of which 150,000 hit the cache, and outputs 20,000 tokens. If the cache price is $1 per million tokens, uncached input is $10, and output is $50, the single request cost is 0.15 + 0.5 + 1.0 = $1.65.

    In multi-step agent flows, long contexts are repeatedly sent at each step, making the cache hit rate the biggest cost variable. When designing prompts, place stable content (system instructions, tool definitions, reference documents) in the prefix and variable content at the end to increase the cache hit rate.

    6. Deployment Methods and Selection

    • Cloud API: Fast integration, no compute management required, but you need to evaluate data compliance requirements and accept the vendor’s version iterations and rate limiting policies.
    • Local or Private Deployment: Data is controllable, but hardware must be evaluated. A rough estimate for weight VRAM is: Parameter count × bytes per parameter. For FP16 (2 bytes per parameter), a 100-billion parameter model requires about 200 GB of VRAM, not including KV cache and concurrency overhead.
    • Open Weights: Before deployment, check the license terms, including commercial use scope, redistribution limits, and attribution requirements.

    7. Implementation Roadmap

    1. Select 1 to 2 high-frequency tasks for a small-scale pilot.
    2. Establish a baseline, comparing pass rate, time, and cost against existing solutions.
    3. Canary release with a rollback switch retained.
    4. Log failure samples and continuously monitor key metrics.
    5. After model updates, re-run the evaluation set to confirm no performance regression.

    8. Conclusion

    LLM evaluation should start from tasks. Specifications define capability boundaries, custom evaluation verifies actual effects, and the cost model determines scalability. Leaderboards are suitable for narrowing down candidates, but final decisions should be based on your own data.