Evaluation-Driven Development › Scoring, Aggregation, and Slice Ceilings
Language AI HandbookAll chapters The case score is between 0 and 1 and can be fractional. The mean case score gives every observed case equal weight. A pass rate uses a different variable: map full credit to one and every other score to zero. Report which measure you computed.
Aggregate scores and their variance
For independent, identically distributed binary outcomes with success probability , the mean pass indicator has variance . Its standard error is the square root of that variance. A fixed set of six hand-authored cases has no random sampling model for production traffic. Report counts and descriptive means on these fixtures. If you need population uncertainty, define the target population, how you sampled it, and what dependence the estimate must account for.
PythonIn [17]Expand
def aggregate(traces: list[Trace]) -> dict:
scores = [trace.score for trace in traces]
if not scores:
raise ValueError("Cannot summarize an empty group.")
return {
"n": len(scores),
"mean": sum(scores) / len(scores),
"passes": sum(score == 1.0 for score in scores),
}
def by_slice(traces: list[Trace], cases: list[Case]) -> dict:
by_id = {case.case_id: case for case in cases}
buckets: dict[str, list[Trace]] = {}
for trace in traces:
buckets.setdefault(by_id[trace.case_id].slice, []).append(trace)
return {name: aggregate(group) for name, group in buckets.items()}PythonIn [18]Expand
dev_cases = splits["dev"]
dev_traces = [run_case(case, {}) for case in dev_cases]
print("Development cases:", aggregate(dev_traces))
for group, stats in by_slice(dev_traces, dev_cases).items():
print(group, stats)ConsoleOut [18]Expand
Development cases: {'n': 4, 'mean': 1.0, 'passes': 4}
multilingual {'n': 1, 'mean': 1.0, 'passes': 1}
technical {'n': 2, 'mean': 1.0, 'passes': 2}
billing {'n': 1, 'mean': 1.0, 'passes': 1}The slice ceiling
With disjoint slices the overall mean is a weighted average. Let be the case count in slice , its observed mean score, and the total case count. The aggregate weights each slice by its share .
The weights are nonnegative and sum to one. This places the aggregate between the smallest and largest slice means. If a slice of weight stays at while all scores lie in , the aggregate ceiling is , since even perfect performance elsewhere contributes at most . The ceiling depends on the mix.
Keep the underlying slice rates fixed in this synthetic example. With equal representation, the expected mean is . When billing accounts for 30 of 40 cases, the expected mean is . This increase comes entirely from reweighting unchanged slice rates.
PythonIn [19]Expand
rates = {"Billing": 1.0, "Technical": 0.5, "Multilingual": 0.0}
mixes = {
"Balanced mix": {"Billing": 10, "Technical": 10, "Multilingual": 10},
"Billing-heavy mix": {"Billing": 30, "Technical": 5, "Multilingual": 5},
}
expected = {
label: sum(rates[s] * count for s, count in counts.items())
/ sum(counts.values())
for label, counts in mixes.items()
}
plot_labels = [*rates, "Balanced mix", "Billing-heavy mix"]
plot_rates = [*rates.values(), *expected.values()]VisualizationOut [20]Expand

Compare releases on the same cases when possible. If the sample mix must change, show the slice values and estimate a weighted aggregate against a declared reference mix. Fixing weights alone cannot correct for a shift in difficulty within a slice.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!