Parameterized Temperature Scaling for Boosting the Expressive Power in Post-Hoc Uncertainty Calibration

Christian Tomani, Daniel Cremers, Florian Buettner

Introduction

In safety-critical domains such as autonomous driving and medical diagnosis, a neural network's "confidence" is as vital as its raw accuracy. Ideally, a model should be perfectly calibrated: if it predicts a 90% probability for a class, it should be correct 90% of the time. However, modern deep neural networks are systematically overconfident.

To address this, researchers often employ "post-hoc" calibration—adjusting outputs after training. The current gold standard, Temperature Scaling (TS), divides raw logits by a single learned scalar ($T$). While TS is popular because it is "accuracy-preserving" (it doesn't change the model's top-1 prediction), it is limited by its simplicity. It applies a uniform correction to every data point, regardless of the specific instance's difficulty. This paper introduces Parameterized Temperature Scaling (PTS), which enhances calibration by predicting a unique temperature for every individual prediction.

Methodology

The core innovation of PTS is the transformation of the temperature $T$ from a static scalar into a dynamic function. Instead of learning one $T$ for an entire dataset, the authors learn a function $g_\theta$ that predicts a specific temperature for each input.

  • The Calibration Network: The authors parameterize the temperature using a lightweight neural network. To ensure efficiency and prevent overfitting, this network is remarkably small, typically consisting of just two hidden layers with five nodes each.
  • Input Features: The input to this auxiliary network is the set of unnormalized logits from the original model, sorted by value. This allows the network to sense the relative distribution of class scores.
  • Accuracy Preservation: Because the transformation involves dividing logits by a positive scalar predicted by the network, the relative ranking of classes remains unchanged. This ensures that the original model’s top-1 accuracy is perfectly preserved.
  • Optimization: The calibration network is trained on a validation set using a squared error loss, effectively teaching it to map raw model outputs to temperatures that align confidence with actual likelihood.

Experimental Setup

The researchers evaluated PTS across a diverse range of architectures and datasets to demonstrate its generalizability:

  • Datasets: ImageNet, CIFAR-10, and CIFAR-100.
  • Architectures: A wide array of models including ResNet50, ResNet152, DenseNet169, Xception, MobileNetV2, VGG19, and LeNet5.
  • Validation: Standard splits (e.g., 5,000 samples for CIFAR) were used to ensure fair comparison with existing post-hoc methods.

Key Insights: The Expressive Power Bottleneck

A central finding of the paper is that the "expressive power" of a calibration method—the number of parameters it uses to model the error—is a primary bottleneck for performance. Traditional TS uses only one parameter, which is often insufficient for complex datasets.

Figure 3: Calibration error vs. number of parameters. PTS achieves a superior balance of expressive power and error reduction compared to TS and ETS.

As shown in the figure above, increasing the number of parameters allows the calibration method to better "un-distort" the model's outputs. PTS hits a "sweet spot" where it provides enough flexibility to be precise while remaining simple enough to avoid the instabilities common in high-parameter non-parametric methods like histogram binning.

Key Results

PTS consistently outperformed all established baselines across nearly every combination of dataset and architecture tested.

Figure 1: Mean Expected Calibration Error (ECE) across different methods. PTS (ours) achieves the lowest error compared to standard Temperature Scaling (TS) and Ensemble Temperature Scaling (ETS).

Major highlights include:

  • Significant Error Reduction: PTS achieved an average 30% relative reduction in Expected Calibration Error (ECE) compared to the previous state-of-the-art, Ensemble Temperature Scaling (ETS).
  • Consistency: Unlike many methods that are architecture-dependent, PTS was the top performer across the board, demonstrating high robustness.
  • Data Efficiency: Despite being a neural network, PTS maintains high performance even with small validation sets, making it practical for real-world applications where labeled validation data may be scarce.

Limitations and Future Work

While PTS represents a significant step forward, the authors note several areas for future exploration. Currently, the calibration network only utilizes the top 10 logits. Incorporating additional information, such as features from the original model's intermediate layers, could potentially refine the temperature prediction further. Additionally, while the computational overhead of the tiny auxiliary network is minimal, ultra-low-latency applications may require further optimization of the inference pipeline.

Summary updated

BibTeX
@inproceedings{tomani2022parameterized,
  author = {Christian Tomani and Daniel Cremers and Florian Buettner},
  title = {{Parameterized Temperature Scaling for Boosting the Expressive Power in Post-Hoc Uncertainty Calibration}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-19778-9\_32},
}
Figure