Improved Uncertainty Post-Calibration via Rank Preserving Transforms

Yu Bai, Tengyu Ma, Huan Wang, Caiming XiongOpenReview 2020 · OpenReview

TL;DR

This paper introduces Neural Rank-Preserving Transforms (NRPT), a novel post-calibration technique for deep learning models. NRPT significantly improves uncertainty calibration by using a more expressive, input-dependent calibrator that preserves the original model's accuracy, outperforming existing methods and even matching deep ensembles in calibration performance with far fewer parameters.

What Problem Does This Paper Address?

Modern deep learning models, despite achieving impressive accuracy, often suffer from poor uncertainty calibration. This means their predicted probabilities don't accurately reflect the true likelihood of a correct prediction. For instance, a model might predict a class with 90% probability, but only be correct 70% of the time (over-confidence). This miscalibration is problematic for critical applications like medical diagnosis or self-driving cars, where understanding a model's confidence is crucial for safety and decision-making. Existing post-calibration methods, like temperature scaling, are simple but have limited capacity to correct these calibration errors without potentially sacrificing accuracy.

Methods

The core innovation is Neural Rank-Preserving Transforms (NRPT). The key idea is to adjust the model's output probabilities (logits) using a more complex function, but crucially, this function must preserve the rank of the original logits. Preserving the rank ensures that the predicted top-class label remains unchanged, thus maintaining the model's accuracy.

NRPT achieves this by applying entrywise monotone transforms to each logit. This means for any two logits $z_1$ and $z_2$, if $z_1 \le z_2$, then the transformed logits $f(z_1, x) \le f(z_2, x)$ for the same input $x$. This is a generalization of temperature scaling ($z/T$) and local temperature scaling ($z/T(x)$).

To implement this, NRPT uses a two-layer neural network for the transformation function $g(z_i; x)$, where the weights depend on the input features $x$. This allows for input-dependent calibration, making it more flexible than global temperature scaling. The authors also highlight that NRPT can be trained with various loss functions, including the Expected Calibration Error (ECE) itself, which is a novel approach.

Datasets

The paper evaluates NRPT on the following benchmark datasets:

  • CIFAR-100: A standard image classification dataset, split into train/calibration/validation sets.
  • ImageNet (ILSVRC2012): Another large-scale image classification dataset, also split for training, calibration, and validation.
  • MNLI (Multi-Genre Natural Language Inference): A large text classification task from the GLUE benchmark, used for evaluating NRPT on natural language understanding models.

The paper does not introduce new datasets.

Key Insights and Ideas

  • Rank Preservation is Key: The paper argues that the failure of complex post-calibration methods to improve calibration (and sometimes even worsen it) is not due to their complexity, but rather the lack of a constraint to preserve the original model's accuracy. Rank preservation is identified as a sufficient condition for this.
  • Monotonicity as a Generalization: Temperature scaling and local temperature scaling are shown to be special cases of rank-preserving transforms that rely on simple linear scaling. NRPT generalizes this by using arbitrary monotone functions, significantly increasing the calibrator's capacity.
  • Input-Dependent Calibration is Powerful: By allowing the calibrator to depend on the input features ($x$), NRPT can adapt its calibration strategy to different types of inputs, leading to better performance than global methods.
  • ECE as a Loss Function: Training directly with the ECE loss, rather than just using it as an evaluation metric, is shown to be effective for improving calibration, even though ECE is non-smooth.

Key Results

  • Improved Calibration: NRPT consistently outperforms existing post-calibration methods like Temperature Scaling (TS) and Local Temperature Scaling (LTS) in terms of Expected Calibration Error (ECE) and debiased ECE (DECE) across image and text datasets.
  • Competitive with Ensembles: NRPT achieves calibration performance comparable to deep ensembles (which are computationally expensive) but with a significantly smaller parameter footprint (0.5%-2% of the original model size).
  • Accuracy Maintained: Unlike some other methods, NRPT demonstrably preserves the original model's accuracy.
  • Better Trade-off: NRPT offers a better trade-off between calibration (ECE) and prediction sharpness (predictive entropy), allowing for more flexible model tuning.
  • Accuracy among Top-Confidence Predictions: NRPT shows improved accuracy for the most confident predictions, indicating better reliability.

Limitations and Future Work

  • Architecture Choice: While NRPT offers flexibility in calibrator architecture, the paper suggests further research into optimal choices for the monotonic transforms.
  • Combining Methods: The authors pose the question of whether calibrators can be designed to combine the strengths of standard post-calibration methods and ensemble-like approaches.
  • Hyperparameter Tuning: While the paper mentions hyperparameter tuning, the specific impact of different tuning strategies on NRPT's performance could be an area for further exploration.

Summary updated

Abstract

Modern machine learning models with high accuracy often exhibit poor uncertainty calibration: the output probabilities of the model do not reflect its accuracy, and tend to be over-confident. Existing post-calibration methods such as temperature scaling recalibrate a trained model using rather simple calibrators with one or few parameters, which can have a rather limited capacity. In this paper, we propose Neural Rank Preserving Transforms (NRPT), a new post-calibration method that adjusts the output probabilities of a trained classifier using a calibrator of higher capacity, while maintaining its prediction accuracy. NRPT learns a calibrator that preserves the rank of the probabilities through general monotonic transforms, individualizes to the original input, and allows learning with any loss function that encourages calibration. We show experimentally that NRPT improves the expected calibration error (ECE) significantly over existing post-calibration methods such as (local) temperature scaling on large-scale image and text classification tasks. The performance of NRPT can further match ensemble methods such as deep ensembles, while being much more parameter-efficient. We further demonstrate the improved calibration ability of NRPT beyond the ECE metric, such as accuracy among top-confidence predictions, as well as optimizing the tradeoff between calibration and sharpness.
BibTeX
@misc{bai2020improved,
  author = {Yu Bai and Tengyu Ma and Huan Wang and Caiming Xiong},
  title = {{Improved Uncertainty Post-Calibration via Rank Preserving Transforms}},
  year = {2020},
  url = {https://openreview.net/forum?id=jsM6yvqiT0W},
  howpublished = {OpenReview},
}
Figure