Evaluating Large Language Models: A Dual Yardstick for Capability and Cost

    A practical guide to scientifically evaluating large language models (LLMs). It explains why informal prompt testing falls short, breaks evaluation into four core dimensions—capability, latency, reliability, and cost—and shows how token-based pricing makes even simple tasks expensive. It then walks through cost estimation, task tiering and model routing, and hands-on cost-control techniques such as prompt compression, caching, streaming with length limits, observability, and async queueing, so teams can balance capability against cost.

    Evaluating Large Language Models: A Dual Yardstick for Capability and Cost

    1. “Looks Usable” Is Not the Same as “Passed Evaluation”

    Many teams pick a large language model by trying a few prompts by hand, and if the answers look decent, they push it straight into production. This kind of “gut-feel evaluation” has clear flaws: the sample size is too small, the task distribution isn’t realistic, and there is no cost perspective at all—so online performance ends up diverging sharply from expectations.

    A common failure looks like this: the model shines in a demo, but when it runs real workloads, even simple tasks eat through tokens and the quota dries up fast. During peak hours requests queue up, and actual throughput falls well below the advertised number. This shows that evaluation has to answer two questions at once—is capability sufficient, and is the unit cost worthwhile.

    A rigorous evaluation should be a reproducible, quantifiable engineering activity, not a subjective impression. The sections below break it down along four core dimensions.

    2. The Four Core Dimensions of Evaluation

    1. Capability

    Capability is the most intuitive dimension and the easiest to overestimate. Instead of assigning a single overall score, split evaluation by task type:

    • Comprehension tasks: information extraction, intent recognition, summarization
    • Generation tasks: code completion, copywriting, structured output (e.g., JSON)
    • Reasoning tasks: multi-step logic, math, causal analysis
    • Long-context tasks: cross-document retrieval, long-form question answering

    For each category, prepare 50–200 real business samples as an evaluation set rather than substituting public leaderboards for your own data. Public leaderboards only show that “the average is decent”; they cannot reflect your actual business distribution.

    2. Latency

    What users perceive is not only answer quality but also waiting time. Two metrics need to be distinguished:

    • Time to first token (TTFT): affects how “responsive” the interaction feels
    • End-to-end latency: the total time to finish generating the whole response

    For streaming output, TTFT matters more than total latency; for batch processing, focus on overall throughput per unit of time.

    3. Reliability

    This includes rate-limit frequency, queueing at peak times, error rate, and timeout rate. Reliability directly sets the floor for user experience. A stronger model that frequently queues or times out may be less usable in production than a slightly weaker model that responds consistently.

    4. Cost

    This is the most easily overlooked dimension, yet the one that most affects long-term sustainability—and it is the core pain point in the original scenario.

    3. Token Cost Modeling: Why Even Simple Tasks Burn Through Your Quota

    An LLM’s billing and resource consumption are usually determined by input tokens + output tokens, not by the “number of requests.” Understanding this explains why “I only did one or two small things and the quota is already gone.”

    Three main factors amplify cost:

    1. Context bloat: every request carries the system prompt, conversation history, and reference material, so input tokens grow roughly linearly with the number of turns.
    2. Output redundancy: if the model tends to be long-winded, output tokens climb sharply—and output is usually priced higher per token.
    3. Ineffective retries: regenerating an unsatisfactory answer consumes tokens repeatedly without producing anything useful.

    A Cost Estimation Model

    You can roughly estimate the cost per call as follows (illustrative code; use the actual service’s parameters):

    1. def estimate_call_cost(input_tokens, output_tokens,
    2. in_price_per_1k, out_price_per_1k):
    3. """Price input and output tokens separately to estimate the cost per call"""
    4. input_cost = (input_tokens / 1000) * in_price_per_1k
    5. output_cost = (output_tokens / 1000) * out_price_per_1k
    6. return input_cost + output_cost
    7. def estimate_daily_budget(qps, avg_in, avg_out,
    8. in_price, out_price, seconds=86400):
    9. """Work backward from request rate and average token volume to a daily budget"""
    10. calls_per_day = qps * seconds
    11. per_call = estimate_call_cost(avg_in, avg_out, in_price, out_price)
    12. return calls_per_day * per_call

    With this model, “it feels like money is burning” becomes a quantitative conclusion: how much budget you need per day and how long it will last—so you can make rational capacity-planning decisions.

    4. Task Tiering and Model Routing: Spend Your Budget Where It Matters

    Not every task needs the strongest, most expensive model. Task tiering + model routing is the most effective architectural approach to controlling cost.

    The core idea is to use a lightweight classifier to judge task difficulty first, then route to models of different sizes. A sketch:

    1. def route_task(task_text, models):
    2. """
    3. Pick a model tier based on task complexity.
    4. models: {"simple": m_light, "complex": m_strong}
    5. """
    6. # Simple heuristic; can be replaced with a classifier in production
    7. is_complex = len(task_text) > 1000 or "analysis" in task_text or "reasoning" in task_text
    8. return models["complex"] if is_complex else models["simple"]
    9. result = route_task(user_query, {
    10. "simple": light_model, # summarization, classification, simple Q&A
    11. "complex": strong_model, # complex reasoning, code generation
    12. })

    Here the simple tasks that make up 70%–80% of requests are handled by low-cost models, and only the few high-value tasks call the expensive model—so overall cost can often drop by an order of magnitude.

    5. Engineering Practices for Cost Control

    • Prompt compression: trim the system prompt, remove redundant conversation history, and use summaries in place of full context to directly cut input tokens.
    • Result caching: cache results for high-frequency, deterministic requests (e.g., FAQs, fixed-template generation) and return on a hit to avoid repeated calls.
    • Streaming output + length limits: cap output with max_tokens to prevent runaway generation, and pair it with streaming responses to improve perceived speed.
    • Observability: use logging and monitoring/alerting to track token consumption and cost by business and by caller, set budget-threshold alerts, and avoid the quota being accidentally exhausted.
    • Async processing and queue-based peak shaving: for latency-insensitive batch tasks, decouple asynchronously through a message queue to smooth out peak load and reduce pressure on synchronous queueing resources.

    6. Conclusion

    Scientifically evaluating a large language model is essentially building a two-dimensional “capability–cost” yardstick: capability decides whether it can be used, while cost efficiency decides whether it can be used sustainably and economically. Teams are advised to build evaluation sets from real business data, score across the four dimensions of capability, latency, reliability, and cost, and then keep optimizing through task tiering, model routing, caching, and observability.

    Only when evaluation moves from “gut feel” to “data-driven” do quotas and budgets truly become controllable—and only then can limited compute deliver the best value for money. If you need to host evaluation data, schedule asynchronous tasks, or build a monitoring and alerting system, you can draw on general-purpose cloud capabilities such as object storage, message queues, container platforms, and monitoring/alerting services (for example, the related infrastructure offered by Baidu AI Cloud) to turn evaluation and cost governance into a sustainable engineering capability.