ML & Deep Learning Foundations·Question 18 of 55Intermediate

What does it mean for a classifier to be calibrated? How do you measure and fix miscalibration?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Calibrated means predicted probabilities match empirical frequencies: among all cases where the model says 0.8, ~80% should actually be positive. Discrimination (ranking, AUC) and calibration are orthogonal - you can rank perfectly while outputting probabilities that are all wrong by a squashing, and any monotone rescaling changes calibration without touching AUC.

Full worked answer with diagram

Calibrated means predicted probabilities match empirical frequencies: among all cases where the model says 0.8, ~80% should actually be positive. Discrimination (ranking, AUC) and calibration are orthogonal - you can rank perfectly while outputting probabilities that are all wrong by a squashing, and any monotone rescaling changes calibration without touching AUC.

Measurement: reliability diagrams (bin predictions by confidence, plot observed frequency per bin vs the diagonal); ECE (expected calibration error) summarises the gap as a weighted average across bins - beware its sensitivity to binning choices; Brier score and NLL are proper scoring rules that blend calibration and discrimination.

Fixes (fit on validation data, never train):

  • Temperature scaling (Guo et al. 2017): divide logits by a single learned T > 0 before softmax. Modern nets are typically overconfident (T ≈ 1.5-3 fixes many vision models). One parameter, preserves ranking exactly, hard to overfit - the default choice.
  • Platt scaling (logistic fit on scores) and isotonic regression (nonparametric, monotone; needs more data, can overfit small val sets).

Why it matters: any system that thresholds on expected cost - fraud review queues, medical triage, deciding when an LLM-based classifier should abstain or escalate to a human - needs probabilities that mean something, not just correct rankings.

Going further: follow-up territory

LLM angle worth volunteering: base models are surprisingly well calibrated on multiple-choice tasks (token-probability vs accuracy), and RLHF tends to worsen that calibration - the GPT-4 technical report showed the post-RLHF model's calibration curve visibly degraded versus the pretrained model. Verbalised confidence ("I'm 90% sure") is a separate, generally worse-calibrated channel than token logprobs.

Worth sketching. The loop back to the reliability diagram shows calibration is measured, fixed, then re-measured, and never fitted on train.

flowchart LR
    A["Validation logits"] --> B["Bin by confidence"]
    B --> C["Reliability diagram<br/>and ECE"]
    C --> D{"Observed rate below<br/>stated confidence?"}
    D -->|"yes, overconfident"| E["Fit a single T on val"]
    D -->|"no, near the diagonal"| F["Ship as is"]
    E --> G["Divide logits by T:<br/>ranking and AUC unchanged"]
    G --> C

What a good answer covers

  • Calibrated means predicted probabilities match empirical frequencies
  • Discrimination (ranking, AUC) and calibration are orthogonal - you can rank perfectly while outputting…
  • Measurement: reliability diagrams (bin predictions by confidence, plot observed frequency per bin vs the…
  • Fixes (fit on validation data, never train): - Temperature scaling (Guo et al
  • Modern nets are typically overconfident (T ≈ 1.5-3 fixes many vision models)

Key terms: Measurement · ECE · Brier score · Fixes · Temperature scaling · Platt scaling · isotonic regression

Interviewer follow-ups to expect

  1. Why does temperature scaling leave accuracy and AUC unchanged?

  2. How does class imbalance interact with calibration under resampling?

  3. How would you calibrate an LLM judge that outputs a 1-10 score?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep