Evaluation and Quality Engineering

Evaluation and Quality Engineering

Confidence Calibration — Patterns

Confidence calibration › Patterns

67 of 73 in this book · 3 min read

Read the reliability curve, not the summary number

Problem. A single expected-calibration-error figure is an average over the score range, dominated by whichever region holds most of the mass. A system can report a reassuring aggregate while being badly overconfident in the top band — the only band an escalation threshold ever consults.

Approach. Bin the paired confidence-and-outcome observations, plot observed accuracy against stated confidence per bin, and report the curve with the bin populations shown. Require a minimum population per bin before any bin is interpreted, and widen the bins rather than reporting noise. Read the curve where the threshold sits, and treat deviation there as the finding regardless of what the aggregate says.

Trade-off. Curves need far more paired observations than a summary figure, and the high- confidence region is usually both the most important and the least populated by errors — which is precisely why its estimate is unstable. Binning choices also change the picture, and there is no neutral choice.

Fit the correction on held-out data and re-fit on a schedule

Problem. A raw score is usually monotone in correctness and wrong in scale, so a threshold placed on it lands somewhere arbitrary. Fitting a correction on the same data used to report calibration makes the reported calibration a description of the fit rather than a measurement.

Approach. Split the labelled data into a fitting portion and a reporting portion, fit the mapping on the first, and report reliability on the second. Prefer a correction that preserves ranking when the score is also used for selection, since a mapping that reorders items changes which ones a threshold selects. Re-fit on a defined cadence, and treat a model build change, a prompt change or a shift in the input mix as triggering a re-fit regardless of the cadence.

Trade-off. Held-out labelled data is the scarce resource in this whole capability, and splitting it makes both halves weaker. A flexible correction fitted to a small sample will track its noise, and the fitted mapping is only valid over the population it was fitted on, which is exactly what drifts.

Report calibration per segment, especially the rare one

Problem. Aggregate calibration is dominated by the common, easy traffic where the system is right almost always and says so. The segment that matters — the rare intent, the unfamiliar language, the long tail — can be severely overconfident without moving the overall figure at all.

Approach. Compute reliability separately for the segments the product treats differently or cares about disproportionately, and publish them side by side rather than as an aggregate. Where a segment has too few observations for a stable curve, say so explicitly rather than folding it into the whole. Set thresholds per segment when the curves differ materially, since one threshold across differently calibrated populations is several wrong thresholds.

Trade-off. Segmenting multiplies the data requirement by the number of segments, and the segments most in need of their own curve are the ones with the least data. Per-segment thresholds also add operational complexity and a new way for the configuration to drift from what was measured.

Instrument the pair, or the measurement cannot exist

Problem. Calibration requires a confidence and a correctness verdict for the same output. Most production systems record the first and never the second, so the question cannot be answered retrospectively and the gap is only discovered when someone tries.

Approach. Decide at design time where the correctness verdict will come from — a human review queue, a downstream outcome such as a correction or an escalation, an automated check where one exists — and record it against the same identifier as the confidence, accepting that it arrives later. Sample deliberately across the confidence range rather than uniformly, since the high-confidence region needs many observations to show a small error rate and uniform sampling will not supply them.

Trade-off. Verdict collection is the expensive part and competes with every other use of review capacity. Stratifying by confidence also makes the resulting sample unrepresentative of traffic, so every population-level figure must be reweighted, which is one more thing to get wrong.