On Calibration of Modern Neural Networks
Read first: Exploiting Cloze Questions for Few Shot Text Classification and Natural Language Inference
TL;DR. A probability is calibrated if, among all items scored about , a fraction of about are positive. Guo et al. showed in 2017 that modern deep networks are accurate but over-confident. They also found that the simplest fix, a single temperature applied to the logits and fitted on validation data, is usually the best. For decision models this matters in two places. A calibrated score lets you read 0.8 as “80% chance”, and it makes the F1-optimal threshold predictable. Hamel Husain and Antaripa Saha’s evals show that some decision models are close to calibrated on their task and others are far off, and that the standard fix does not always help.
Why it matters now. Decision models sell “calibrated probabilities”, and IR evaluation increasingly uses LLM relevance probabilities as if they were. Examples include summing P(relevant) to estimate recall bases, weighting UMBRELA-style judgements, and using a judge’s confidence to decide which items humans should re-check. Each of these needs calibration on your distribution, not the vendor’s benchmark. The Hamel–Saha evaluation is a concrete small-data example.
Key idea
Section titled “Key idea”Definition and the reliability diagram. A binary scorer is perfectly calibrated if for all . To check, sort items by score, group them into bins , and plot each bin’s mean predicted probability against its observed positive rate. Points above the diagonal mean the model under-estimates risk, and points below mean it over-estimates. The expected calibration error is the item-weighted mean gap (Guo et al. §2, 15 equal-width bins):
Brier score mixes calibration with discrimination. The Brier score is . Its standard decomposition is reliability (calibration error) minus resolution (how far bin rates move from the base rate) plus uncertainty . A model can therefore win on Brier score by separating the classes well while still being miscalibrated. A useful baseline: always predicting the base rate gives a Brier score of exactly .
Why networks miscalibrate (Guo et al. §3). Greater depth and width, batch normalisation and less weight decay all increase ECE. Training continues to lower the NLL on training data after test NLL has started rising. On CIFAR-100, test error still falls from 29% to 27% in that phase, so the network gains accuracy at the cost of over-confident probabilities.
Post-hoc fixes. All of these are fitted on held-out labelled data:
- Platt scaling: on a logit , fitted by NLL. Hamel and Saha apply it to the log-odds of the vendor probability, clipping away from 0 and 1.
- Temperature scaling: with a single fitted by NLL. Because does not change the argmax, accuracy is unchanged (§4.2). For two classes it is Platt scaling with .
- Vector and matrix scaling: with a diagonal or full . These are more flexible and overfit with many classes.
- Histogram binning and isotonic regression: non-parametric maps from scores to probabilities. Isotonic regression is piecewise constant and non-decreasing: it never reverses the order of two scores, but it can merge different scores into ties, and it needs more data.
A single strictly increasing mapping applied to every example preserves ranking and attainable threshold sets, so AUROC and the precision–recall curve are unchanged. What moves is the score at which a given precision–recall point sits, which is why calibration and threshold tuning interact. Isotonic calibration can introduce ties and change AUROC or PR/AP (scikit-learn’s calibration guide warns about exactly this), and pooling predictions from different fold-specific calibrators can also change their order.
Contextual calibration without labels (Zhao et al., 2102.09690). Few-shot prompts bias an LM toward three kinds of answer: labels that are frequent in the prompt (majority-label bias), labels that appear near the end (recency bias), and labels that are common in pretraining (common-token bias). The fix is to score a content-free input such as “N/A”, take its label probabilities , and set
This rescales each class so that “N/A” would come out uniform. In the paper’s example GPT-3 scores “N/A” as 61.8% Positive. For two classes the argmax rule reduces to comparing with , so the method amounts to a label-free threshold shift.
What decision-model vendors claim. Cloudflare trains Clef with label-smoothed cross-entropy plus a Brier loss. TypeSafe describes “Reinforcement Learning for Calibrated Decisions” (RLCD). Perplexity ships a calibration temperature with its open v1.1 weights. These are vendor descriptions, so check them on your own data.
Key results
Section titled “Key results”Guo et al. (paper-reported, Table 1, ECE with 15 bins).
- ResNet-110 on CIFAR-100. Uncalibrated ECE is 16.53%. Histogram binning gives 2.66%, isotonic regression 4.99%, BBQ 5.46%, temperature scaling 1.26%, vector scaling 1.32% and matrix scaling 25.49%.
- DAN-3 on 20 News. Uncalibrated ECE is 8.02%. Histogram binning gives 3.6%, temperature scaling 4.11% and matrix scaling 9.1%.
- Speed. Fitting the temperature is a one-dimensional convex problem; a conjugate-gradient solver converges in about 10 iterations (§5).
Contextual calibration (paper-reported). Accuracy improves by up to 30.0% absolute across GPT-3 and GPT-2 tasks. Variance across prompt choices also falls, and GPT-3 2.7B sometimes beats uncalibrated 175B by up to 19.3% (§5, Table 1).
Decision models on Hamel and Saha’s 98 traces. The post reports out-of-fold Brier scores before and after Platt scaling:
| Model | Brier before → after Platt |
|---|---|
| Jev | 0.187 → 0.188 |
| Liquid d1-ultra | 0.173 → 0.172 |
| OpenAI Decisions | 0.159 → 0.164 (0.154 with an exploratory refit on raw probabilities) |
The post’s most extreme example: a Clef Flash group predicted at about 8% failure in which 60% of traces had failures. From the post’s published reliability data we computed a 5-group ECE for each model (our computation, not in the post):
| Model | ECE raw | ECE after Platt |
|---|---|---|
| Liquid d1-ultra | 0.06 | 0.04 |
| Jev | 0.08 | 0.08 |
| OpenAI Decisions | 0.13 | 0.14 |
| Perplexity | 0.21 | 0.08 |
| Liquid d1 | 0.24 | 0.06 |
| Clef Flash | 0.42 | 0.04 |
The shapes differ. Perplexity, Liquid d1 and Clef Flash sit above the diagonal, so they underestimate risk, and a monotone sigmoid fixes that. OpenAI’s raw groups are predicted at 0.01 / 0.48 / 0.87 / 0.94 / 0.99 against observed rates of 0.25 / 0.25 / 0.75 / 0.95 / 0.95. That is a bunched, non-sigmoid shape that a two-parameter fit on about 78 training traces per fold does not improve.
The failure prevalence is 61/98 ≈ 0.62, so the base-rate Brier score is about 0.235. From the raw scores we computed Brier scores of 0.227 for Perplexity, 0.282 for Liquid d1 and 0.383 for Clef Flash. The last two are worse than always predicting the base rate, even though their rankings are informative (AUROC ≈ 0.71–0.72 in our computation). OpenAI has the best Brier score but not the best ECE because it separates the classes best (AUROC ≈ 0.86, the highest of the six in our computation), which is a resolution effect rather than a calibration effect.
Benchmarks (published by the index operators). The Artificial Analysis Decision Index finds decision models over-confident across almost all probability levels. The gap comes mainly from the knowledge and reasoning tasks; most models are relatively well calibrated on When2Call (tool calling) and WildGuardTest (classification). In LLM-as-Jev (Table 1), a frozen 4B readout has JevBench ECE 0.057, while a 0.6B readout has 0.278.
Limitations & open questions
Section titled “Limitations & open questions”- Small-sample noise. A 5-bin diagram on 98 items has a standard error of about 0.11 per bin. Differences in ECE of a few hundredths between models are not meaningful at that size.
- Calibration does not transfer. It holds for a given prompt, model version, grouping and prevalence. A change in failure base rate, for example after a product fix, invalidates calibrated probabilities even when the ranking is unchanged.
- Binary ECE hides class-conditional errors. A model can be calibrated on average and still be badly off on a subgroup, such as one failure mode or one topic.
- Open: are RL-for-calibration objectives such as RLCD better than post-hoc temperature scaling on out-of-domain tasks? In the sources reviewed (Oct 2026), vendors report calibration only on their own or index benchmarks.
Connections
Section titled “Connections”- LMs as classifiers explains where the probabilities come from.
- Hamel & Saha’s decision-model evals is a worked calibration check on agent traces.
- Thresholds and metrics shows how calibration fixes the F1-optimal threshold.
- Statistics and judge calibration covers prediction-powered inference, which uses a few labels to correct a judge’s aggregate.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Perplexity Decider's raw failure probabilities on Hamel and Saha's 98 traces fall into five groups (mean predicted, observed failure rate, n): (0.015, 0.30, 20), (0.109, 0.40, 20), (0.432, 0.70, 20), (0.763, 0.89, 19), (0.930, 0.84, 19). Compute the binned ECE, say in which direction the model is miscalibrated, and explain why a 5-bin ECE on 98 items is a noisy number.
What a strong answer covers
- ECE = Σ (n_m/N)·|observed_m − predicted_m| = [20·(0.285 + 0.291 + 0.268) + 19·(0.127 + 0.090)]/98 ≈ (16.9 + 4.1)/98 ≈ 0.21.
- The first three groups lie above the diagonal: the model underestimates failure risk at low and middle scores. The top group is slightly overconfident (0.93 predicted vs 0.84 observed).
- With about 20 traces per bin, the binomial standard error of an observed rate near 0.5 is about √(0.25/20) ≈ 0.11, as large as many of the gaps.
- ECE also depends on the binning scheme (Guo et al. use 15 equal-width bins; the post uses 5 equal-mass groups), so numbers are comparable only under the same scheme.
- Derive / compute
In Calibrate Before Use, a two-shot sentiment prompt makes GPT-3 score the content-free input "N/A" as 61.8% Positive. Contextual calibration sets W = diag(p_cf)⁻¹ and b = 0. (a) Compute the calibrated decision for test inputs with raw P(Positive) = 0.70 and 0.55. (b) Show that for two classes this procedure is equivalent to moving the decision threshold, and give the threshold.
What a strong answer covers
- W·p̂ for 0.70: (0.70/0.618, 0.30/0.382) = (1.133, 0.785); after the softmax, P(Positive) ≈ 0.59, still Positive.
- For 0.55: (0.890, 1.178); P(Positive) ≈ 0.43, so the label flips to Negative.
- The calibrated argmax is Positive iff p/0.618 > (1 − p)/0.382, i.e. iff p > 0.618: contextual calibration is a threshold set at the content-free probability.
- It needs no labels, but it assumes the bias is a per-class multiplicative shift measured by a meaningless input; it cannot fix input-dependent bias or ranking errors.
- Mechanism
On the same 98 traces, OpenAI Decisions has the best Brier score (0.159) but a worse binned ECE than Jev (about 0.13 vs 0.08 from the post's reliability data), and Platt scaling fitted on log-odds made its Brier score worse (0.159 → 0.164). Explain all three facts in terms of what Brier score and ECE measure and what Platt scaling can and cannot represent.
What a strong answer covers
- Brier score combines calibration with discrimination (resolution): a model that separates failures from passes well (OpenAI's AUROC ≈ 0.86, the highest) can have low Brier despite calibration gaps.
- ECE ignores discrimination and only measures the gap between predicted and observed rates per bin.
- Platt scaling is a two-parameter monotone sigmoid in log-odds. OpenAI's raw scores are bunched near 0.87–0.99 with a middle group at 0.48 predicted vs 0.25 observed; a single sigmoid cannot fix that shape, and fitting it on about 78 traces per fold adds variance.
- The post notes that an exploratory refit on raw probabilities gave 0.154, so the choice of input space is itself a hyperparameter; measure calibration out of fold rather than assume a fix helps.
- What if…
Guo et al. (Table 1) compare post-hoc calibrators. On CIFAR-100 with ResNet-110, ECE is 16.53% before calibration, 2.66% with histogram binning, 4.99% with isotonic regression, 1.26% with temperature scaling and 25.49% with matrix scaling. On 20 News, histogram binning (3.6%) beats temperature scaling (4.11%). Explain the ranking in terms of parameter count and validation-set size, and predict which calibrator you should use for a decision model evaluated on 100–300 labelled traces.
What a strong answer covers
- Temperature scaling has one parameter, so it has less scope to overfit than matrix scaling, but still needs held-out validation. It fixes a global over- or under-confidence, and a positive temperature preserves the multiclass argmax.
- Matrix scaling has K² parameters (10,000 for 100 classes) fitted by NLL on a 5,000-image validation set; it overfits badly and worsens ECE.
- Binning and isotonic regression are non-parametric. They win when the miscalibration is not a simple scale, as on 20 News, but need enough data per bin or step.
- With 100–300 traces, use temperature or Platt scaling fitted out of fold, and check it on held-out data. Isotonic regression will overfit, as the post itself warns.
- Design
You want to use a decision model's P(relevant) to estimate how many relevant passages each TREC-style topic has (the recall denominator), by summing probabilities over a large judged-by-model pool, instead of thresholding. You can afford 400 human labels. Design the calibration step and its validation.
What a strong answer covers
- Summing probabilities is unbiased only if they are calibrated on the pool's distribution; a 0.05 bias times 10,000 pooled passages shifts the count by 500.
- Stratify the 400 labels by model score (oversample high scores where relevant passages concentrate) and by topic; fit Platt or temperature scaling on log-odds with cross-validation, weighting for the stratified sampling.
- Validate with a reliability diagram and ECE on held-out labels, plus per-topic estimated vs labelled counts; prevalence varies by topic, so check calibration on low-prevalence topics separately.
- Alternatively use prediction-powered inference: the labelled sample corrects the bias of the summed estimate and gives a confidence interval.
- Critique
The Artificial Analysis Decision Index reports that decision models are overconfident overall, mainly because of poor calibration on knowledge and reasoning tasks (HLE-MultiChoice, AA-Omniscience-Decision), while most are relatively well calibrated on When2Call and WildGuardTest. Identify the main confound in reading this as "decision models cannot know what they don't know on hard questions", and design the experiment that would separate the explanations.
What a strong answer covers
- Calibration is measured on the confidence of the chosen answer and is relative to a distribution; on hard knowledge tasks accuracy is low, so any model with a training prior toward confident answers will look overconfident there.
- Task difficulty and domain are confounded: knowledge tasks are both harder and further from the decision-training data (tool calls and safety labels look like typical training mixtures).
- Experiment: bin items by difficulty (e.g. accuracy of a reference LLM) within each benchmark and compare reliability curves at matched accuracy, and apply a per-task temperature fitted on a held-out split to see whether a single scale fixes it.
- If one temperature per task removes most of the gap, the problem is a shifted scale; if reliability stays flat (confidence uninformative about correctness), the model lacks the knowledge signal itself.