NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Layer-Stack Temperature Scaling

Amr Khalifa, Michael C. Mozer, Hanie Sedghi, Behnam Neyshabur, Ibrahim Alabdulmohsin

Introduction

Modern deep neural networks are notoriously poorly calibrated, often exhibiting overconfidence where a "90% confidence" score does not correspond to a 90% success rate. While Temperature Scaling (TS) is a common post-hoc solution, it is limited: it only rescales the final output, failing to improve underlying accuracy or maintain calibration under distribution shifts (e.g., blurry or noisy data).

Layer-Stack Temperature Scaling (LATES) addresses these limitations by aggregating predictions from intermediate layers. By treating these layers as a "committee," LATES captures general-purpose features from early layers that can correctly classify "easy" examples, thereby improving both accuracy and uncertainty estimation with negligible computational overhead.

Methodology

LATES is a post-hoc calibration method that extends temperature scaling across the network's depth using a stacking technique. The process involves three primary stages:

  1. Probing: Linear probes (small classifiers) are inserted into the intermediate layers of a frozen, pre-trained model. These probes learn to predict targets based on layer-specific activations.
  2. Stacking Logits: During inference, logits from all intermediate probes and the original classifier are concatenated into a single matrix.
  3. Aggregation: A lightweight aggregator—a linear layer with one weight ($\beta$) per layer—is trained on a small validation set to learn the optimal weighted combination of these "votes."
The LATES architecture: intermediate layers are probed, and their logits are aggregated to produce final predictions.

Crucially, LATES does not require retraining the backbone architecture, making it highly efficient. For a ResNet50, it adds less than 1% to the parameter count and less than 0.7% to GFlops.

Experimental Results

The authors evaluated LATES on standard benchmarks (CIFAR-10/100, ImageNet) and corrupted datasets to test out-of-distribution (OOD) robustness.

Performance Gains

Unlike standard calibration methods that only adjust probabilities, LATES can change the final predicted class by leveraging intermediate features. This allows it to break the traditional accuracy-calibration trade-off. On ImageNet with a ResNet50 backbone, LATES significantly outperformed standard Temperature Scaling (T) across multiple metrics.

Comparison of standard Temperature Scaling (T) and LATES (L) on ImageNet using a ResNet50 backbone.

As shown in the table above, LATES reduced the Expected Calibration Error (ECE) from 0.060 to 0.023 while simultaneously boosting Top-1 accuracy from 73.8% to 74.5%.

Robustness and Efficiency

LATES demonstrates superior stability in low-data regimes, where standard TS often degrades calibration. Furthermore, it shows consistent improvements in Area Under the ROC Curve (AUC) and calibration under distribution shifts, outperforming baseline methods as data corruption levels increase. When combined with other techniques like Monte Carlo (MC) Dropout, LATES matches or exceeds state-of-the-art uncertainty estimation results.

Conclusion and Limitations

LATES provides a lightweight, post-hoc path to more reliable neural networks. While it introduces a one-time training overhead for probes (roughly 25% of initial training time), the inference-time cost is minimal. Future work may explore its application beyond CNNs and Vision Transformers to architectures like LSTMs or Large Language Models (LLMs).

Summary updated

BibTeX
@misc{khalifa2022layer,
  author = {Amr Khalifa and Michael C. Mozer and Hanie Sedghi and Behnam Neyshabur and Ibrahim Alabdulmohsin},
  title = {{Layer-Stack Temperature Scaling}},
  year = {2022},
  eprint = {2211.10193},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.10193},
}
Figure