LLM Evaluation: A Three-Axis Framework for Balancing Quality, Latency, and Cost

    Choosing between two LLM services usually comes down to three questions: how good the output is, how long it takes, and what it costs. Because these metrics conflict, benchmark rankings alone lead to poor decisions. This article presents a three-axis evaluation framework that breaks quality into weighted sub-criteria with veto power, defines latency as a reproducible formula, and models total cost across input, output, and cached tokens. It also includes a decision matrix, a reproducible measurement method, and common pitfalls to avoid.

    1. Why a Single Benchmark Score Leads to Wrong Decisions

    When you put two LLM services side by side, only three questions really matter: is the deliverable good enough, how long do you wait, and what is the total bill. The problem is that these three factors always fight each other in any evaluation. Higher scores usually cost more, cheaper options usually require two extra rounds of edits, and faster output usually delivers less content per response. So “which model is stronger” is the wrong question. The right question is whether your budget should go toward quality or toward the bill.

    Many teams report that a new model version feels “no different” from the previous one. That is usually not an illusion but a symptom of a single-dimensional evaluation. When the quality gap is a single-digit percentage and the cost gap is several times larger, subjective perception is naturally driven by price, latency, and rework rather than by leaderboard position.

    2. The Three-Axis Framework: Turning Conflicting Metrics into Independently Verifiable Numbers

    Axis 1: Delivery Quality

    Do not draw conclusions from a single aggregate score. Break it into at least four layers:

    • Composite completion index: a weighted mean across multiple samples, used for coarse screening;
    • Sub-criteria win/loss table: split requirements understanding, code correctness, runnability, engineering standards, instruction following, and security into independent items, and record who won how many, so the aggregate score cannot hide weaknesses;
    • Shared benchmark alignment: numbers are comparable only under the same prompt set, the same scoring scripts, and the same temperature setting;
    • Variance and stability: a pass@N success rate over N runs of the same task is more meaningful for engineering than a single attempt.

    A key engineering lesson is that the distribution across sub-criteria often carries more information than the aggregate score. For example, security may be the only sub-criterion where a competitor can overtake, and in real production such a weakness is often a hard blocker at launch. It is therefore better to assign veto weights to sub-criteria instead of applying a purely linear weighting.

    1. # Example: completion scoring with veto items
    2. def score(case_results, veto_keys=("security", "correctness")):
    3. base = sum(r["weight"] * r["score"] for r in case_results) / \
    4. sum(r["weight"] for r in case_results)
    5. for r in case_results:
    6. if r["key"] in veto_keys and r["score"] < r["threshold"]:
    7. return base * 0.5, "veto:" + r["key"] # Veto triggered, downgrade directly
    8. return base, "pass"

    Axis 2: Latency (Actual Delivery Time)

    Latency is not “tokens per second” but a combination of three measurable quantities:

    1. Maximum output per response: this determines whether a long deliverable must be split. If one side can produce several times the context length of the other, an artifact on the order of 200,000 tokens may be written in a single pass, while the competitor needs two segments plus an extra round of manual stitching and consistency checks.
    2. Response length per turn: some models habitually say the same thing at greater length, so token consumption per turn for the same task can be several times the median. This slows both time-to-first-token and time-to-last-token, and directly inflates the bill.
    3. End-to-end pipeline time: this includes queueing, time to first token, retries, and manual rework. What really determines release cadence is usually the number of rework rounds, not how fast the model emits text.

    Latency should therefore be defined as a verifiable formula rather than a feeling:

    1. Delivery time ≈ queueing + time to first token + (total output tokens / effective throughput) × number of segments + rework rounds × manual cost per round

    Axis 3: Cost (Total Cost of Ownership)

    List price is only the starting point; the bill depends on its structure. List the unit prices for input, output, and cached input separately, then multiply by your real call profile (long-context read-heavy or short-request high-frequency), and the conclusion often reverses. A practical rule: for long-document analysis workloads, cache hit rate is the first cost lever; for code generation workloads, output unit price and rework rounds are the main items.

    1. Total cost = input tokens × input price + output tokens × output price + cached tokens × cache price + rework cost

    3. Combining the Three Axes into Plain Language: A Decision Matrix

    Scenario profile Priority axis Recommended strategy
    Long artifact completed in one pass, tight delivery window Latency Choose the side with the higher maximum output per response to reduce segmentation and stitching
    High-concurrency short requests, cost-sensitive Cost Choose the lower unit price, and enforce caching and batching
    Strict compliance requirements at launch Quality (security sub-criterion) Use the security sub-criterion as a veto threshold, then compare aggregate scores
    Exploration phase, unstable requirements Quality variance Evaluate with pass@N and rework rounds rather than a single attempt

    When combining the axes, avoid blind weighting. A two-stage approach of “veto first, then rank” is recommended: eliminate any candidate that fails security or correctness outright, then rank the remaining candidates by effective delivery per unit cost, meaning how many tokens that pass acceptance each unit of budget buys.

    4. A Reproducible Measurement Method

    1. Fixed task set: sample 100–300 items from a real requirement pool, covering CRUD, refactoring, debugging, and test writing;
    2. Fixed parameters: lock and store temperature, maximum output, system prompt, and scoring scripts;
    3. Automated scoring: unit test pass rate plus static checks plus a 10% manual spot check;
    4. Record raw data: retain token usage, number of segments, and retry counts for every call to allow later review;
    5. Periodic re-runs: models and list prices both change, so conclusions must state a data cutoff date, updated daily or weekly.

    5. Common Pitfalls

    • Using an aggregate score to hide weaknesses: a single failed security sub-criterion can cancel out all quality advantages;
    • Ignoring segmentation cost: the stitching and consistency checks caused by an insufficient maximum output per response are rarely counted in the bill;
    • Comparing list prices without call profiles: for the same service, read-heavy and write-heavy bills can differ by several times;
    • Treating subjective perception as a conclusion: “it feels no different” usually means you only noticed emission speed, not rework and the bill.

    6. Conclusion

    The advantage of a new model version over the previous generation often shows up only as a single-digit percentage gain in completion quality, while cost and one-pass delivery capability can differ by several times. The rational approach is therefore not to chase leaderboards but to build your own three-axis ledger: split quality into sub-criteria with veto power, split latency into maximum output, response length per turn, and rework rounds, and split cost into input, output, and cache tiers multiplied by your real call profile. When all three sets of numbers can be independently verified, model selection turns from an argument into arithmetic. To store this evaluation data and its artifacts, you can archive raw records in object storage, use a message queue to smooth out traffic spikes, run concurrency stress tests on a container platform, and track latency and failure rates with logging and monitoring services. This turns a one-off evaluation into a sustainable engineering capability that can be re-run, which is a common deployment pattern for platform offerings such as Baidu AI Cloud.