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

On Last-Layer Algorithms for Classification: Decoupling Representation from Uncertainty Estimation

Nicolas Brosse, Carlos Riquelme, Alice Martin, Sylvain Gelly, Eric MoulinesarXiv 2020

Introduction: The Overconfidence Problem

Standard deep learning models are notoriously overconfident. A classifier might encounter a blurry image—such as a seal—and label it a "worm" with 90% confidence simply because it hasn't been trained to express uncertainty. While Bayesian Neural Networks (BNNs) provide a mathematically sound framework for quantifying this uncertainty, they are computationally prohibitive to train for modern, large-scale architectures like those used for ImageNet.

A blurry image (e.g., a seal) that a standard classifier might incorrectly label as a 'worm' with high confidence.

This research addresses a practical challenge: providing high-quality uncertainty estimates for deep classifiers without the prohibitive cost of full Bayesian inference. The authors investigate whether the "heavy lifting" of uncertainty quantification occurs primarily at the final decision boundary rather than throughout the entire feature-extraction pipeline.

Methodology: Decoupling Representation from Uncertainty

The authors propose a two-stage framework that separates the learning of features from the estimation of predictive uncertainty:

  1. Representation Learning: A standard deep neural network (e.g., VGG-16 or NASNet) is trained to convergence using vanilla Stochastic Gradient Descent (SGD).
  2. Uncertainty Estimation: The "backbone" of the network is frozen, and the output of the penultimate layer is treated as a fixed feature vector ($z$). Uncertainty-aware algorithms are then applied exclusively to the final dense layer.
A typical distribution of confidence scores in a standard model, illustrating the characteristic spike at 1.0 that signifies overconfidence.

Evaluated Last-Layer Algorithms

The study compares four specific last-layer approaches:

  • SGLD (Stochastic Gradient Langevin Dynamics): An MCMC method that adds Gaussian noise to gradients to sample from the posterior distribution.
  • SGD Snapshots: Using SGD with a constant learning rate as a proxy for approximate posterior sampling.
  • Bootstrap: Training an ensemble of last layers on different "bootstrapped" versions of the feature dataset.
  • MC-Dropout: Maintaining active dropout during last-layer inference to generate a distribution of predictions.

Performance was evaluated using three confidence functions: Softmax Response (SR) (the maximum probability), Predictive Standard Deviation (STD), and Predictive Entropy.

Key Insights

The "Last Layer is Enough" Hypothesis

For complex tasks like ImageNet, applying uncertainty methods to the last layer captures almost all the benefits of full-network Bayesian inference. This suggests that once features are well-learned, the primary source of actionable uncertainty lies in the final classification mapping. Furthermore, adding multiple "uncertainty layers" (up to 3 dense layers) rarely improved performance, reinforcing the efficiency of the single last-layer approach.

Resilience of Softmax Response

Despite being a "simple" point-estimate metric, the maximum softmax probability (SR) consistently outperformed more complex measures like predictive variance (STD) across almost all benchmarks. This challenges the assumption that complex Bayesian metrics are always necessary for reliable uncertainty estimation.

Stability via Decoupling

SGLD is notoriously unstable when applied to full deep networks, often diverging unless the learning rate is extremely small. However, when restricted to the last layer, the loss landscape is "strongly log-concave," making SGLD much better behaved, easier to tune, and more effective.

Results and Performance

  • ImageNet Gains: Last-layer methods significantly outperformed vanilla point-estimate SGD. For instance, last-layer Dropout reduced the Area Under the Risk-Coverage curve (AURC)—a measure of how well a model knows its own limits—by approximately 10% compared to the baseline.
  • Efficiency: On CIFAR-100, last-layer SGLD achieved a 19% better AURC than its full-network counterpart, proving that "less is more" when the full-network version is prone to optimization instabilities.
  • OOD Detection: In out-of-distribution (OOD) scenarios, last-layer versions performed comparably to, and sometimes better than, full-network versions, particularly on MNIST and CIFAR benchmarks.

Limitations and Future Directions

The two-stage approach is a heuristic that technically breaks the strict Bayesian framework, as features are learned without considering eventual uncertainty estimation. This may lead to sub-optimal representations for uncertainty. Future work may explore Laplace approximations for the last layer and investigate Temperature Scaling as a complementary post-processing step to further refine calibration. While these methods are efficient, they have not yet been extensively compared against "Deep Ensembles," which remain the gold standard for uncertainty at a significantly higher computational cost.

Summary updated

BibTeX
@misc{brosse2020last,
  author = {Nicolas Brosse and Carlos Riquelme and Alice Martin and Sylvain Gelly and Eric Moulines},
  title = {{On Last-Layer Algorithms for Classification: Decoupling Representation from Uncertainty Estimation}},
  year = {2020},
  eprint = {2001.08049},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2001.08049},
}
Figure