A Ranking Approach for Measuring Calibration
Anirban Chatterjee, Rina Foygel Barber
stat.ME, cs.LG, stat.ML
2026-09-12
BU and UChicago propose rankECE: sort by predicted probability, multiply neighboring residuals. It tracks ℓ2-ECE closer than binned ECE without choosing K.
A well-calibrated classifier that says "70% chance of disease" should be right about 70% of the time among people who get that score. The usual scalar for that gap is ℓ2-ECE: the mean squared difference between the predicted probability f(X) and the true conditional frequency E[Y | f(X)].
That conditional expectation cannot be estimated uniformly without assumptions. A hardness result of Angelopoulos, Barber, and Bates says that any estimator of ℓ2-ECE has a bias lower bound that does not vanish with n. The practical workaround is binned ECE: slice [0, 1] into K bins and compare mean predictions to mean labels. Too few bins smear real miscalibration; too many bins inject a positive finite-sample bias of order K/n. Kumar et al. even constructed cases where binECE is zero while the model is not calibrated. Anirban Chatterjee (Boston University) and Rina Foygel Barber (University of Chicago) propose rankECE, which replaces bins with a ranking of predicted probabilities.
The identity behind the estimator is ℓ2-ECE = E[(Y − Z)(Y′ − Z)], where Y and Y′ are independent draws from Y given the same prediction Z = f(X). Exact ties almost never happen, so the method sorts samples by Z and treats neighbors as two nearly i.i.d. draws from the same conditional.
If π orders the predictions, the sample statistic is the average of neighboring residual products:
rankECEn = (1/n) Σ{i=1}^{n-1} (Y{π(i)} − Z{π(i)}) (Y{π(i+1)} − Z{π(i+1)})
No bin count, no kernel bandwidth. Each "bin" holds two adjacent points, so resolution refines automatically with n.
Main properties:
A dominance result says rankECE ≥ binECE − 4K/n. Both quantities sit below ℓ2-ECE, so when K = o(n) (the regime where binECE is even estimable without assumptions), whatever miscalibration binning misses, rankECE misses no more. Two tests come with the measure: a conservative Bernstein finite-sample test, and an asymptotic test that treats √n · rankECE as standard normal after studentization.
Synthetic experiments use three conditionals: a quadratic, ten alternating Gaussian spikes, and a chirp-like sine whose frequency grows with z. Z is uniform, Y is Bernoulli given g(Z). Sample sizes run from 10² to 10⁵, T = 100, and the y-axis is the estimator divided by a fine-grid ℓ2-ECE. The rankECE ratio snaps toward 1. Fixed K = 10 underestimates on oscillatory g; K = n/20 stays positively biased; K = √n and n^{1/3} catch up only at large n, later when g wiggles more.
On Amazon review polarity, they score 50,000 test examples with DistilBERT SST2, BERT SST2, RoBERTa Twitter Sentiment, and BERT Multilingual Stars, then subsample n from 100 to 10,000 (100 repeats). Ground-truth ℓ2-ECE is the debiased binECE of Lee et al. (2023) on the full 50k. rankECE tracks that reference more closely on every model. binECE is brittle in K: n/20 is persistently high, K = 10 is unstable on the two SST2 models. Yelp polarity repeats the same pattern.
For testing, Z Beta(ρ, 1 − ρ) and Y | Z Ber(Z − Z^4). The asymptotic rankECE test matches the power of quadratic-time SKCE-U; the finite-sample test sits near linear-time SKCE-L. Both beat SKCE-U on wall clock by orders of magnitude, because SKCE-U needs a 100-replicate multiplier bootstrap. Type-I error stays near the nominal α = 0.05.
| Quantity | rankECE | binECE |
| Tuning | none | must pick K |
| Zero iff calibrated | yes | no |
| Gap to ℓ2-ECE | O(1/n) under bounded TV | can collapse on oscillating residuals |
Anyone shipping a classifier already stares at reliability diagrams and ECE. This paper offers a K-free scalar that is zero exactly when the model is calibrated, with public code. If the question is whether predicted probabilities can be treated as uncertainties, rankECE is less likely to move when someone changes the binning recipe. It currently covers binary tasks with Z ∈ [0, 1]; multiclass needs a collapse to a one-dimensional score first.
It is a better measuring tape, not a new calibration method. Models do not become more calibrated; the error bar on how miscalibrated they are gets more trustworthy.
Two caveats are stated in the paper. Finite-sample closeness to ℓ2-ECE needs bounded total variation of the residual. A square-wave construction whose TV grows with n can drive rankECE near 0 while ℓ2-ECE stays away from 0. Some assumption is unavoidable given the hardness result; whether total variation is the sharp one is left open.
The ranking also needs a one-dimensional Z. Multivariate outcomes, multilabel scores, and feature-conditional calibration have no canonical order. On real data the "true" ECE is itself a debiased binned estimate on 50k points, not an analytic value (the simulations do integrate on a grid). Power comparisons use a handful of misspecification curves, so the SKCE horse race should not be read as universal.