Skip to main content

Chapter 31. Economics and Efficiency

Juniper’s new version resolves more tasks, but it also makes more model calls and sends more cases to human support. The team calls it “better” because completion improved, while finance asks whether the extra resolutions justify the expense and support asks whether the added latency and escalation workload fit the service. They are looking at the same candidate, but they need different evidence to make the decision.

Efficiency evaluation connects an outcome to the resources spent achieving it. A cheap attempt can be expensive if it often fails, while a more costly run may be justified for a high-value or high-risk task. Rather than compressing every concern into one score, compare quality, cost, and latency on the same population, then apply explicit safety and service constraints before deciding what to deploy.

After this chapter you will be able to:

Illustrative case. All prices, costs, and scores in this chapter are fictional. Use current provider and infrastructure rates for real decisions.

31.1 Cost per task and cost per success

Suppose Juniper’s candidate succeeds more often than its predecessor but needs extra calls to get there. Cost per attempt shows what the system spends on the workload, but not how much of that spend produces a useful outcome. Cost per success relates the same spend to the number of verified successes:

  • Cost per attempt = total attributable cost / attempted tasks.
  • Cost per success = total attributable cost for all eligible attempts / verified successful tasks.

Include model tokens, tool calls, retries, human review, infrastructure, and failure handling where they fall within the stated accounting boundary. Costs from failed and abandoned attempts belong in the numerator too, because counting only successful runs would hide the expense of failure. Before comparing systems, define the task unit, measurement period, treatment of missing outcomes, and whether escalations count as successes. Cost per success is undefined when there are no verified successes; report it as undefined, not zero.

At a fixed cost per attempt, lower reliability raises cost per success. In practice, both cost and reliability can change, so measure them rather than assuming that relationship alone settles the comparison. Use the same task population and success definition for both systems, and report cost distributions and task slices because long-tail episodes may dominate total expense. Separate fixed engineering and platform costs from marginal per-task costs. A low cost per success is not a substitute for showing failure rates and harms.

31.2 Quality–cost–latency Pareto frontiers

Now imagine the incumbent is cheaper and faster, while the candidate resolves more tasks. Neither is automatically better on all three dimensions. To describe that trade-off, a system is Pareto-dominated if another is at least as good on every chosen dimension and strictly better on at least one. With quality to maximize and cost and latency to minimize, a dominated option offers no advantage on those measured dimensions.

Plot quality against cost, with latency encoded separately or in facets, and state exactly which units and summaries the axes use. If safety is a hard constraint, exclude systems known to violate it before comparing efficiency; missing safety evidence is not a pass. The resulting frontier contains the nondominated options among those evaluated on the selected dimensions. It does not choose a winner or show that an option is safe, affordable, or suitable for every task slice.

Product requirements determine which remaining trade-off is acceptable. Account for uncertainty from task sampling and run variation, since a frontier computed from point estimates can change when estimates are noisy. Examine paired comparisons and important slices before treating a small apparent advantage as decisive.

31.3 Designing an eval budget

The evaluation itself has a cost, so a team with a fixed budget must choose between more tasks, more repeats, better labels, and deeper investigation. Start with the decision and the smallest change that would matter, then allocate resources to task coverage, repeated runs, human labels, judge calibration, and environment costs. Give high-risk and uncertain slices enough review, and retain a probability sample when the goal is a population estimate.

Set the sample plan and stopping rules before looking at candidate results, and reserve budget for investigation when a gate fails or the evidence is inconclusive. A smaller paired study on the same tasks can be more informative than a larger unpaired score collection, although it still needs enough independent tasks and representative coverage. Whatever the allocation, report omitted slices, unresolved uncertainty, and any budget-driven limits on the decision. Spending less on measurement is not a saving if the result cannot support the release claim.

31.4 Adaptive sampling and caching

When the initial results are uncertain, adaptive sampling can direct additional runs toward cases with high uncertainty or decision value. Those extra runs help diagnose the systems, but a queue enriched for difficult cases does not represent ordinary traffic by itself. Record the selection policy, sampling unit, draws, and applicable inclusion or selection probabilities. If a population estimate is needed, use an estimator appropriate to the actual design; if probabilities or coverage are unavailable, report the targeted results separately rather than presenting them as population rates.

Keep a fixed common core for release comparisons and add adaptive cases for investigation. Prespecify how those adaptive results enter any decision, and use an analysis or stopping method appropriate to repeated looks.

Caching saves a different kind of cost by avoiding work that need not be repeated. Deterministic preprocessing and immutable oracle results are natural candidates when their inputs and versions are tracked. Model outputs can be reused for a defined replay only when all material run conditions are represented in the key and reuse is valid for the intended comparison. A cache hit is not a fresh stochastic observation, and reusing an old response can conceal a changed model or environment. Validate invalidation when prompts, models, tools, policies, or other relevant inputs change.

31.5 Judge cascades and small judges

Judging can consume a large share of the evaluation budget. A cascade sends suitable cases through deterministic checks or a calibrated small judge, then routes uncertain, high-risk, or disputed cases to a stronger judge or qualified human reviewer. The saving is worthwhile only if the early stages are trustworthy on the cases they keep. A confident judge is not necessarily a correct one.

Measure the share each stage handles, agreement with independently adjudicated labels, severe-error false negatives, escalation rate, latency, and total cost—including downstream review and rework. Evaluate the complete routing policy as well as each judge, and report how the audit sample was selected. Because rare critical errors need enough relevant evidence to assess miss rates, observing none in a small audit does not prove that the cascade is safe.

Optimize expected total cost subject to explicit quality and safety constraints. A cheap judge that misses a critical error is not an acceptable replacement merely because its average agreement is high. To check the routing policy over time, maintain periodic probability-based audits of cases the cascade considered easy, recalibrate after changes, and use a qualified fallback or report insufficient evidence when a required stage is unavailable.

Chapter summary

  • Include the costs of failed as well as successful attempts, and define the task, accounting boundary, and success consistently.
  • Report cost per attempt and per success alongside failure rates, cost and latency distributions, and relevant slices.
  • Use the Pareto frontier to expose trade-offs, not to replace uncertainty analysis or non-negotiable safety gates.
  • Allocate evaluation spend to the decision, coverage, repeatability, labeling, calibration, and risk.
  • Separate targeted adaptive investigation from population estimation, and treat cached responses as replays rather than fresh trials.
  • Make judge cascades auditable with calibrated routing, qualified fallbacks, and probability-based review.

For product managers. What is the acceptable cost and latency per successful task? Which quality or safety constraints are non-negotiable? Ask for the frontier, task slices, and assumptions—not a single ROI number.

Hands-on lab (Python)

Run python code\ch25\lab_economics.py. The candidate data are invented for the exercise and do not represent provider prices or real model performance. The helper divides the supplied total cost by the supplied number of successes, but it does not check the accounting boundary or assess uncertainty. The frontier uses the three provided point estimates and does not apply safety gates.

from bookkit.system_eval import cost_per_success, pareto_frontier

systems = [
    {"name": "A", "quality": 0.90, "cost": 0.12, "latency": 1.8},
    {"name": "B", "quality": 0.92, "cost": 0.18, "latency": 2.2},
    {"name": "C", "quality": 0.88, "cost": 0.20, "latency": 2.5},
]
print(cost_per_success(total_cost=12.0, successes=80))
print(pareto_frontier(systems))
0.15
['A', 'B']

The first result is \(12.00/80=0.15\) per verified success, assuming the supplied total includes the relevant costs of all eligible attempts. System A dominates C on all three displayed dimensions. B costs more and is slower than A, but has higher quality, so A and B both remain on this illustrative point-estimate frontier. These numbers alone do not establish which system should be deployed.

Exercises

  1. Hands-on. Add a system that dominates C and verify the frontier. Does it also dominate A or B?
  2. Budget. Allocate a fixed review budget across common, rare, and high-risk task slices.
  3. Conceptual. Why is cost per success misleading if task difficulty differs between systems?
  4. Cascade. Design routing thresholds for a cheap judge with human escalation.
  5. Discussion. Which trade-off would you make for a low-frequency but high-impact task, and which constraints would remain non-negotiable?

Further reading

  • Miller, Adding Error Bars to Evals, for uncertainty-aware comparisons [1].
  • Efron, for bootstrap methods [2].
  • Zheng et al., for model-judge behavior and limitations [3].
  • NIST AI RMF, for incorporating risk into management decisions [4].
[1]
E. Miller, “Adding error bars to evals: A statistical approach to language model evaluations.” 2024. Available: https://arxiv.org/abs/2411.00640
[2]
B. Efron, “Bootstrap methods: Another look at the jackknife,” The Annals of Statistics, vol. 7, no. 1, pp. 1–26, 1979, doi: 10.1214/aos/1176344552.
[3]
L. Zheng et al., “Judging LLM-as-a-judge with MT-bench and chatbot arena,” in Advances in neural information processing systems, 2023. Available: https://proceedings.neurips.cc/paper_files/paper/2023/hash/91f18a1287b398d378ef22505bf41832-Abstract-Datasets_and_Benchmarks.html
[4]
National Institute of Standards and Technology, “Artificial Intelligence Risk Management Framework (AI RMF 1.0),” National Institute of Standards; Technology, NIST AI 100-1, 2023. doi: 10.6028/NIST.AI.100-1.