Compare releases on quality, latency and cost
Use traces, inference evidence and fixed acceptance gates to choose a model.
Compare releases on quality, latency and cost
Work through the decision
A candidate is cheaper per thousand tokens and wins on average relevance. It doubles the number of retries on the busiest route and misses a critical grounding requirement. Which evidence should decide release?
Check your reasoning
Use the same labeled cases and comparable traffic, aggregate request costs including retries, and apply the mandatory quality gate before ranking passing candidates. Report p95 latency with its definition, volume and cohort. Inspect traces for cases where the candidate regressed.
Compare the choices
- Paired evaluation
- Compare candidates on the same eligible cases under a defined scoring policy. Inspect segments as well as aggregate quality.
- Groundedness evaluation
- Determine whether claims are supported by the supplied context. A well-supported answer may still address the wrong question.
- Request and trace correlation
- Join the logged request and model version to stage-level traces, scorer outcomes and latency to localize production failures.
- Cost per accepted result
- Include all material request and serving costs and divide by successful eligible outcomes. Consider retries, token mix and capacity.
Test the decision
Request logs establish what was served and when. A trace describes how the application reached the answer. A scorer supplies a judgment under a specified rule. Preserve model, prompt and index versions so these views can be joined.
Practice the guide skills
- Compare a compact model and a larger model under the same business constraints. Watch 53:23 · Continue at 2:05:30
Check your answer
Use a fixed test set and realistic load, compute paired quality metrics plus p95 latency and cost per eligible request, and apply minimum acceptance criteria by critical segment.
- What should a live grounded assistant monitor? Watch 2:07:27 · Continue at 2:07:39
Check your answer
Track answer relevance, groundedness or citation support, abstention and safety alongside retrieval coverage, latency, errors and cost. Define thresholds and ownership for investigation.
- A quality score drops after a release. Watch 1:01:35 · Continue at 2:01:36
Check your answer
Locate the request trace, examine spans in order and compare the retrieved evidence and generated output with the scorer’s explanation. Review scorer calibration before attributing blame.
- What does endpoint inference logging provide? Watch 2:08:08
Check your answer
Where configured, retain governed request, response, time, identity or request ID and model version for analysis. Limit sensitive content and link related traces using stable identifiers.
- One model uses more tokens but produces fewer retries. Watch 2:10:50 · Continue at 2:11:06
Check your answer
Calculate input and output charges, request count, retries and serving capacity for the workload. Compare cost per satisfactory answer at the same quality and latency constraints.
Official objectives for this lesson
Lab · Gate an assistant release on grounding, latency and cost
Save as release.py and run python3 release.py. Both releases answer the same five labeled requests. Each row gives the grounding decision, end-to-end latency and a list of attempt costs in cents. The sample gate requires at least 80% grounded answers and p95 latency of at most 900 ms. Predict the eligible release and the cost per grounded answer.
from math import ceil
runs = {
"baseline": [(1, 620, [2]), (1, 680, [2]), (0, 800, [2, 1]),
(1, 760, [2]), (1, 850, [2])],
"candidate": [(1, 490, [1]), (0, 510, [1]), (0, 550, [1, 1]),
(1, 610, [1]), (1, 640, [1])],
}
for name, rows in runs.items():
accepted = sum(row[0] for row in rows)
rate = accepted / len(rows)
durations = sorted(row[1] for row in rows)
p95 = durations[ceil(0.95 * len(rows)) - 1]
total = sum(sum(row[2]) for row in rows)
state = "eligible" if rate >= 0.8 and p95 <= 900 else "hold"
unit_cost = f"{total / accepted:.2f}" if accepted else "undefined"
print(f"{name}: {rate:.0%} grounded, p95 {p95} ms, {unit_cost} cents/grounded, {state}")
Check the result
baseline: 80% grounded, p95 850 ms, 2.75 cents/grounded, eligible candidate: 60% grounded, p95 640 ms, 2.00 cents/grounded, hold
The candidate saves time and money but misses the grounding gate. Inspect the failed examples and their retrieval and generation spans. For a second run, mark the candidate’s second response grounded and change its latency to 940 ms. It now meets the quality threshold and misses the latency threshold. Five cases make nearest-rank p95 the maximum. Use a larger representative sample for a production decision.
Related lesson · Troubleshooting and optimization
Compare releases on quality, latency and cost quiz
Answer 3 questions. Check each answer for an explanation.
Worked example · Compare releases on quality, latency and cost