How to Evaluate Large Language Models: A Practical Guide to Quality, Performance, and Cost Selection

    As generative AI adoption accelerates, choosing an LLM based on casual trial runs, peer recommendations, or a single impressive output usually leads to underwhelming quality and uncontrolled costs in production. This article treats model evaluation as an engineering problem rather than a matter of opinion, and lays out a practical framework across three dimensions: output quality, performance, and cost. It covers how to build a scoring rubric with reusable weights, how many test cases you actually need, a runnable evaluation script with injectable judge and threshold functions, the latency and concurrency metrics worth measuring (including why tail latency matters more than averages), a worked cost example based on token consumption, cost-control practices such as fine-grained tracking and tiered model routing, the most common evaluation mistakes, and a five-step selection workflow from requirements clarification through canary rollout and ongoing monitoring.

    1. How Should LLMs Be Evaluated, and Why Does It Need a Serious Framework?

    Generative AI is being adopted at a rapid pace, and models with very different capabilities keep appearing on the market. Many teams select a model based on scattered hands-on impressions, a colleague’s recommendation, or one lucky “wow” output. Subjective evaluation like this tends to surface later as underwhelming quality or runaway costs once the model goes into production.

    A mature engineering team should treat “how do we evaluate an LLM” as an engineering problem: it needs explicit metrics, a reproducible process, and quantifiable conclusions. This article approaches evaluation from three dimensions — quality, performance, and cost — and provides a method you can actually apply.

    2. Quality: Is the Model Actually “Smart” Enough?

    Quality evaluation is the starting point of any selection process, and the core question is simple: can this model do my job correctly? Evaluation generally covers three areas:

    • General capability: language understanding, logical reasoning, code generation, long-document summarization, and so on. Public industry benchmarks are useful for side-by-side comparison, but these datasets have often already been covered by training data, which limits their reference value. Treat them as a first-pass filter only.
    • Domain-specific capability: the most critical part. A model that performs well on general question answering may not be good at your vertical domain (healthcare, finance, legal, etc.), so you must build a private test set from real business samples.
    • Stability: does output quality hold steady for similar inputs? Production environments care more about the lower bound than the upper bound.

    Scoring rubric (reusable; example weights that you can adjust to your business):

    Dimension Weight 1 point 3 points 5 points
    General capability 30% Frequent reasoning errors Usable for routine tasks Stable on complex reasoning
    Domain-specific capability 40% Requires extensive manual correction Meets requirements on most use cases Directly usable
    Stability 30% Inconsistent Occasional jitter Stable lower bound

    A sample size of 100–500 cases covering both typical and edge scenarios is a good starting point: 100 cases are enough to eliminate clearly unqualified candidates in the first round; if several candidates are close and you need higher statistical confidence, expand to 300–500 cases. Pick one scoring approach and stay consistent throughout — either automated metrics such as accuracy, F1, or BLEU (with fixed thresholds defined), or a set of human review rules.

    The code below runs as-is; both judge and threshold are passed in as arguments, so it will not break when you copy it:

    1. def evaluate_model(model_client, test_set, threshold, judge):
    2. """judge(output, expected) must return a score from 0 to 1.
    3. It can be replaced with automated metrics such as accuracy, F1, or BLEU,
    4. or wrapped around a human or LLM-based review implementation.
    5. threshold is the pass mark."""
    6. results = []
    7. for case in test_set:
    8. output = model_client.chat(case["prompt"])
    9. score = judge(output, case["expected"])
    10. results.append(score)
    11. return {
    12. "avg_score": sum(results) / len(results),
    13. "min_score": min(results),
    14. "pass_rate": sum(1 for s in results if s >= threshold) / len(results),
    15. }

    3. Performance: Is It Fast Enough, and Can It Take the Load?

    Meeting the quality bar is only the passing grade. Whether a model can satisfy the latency and throughput requirements of your live business determines whether it can actually go into production.

    • Response latency: this includes time to first token (TTFT) and the time to complete generation. Conversational applications are especially sensitive to first-token latency, while batch jobs can tolerate longer generation cycles.
    • Concurrency: does the service queue noticeably or start throttling under high concurrency? This depends on the underlying compute supply and the provider’s load-scheduling strategy.
    • Context length: can it handle long documents or large blocks of code in a single request? For long context, the limit is only half the story — you also need to check whether quality degrades as you approach that limit. Degradation is typically more pronounced near the edge of the context window, and how much it degrades depends on the model architecture and implementation.

    Run load tests at concurrency levels comparable to production and record P50/P95/P99 latency rather than averages alone — tail latency (P95/P99) is often what determines the user experience, and averages tend to hide long-tail problems.

    4. Cost: Making Every Unit of Budget Count

    This is the area teams most often overlook, and the one that most directly determines return on investment. Model billing generally revolves around input tokens and output tokens, so evaluation cannot stop at unit price — you have to estimate the total consumption per completed unit of work:

    1. Cost per task ≈ input_tokens × input_price_per_token + output_tokens × output_price_per_token
    2. Total monthly cost ≈ cost per task × daily calls × 30

    Worked example with numbers (the prices and token counts below are illustrative assumptions — replace them with the actual pricing of the service you choose): assume an input price of 0.008 per 1K tokens and an output price of 0.032 per 1K tokens. If a single task consumes about 2,000 input tokens and 500 output tokens, then:

    1. Cost per task ≈ 2000/1000 × 0.008 + 500/1000 × 0.032
    2. ≈ 0.016 + 0.016 = 0.032 (same currency unit)
    3. If there are 10,000 calls per day:
    4. Total monthly cost ≈ 0.032 × 10000 × 30 ≈ 9,600 (same currency unit)

    A common mistake is going into production without estimating token consumption at all — quotas then run out quickly, forcing you either to scale up and increase the budget or to run dry on critical tasks. A few rules that hold up in practice:

    1. Track consumption in detail: log token usage for every call and build a consumption dashboard so you can see the cost share of each workload.
    2. Plan quotas sensibly: set buffer on top of expected business volume to avoid queuing or failed calls at peak times.
    3. Use a tiered routing strategy: send simple tasks to lightweight models and reserve high-capability (usually more expensive) models for complex reasoning, controlling total cost through a cost-performance tiering approach.
    4. Avoid wasted consumption: cut off calls that genuinely produce no value instead of firing meaningless requests to “use up the quota” — sunk cost should not drive decisions.

    5. Common Evaluation Mistakes and How to Choose a Model

    • Trusting public benchmarks only: the data may already be covered by training, which limits reference value — rely on your private test set.
    • Looking at average latency only: ignoring tail latency can derail the production experience.
    • Ignoring the cost ceiling: without estimating token consumption, you run out of quota the moment you launch.
    • Chasing the strongest instead of the most suitable: the best choice is not “who is strongest” but the best balance of quality, performance, and cost.

    6. A Practical Selection Workflow

    Bringing these dimensions together, you can distill a standard process:

    • Step 1: Clarify requirements. Define the task type, accuracy requirements, latency requirements, and budget ceiling.
    • Step 2: Validate on a small sample. Use your private test set to quickly narrow the field to 2–3 candidate models.
    • Step 3: Run load tests and cost analysis. Evaluate performance under realistic load and estimate monthly cost based on your expected call volume.
    • Step 4: Canary rollout. Start with a small share of traffic, and observe actual quality alongside the consumption curve.
    • Step 5: Monitor continuously. After launch, track quality and cost through log services and monitoring alerts, and iterate as needed.

    For teams that want to control model capability within their own environment, a cloud platform with model serving plus log monitoring and alerting capabilities (for example, Baidu AI Cloud — this is an example of a capability set, not a purchase recommendation) can serve as the technical foundation for a closed evaluation and operations loop.

    Conclusion

    Evaluating an LLM is never just about “who is strongest” — it is about finding the solution that best fits your own business across quality, performance, and cost. Building a scientific evaluation framework, getting the cost math right, and avoiding pointless compute waste is the right way to make generative AI deliver real value.