Expectation consistency for calibration of neural networks

Lucas Clarté, Bruno Loureiro, Florent Krzakala, Lenka Zdeborová · DOI

Introduction

Modern deep neural networks (DNNs) have achieved remarkable predictive accuracy across diverse domains. However, a significant gap remains between their predictive performance and their reliability: these models are frequently "overconfident." The probability scores produced by the final softmax layer often fail to represent the actual likelihood of a prediction being correct. This lack of calibration is a critical barrier to the deployment of DNNs in high-stakes environments such as healthcare and autonomous systems.

The Calibration Challenge

The standard approach to addressing overconfidence is Temperature Scaling (TS). TS rescales the network's logits by a single scalar parameter $T$, which is typically optimized by minimizing cross-entropy loss on a held-out validation set. While effective and simple, TS is largely a heuristic method. This research introduces Expectation Consistency (EC), a principled alternative grounded in Bayesian inference and statistical physics.

Expectation Consistency (EC)

Like Temperature Scaling, EC utilizes a post-training rescaling of logits by a temperature parameter $T$. However, the optimization objective differs fundamentally. While TS minimizes validation loss, EC identifies a $T$ such that the model's average confidence on the validation set matches its average accuracy.

The EC temperature selection process (left) matches average confidence to validation accuracy, aligning with the minimum Expected Calibration Error (middle).

This approach enforces the Nishimori identity, a property of optimal Bayesian predictors. By ensuring that the expected confidence equals the expected accuracy, EC provides a mathematically rigorous foundation for calibration that does not rely solely on loss minimization.

Robustness and Theoretical Insights

A key contribution of this work is the analysis of EC under "misspecified" conditions—scenarios where the model's architectural assumptions do not perfectly align with the underlying data distribution. Using the "replica method" from statistical physics, the authors demonstrate that while TS and EC converge to the same solution in well-specified cases, EC exhibits superior robustness when the data is noisy or the model is misspecified.

Empirical Evaluation

The authors evaluated EC against TS across several benchmarks, including CIFAR-10, CIFAR-100, and SVHN, using architectures like ResNet and DenseNet.

  • Standard Benchmarks: On clean datasets, EC and TS perform almost identically in terms of Expected Calibration Error (ECE) and Brier Score.
  • Data Corruption: The strengths of EC become apparent in the presence of label noise or distribution shifts. In experiments with corrupted labels, EC consistently outperformed TS. For instance, on CIFAR-100 with 10% label corruption, EC reduced the ECE to 5.9%, whereas TS only reached 9.6%.
Impact of label corruption (α) on model accuracy, temperature T, and ECE. EC maintains lower ECE than TS as corruption increases.

Conclusion

Expectation Consistency offers a simple, principled, and robust method for calibrating neural networks. By shifting the focus from loss minimization to satisfying an optimality identity, EC provides a calibration technique that is as easy to implement as Temperature Scaling but more reliable under challenging, real-world data conditions. Future work will explore extending this framework to regression tasks and structured prediction.

Summary updated

BibTeX
@inproceedings{clarte2023expectation,
  author = {Lucas Clarté and Bruno Loureiro and Florent Krzakala and Lenka Zdeborová},
  title = {{Expectation consistency for calibration of neural networks}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2023},
  url = {https://openreview.net/forum?id=6xX9VWjZbG},
}
Figure