Invertible Logits Transformation for Accuracy-Preserving Post-Hoc Uncertainty Calibration

Lening Zhao, Qipeng Zhan, Li ShenNeurIPS 2026

TL;DR

Modern neural networks are notoriously overconfident—often declaring they are 99% sure right before getting an answer completely wrong. This paper introduces Invertible Logits Transformation (InvLT), a fast, lightweight post-processing trick that bends a model’s raw output scores into honest probabilities without ever changing its top prediction. By borrowing a clever "round-trip" network trick from image translation to replace heavy calculus, it scales effortlessly to massive label spaces while running up to 7× faster than its closest competitors.

What Problem Does This Paper Address?

When a medical AI or self-driving car says there is an 80% chance of a hazard, you want it to actually be right 80% of the time. Deep networks rarely do this out of the box. Fixing this after training—without touching the original model weights—is called post-hoc calibration.

An ideal calibrator needs to hit a tricky trifecta:

  1. Preserve accuracy: Don't change the winning class! You already spent weeks optimizing the base model's accuracy; you just want to fix its confidence.
  2. Scale to many classes: If you have 1,000 classes, your calibrator shouldn't suddenly balloon to a million parameters and overfit on a tiny validation set.
  3. Expressivity: Fix complex, nonlinear overconfidence that varies across different confidence levels.

Existing methods usually sacrifice at least one of these. Temperature Scaling (dividing all pre-softmax scores, or logits, by a single number $T$) preserves accuracy and is super lightweight, but it’s just a straight line—too rigid for complex miscalibration. Flexible matrix-based methods explode in parameter count as classes grow and can accidentally flip the top prediction. Meanwhile, prior order-preserving neural nets (like UMNN) force their calibration curve to strictly increase by computing numerical integrals at every single forward pass, creating a massive computational bottleneck.

Methods

To keep the winning class unchanged, you just need to apply a strictly increasing scalar function $f(x)$ to each individual logit before the softmax layer. If $z_1 > z_2$, then $f(z_1) > f(z_2)$—the rank order stays locked.

Instead of forcing a neural network to be strictly increasing via clunky architectural constraints or numerical integration, the authors turn to a classic calculus gem: any continuous, one-to-one (injective) function on an interval must be strictly monotone. In plain English: if a smooth 1D curve never folds back on itself, it has to go strictly up (or strictly down).

Here is how InvLT puts this into action:

  • Shared Scalar MLP: A tiny standard Multi-Layer Perceptron $f_\theta: \mathbb{R} \to \mathbb{R}$ is applied element-wise to every logit. Because every class shares this exact same 1D function, the parameter count is completely independent of the number of classes $C$.
  • Soft Monotonicity via an Inverse Twin: During training on a held-out calibration set, $f_\theta$ is paired with an auxiliary "inverse" network $g_\psi$. Alongside standard calibration losses (like Negative Log-Likelihood or Brier score), they add a cycle-consistency reconstruction penalty: $\mathcal{L}_{\text{rec}} = \frac{1}{K}\sum (g_\psi(f_\theta(u_k)) - u_k)^2$ across $K$ reference points. If $g_\psi$ can cleanly undo $f_\theta$, then $f_\theta$ isn't folding back on itself!
  • Zero Overhead at Test Time: Once trained, the helper network $g_\psi$ is thrown away. Inference is just passing logits through a tiny 1D MLP.
Figure 1: Learned scalar transformation fθ for three random seeds on (a) CIFAR-10 (ResNet-50), (b) CIFAR-100 (ResNet-50) and (c) ImageNet (ResNet-152), each fit on val 5 000, re-centered at fθ(0) = 0 and plotted over the 2nd–98th percentile of the model’s logits. Dashed grey: identity y = x. Shading: per-seed deviation from identity (red where fθ(x) < x, blue where fθ(x) > x).

Datasets

The authors evaluate InvLT on three standard image classification benchmarks using pre-extracted logits across varying validation set sizes (500, 5,000, and 25,000 samples):

  • CIFAR-10 (10 classes, ResNet-50)
  • CIFAR-100 (100 classes, evaluated across ResNet-50, VGG-16/19, DenseNet-121, Wide ResNet, and ViT-B/16)
  • ImageNet (1,000 classes, ResNet-50 and ResNet-152)

No new benchmarks are introduced.

Key Insights and Ideas

  • The loss naturally picks "up" over "down": An invertible continuous function could theoretically be strictly decreasing, which would disastrously invert all your predictions (making the worst class the winner). Remarkably, no extra penalty is needed to prevent this—flipping rankings skyrockets the calibration loss, so gradient descent naturally snaps onto the strictly increasing branch every time.
  • Miscalibration is nonlinear and dataset-specific: Looking at Figure 1, InvLT doesn't learn simple straight lines like Temperature Scaling. On CIFAR-10, it flattens out to compress extreme upper logits; on CIFAR-100 and ImageNet, it steepens through the middle range.
  • Regularization helps calibration, not just accuracy: In an ablation study without the inverse-network penalty, the MLP folded slightly and increased classification error (from 4.52% to 4.69%). Turning the regularizer back on not only restored exact original accuracy, it actually improved calibration error—acting as a helpful inductive bias.

Key Results

Across all three datasets and seven network architectures, InvLT consistently achieves the best Expected Calibration Error (ECE) and Negative Log-Likelihood (NLL):

  • Better Calibration: At 5,000 validation samples, InvLT hits 0.59% ECE on CIFAR-10, 1.75% on CIFAR-100 (beating UMNN's 2.22% and Temperature Scaling's 4.67%), and 0.70% on ImageNet (down from 12.83% uncalibrated).
  • Small-Data Resilience: With only 500 validation samples on 1,000-class ImageNet, per-class methods like Vector Scaling catastrophically overfit (43.44% ECE), whereas InvLT achieves 0.98% ECE.
  • Major Speedups: Compared to UMNN (its closest accuracy-preserving rival), InvLT is 3.5× to 7.8× faster to fit (e.g., 72.6s vs. 570.5s on ImageNet) and 5× to 7.6× faster at inference (516ms vs. 3.94s on ImageNet for 10,000 samples on a single CPU).
Table 4: Wall-clock efficiency across datasets. Fit: 1,000 iterations. Inference: 10,000 samples. All timings on a single CPU.

Limitations and Future Work

  • No cross-class awareness: Because the exact same 1D function is applied to every logit independently, InvLT cannot capture calibration quirks where specific pairs of classes confuse each other. Adding lightweight cross-class interactions without overfitting is a key next step.
  • Empirical vs. mathematical guarantees: Because invertibility is encouraged via a soft penalty on finite grid points rather than baked into the network weights, preserving the top prediction isn't mathematically guaranteed—even though it held up in 100% of their experiments. For extreme safety-critical systems, the authors suggest adding a quick post-hoc check on the top class, or exploring hard monotonicity via non-negative network weights in future work, alongside testing beyond vision tasks.

Summary updated

Abstract

Post-hoc calibration aligns a classifier's predicted confidences with its empirical accuracy without retraining. An ideal calibrator should correct nonlinear miscalibration, scale gracefully to large label spaces, and preserve the original predictions; existing methods typically violate at least one of these properties---temperature scaling lacks expressivity, more flexible parametric alternatives introduce parameters that grow with the number of classes $C$, and other expressive methods do not preserve the rank ordering of class scores and may alter the predicted class. We propose \textbf{Invertible Logits Transformation (InvLT)}, which applies a learned scalar MLP $f:\mathbb{R}\to\mathbb{R}$ element-wise to the pre-softmax logits. Sharing $f$ across all logit dimensions makes the parameter count independent of $C$. Monotonicity of $f$---and hence preservation of the argmax prediction---is softly encouraged via a paired inverse network rather than enforced through the numerical integration required by prior monotone calibrators; this avoids their computational overhead while empirically preserving the original classification accuracy in every setting we evaluate. Across standard image classification benchmarks and a range of architectures, InvLT consistently outperforms a broad set of post-hoc baselines on standard calibration metrics. Our code is available at \url{https://github.com/joannaLzhao/InvLT}.
BibTeX
@inproceedings{zhao2026invertible,
  author = {Lening Zhao and Qipeng Zhan and Li Shen},
  title = {{Invertible Logits Transformation for Accuracy-Preserving Post-Hoc Uncertainty Calibration}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=GywVajmdc3},
}
Figure