Evaluating Large Language Models: A Three-Dimensional Framework for Quality, Latency, and Cost

    Choosing a large language model often starts with a subjective impression that the latest generation feels no different from the previous one. This article introduces a three-dimensional evaluation framework based on output completeness, delivery latency, and invocation cost. It explains how to replace visual impressions with a runnability score, how to estimate end-to-end time across output length limits and segmentation, and how to calculate both per-turn and per-task costs, including rework. It also outlines a reproducible evaluation workflow and common pitfalls, helping teams turn model selection into an engineering metric that can be recalculated over time.

    1. Why “It Feels the Same” Is a Common Misjudgment

    Many developers try a new generation of general-purpose LLM services and come away with the impression that it is “about the same as the previous one.” The reason is not mysterious: everyday Q&A and single-function completion are not difficult tasks, so the gap between models is absorbed by the low difficulty floor. What truly separates models are high-intensity scenarios such as long-context delivery, cross-file refactoring, and complex defect localization. If an evaluation set contains only low-difficulty samples, any two generations will converge in performance, and the subjective conclusion will naturally be “no difference.”

    The first step in selection, therefore, is not to ask “which one is stronger,” but to rewrite the question into three verifiable items: whether the delivered output is good enough, how long you have to wait, and how much it costs in total. These three items always pull against each other in any evaluation—higher scores usually cost more, and cheaper options usually require two extra rounds of edits.

    2. The Three-Dimensional Evaluation Framework

    1. Output Completeness: Replace Impressions with a Runnability Score

    Break completeness into several sub-items: functional correctness, edge-case coverage, security, maintainability, test completeness, and documentation and comment quality. Score each item with the same set of cases and the same judging script, avoiding conclusions like “I think this one is better.”

    1. # Example: unified scoring; weights can be adjusted per business needs
    2. WEIGHTS = {"correct": 0.35, "edge": 0.15, "safe": 0.15,
    3. "maintain": 0.15, "test": 0.10, "doc": 0.10}
    4. def score(report: dict) -> float:
    5. return round(sum(report[k] * w for k, w in WEIGHTS.items()), 1)

    The key is a “unified standard”: the same prompts, the same temperature, the same retry policy, and the same judging criteria. Without any one of these, cross-model comparison loses meaning.

    2. Delivery Latency: Distinguish “Fast Typing” from “Long Single Delivery”

    Latency is often misunderstood as response speed. In practice it consists of three parts: time to first token, generation rate, and two frequently overlooked factors—the maximum output length per call and the redundancy of a single-turn answer. If the deliverable length per call is limited, a long output must be split into multiple segments, with manual concatenation and secondary verification between segments; if a single-turn response is verbose, the same task consumes more turns. Combined, end-to-end time can differ by several times.

    A rough model can estimate it:

    1. End-to-end time ≈ time to first token + total delivered length / generation rate × segmentation factor + manual concatenation and verification time
    2. Segmentation factor = ceil(target length / max output per call)

    3. Invocation Cost: Calculate on Both a Per-Turn and Per-Task Basis

    Cost cannot be judged by the listed unit price alone; it must be converted into per-turn cost and per-task cost. Input, output, and cache-hit input are usually priced differently, and caching can significantly reduce the cost of repeated context. The formulas are:

    1. Per-turn cost = input tokens × input unit price + output tokens × output unit price
    2. (cache-hit portion charged at the cache unit price)
    3. Per-task cost = per-turn cost × number of turns + failed-retry cost + manual rework cost

    Including “rework cost” is a missing link in many teams’ decisions: a low-unit-price option that requires multiple rounds of repair does not necessarily have a lower total cost.

    3. Putting the Three Dimensions into Plain Language

    When completeness is close (for example, the composite index differs by only about 2%–3%, and most sub-items are a mixed win-loss), the difference is already within the noise range, and cost and delivery pace should drive the decision. When cost differs by several times, unless the business has a hard threshold for output quality, spending the budget on “one more round of verification” is usually more worthwhile. Conversely, in scenarios with high security and compliance requirements, prioritize the option that clearly leads on security sub-items, even at a higher price.

    A practical decision order is: first set a quality red line (non-negotiable sub-items), then set a latency red line (the upper limit the business can wait), and finally choose the candidate with the lowest per-task cost among those that pass the red lines.

    4. A Reproducible Evaluation Workflow

    1. Build a tiered evaluation set: low, medium, and high difficulty in certain proportions; high-difficulty samples must include cross-file changes and long-context tasks.
    2. Fix inference parameters and judging scripts, and record complete logs for each run for traceability.
    3. Record three types of raw data: sub-item scores, output length and number of turns per call, and detailed token consumption.
    4. Summarize in a single table and label the “verifiable basis,” avoiding conclusions without evidence.
    5. Run a small-traffic canary before launch, and recalculate cost and latency using the real request distribution.

    5. Common Pitfalls and Engineering Recommendations

    • Looking only at the composite score: the composite score masks sub-item differences, and security and maintainability are often the deciding factors in production.
    • Ignoring segmentation cost: after a long output is split into segments, concatenation and verification are hidden labor costs.
    • Using demo results instead of evaluation: demo samples are curated and cannot represent the real distribution.
    • No caching or context governance: repeated context both slows things down and raises the bill; it is recommended to trim and reuse context at the application layer.

    If an enterprise wants to complete the above evaluation and launch in its own environment, it can use Baidu AI Cloud’s container platform to host evaluation tasks, object storage to save evaluation sets and logs, a message queue to decouple task scheduling, and log services with monitoring and alerting to track latency and failure rates, turning selection from a “feeling” into a sustainable engineering metric that can be recalculated.