Simple and Principled Uncertainty Estimation with Deterministic Deep Learning via Distance Awareness

Jeremiah Z. Liu, Zi Lin, Shreyas Padhy, Dustin Tran, Tania Bedrax-Weiss, Balaji Lakshminarayanan

Deep learning models are notoriously overconfident. When presented with an image or text completely unlike anything in their training set (Out-of-Domain or OOD data), standard deep neural networks (DNNs) often assign it a high-probability label rather than admitting uncertainty.

While Bayesian Neural Networks and Deep Ensembles (training multiple versions of the same model) provide much better uncertainty estimates, they are often too computationally expensive for real-time, industrial-scale applications due to high memory and inference costs.

This NeurIPS 2020 paper from Google Research introduces SNGP (Spectral-normalized Neural Gaussian Process), a simple, plug-and-play method that enables a single deep neural network to produce high-quality uncertainty estimates by making it "distance-aware." It achieves performance competitive with deep ensembles in out-of-domain detection and calibration while maintaining the speed and simplicity of a standard deterministic model.

The Core Missing Property: Distance Awareness

The authors identify a fundamental flaw in standard DNNs: they lack Distance Awareness. Most models quantify uncertainty based on how close a point is to a decision boundary, but they have no idea how far a point is from the training data manifold.

Standard DNNs often discard "irrelevant" distance information during feature extraction—a phenomenon the authors call "Feature Collapse." SNGP aims to fix this for a single, deterministic model by ensuring the model "remembers" where the training data was located and increases its uncertainty as inputs move further away from that data.

Uncertainty surfaces on 2D synthetic datasets comparing SNGP to other methods.

How SNGP Works

The authors propose two key modifications to standard residual networks (like ResNet or BERT) to formalize uncertainty quantification as a minimax learning problem:

  1. Distance-Preserving Hidden Mapping (Spectral Normalization): To ensure the model doesn't collapse different parts of the input space together, they apply Spectral Normalization (SN) to the hidden layers. This bounds the Lipschitz constant of the network, ensuring that if two points are far apart in the input space, their hidden representations remain meaningfully distant.
  2. Distance-Aware Output Layer (Gaussian Process): They replace the standard dense output layer with a Gaussian Process (GP). To make this computationally feasible for deep learning, they use a Random Fourier Feature (RFF) expansion to approximate the GP and a Laplace approximation to update the model's posterior in a single pass.

The result is a model that trains like a normal DNN but uses a closed-form covariance update at the end of training to map out its uncertainty.

Key Results and Efficiency

The authors evaluated SNGP across distinct domains, including 2D synthetic benchmarks, computer vision (CIFAR-10/100, SVHN), and Natural Language Understanding (the CLINC OOS intent detection dataset).

  • OOD Detection: On CIFAR-10 (using SVHN as the OOD dataset), SNGP achieved an impressive AUPR of 0.990, significantly outperforming a standard deterministic model (0.781) and even beating Deep Ensembles (0.964).
  • Calibration: On the CLINC OOS language task, SNGP achieved an Expected Calibration Error (ECE) of 0.014, nearly twice as good as the standard BERT model (0.024) and highly competitive with ensembles.
  • Efficiency: Unlike methods that require generating fake OOD data or complex sampling (like Monte Carlo Dropout), SNGP works during a standard training run and requires only a single forward pass at inference time. For a Wide ResNet, SNGP's inference time was 6.25ms per example, compared to a sluggish 38.10ms for a 10-model Deep Ensemble.
Performance comparison on CIFAR-10, including accuracy, calibration (ECE), OOD detection (AUPR), and latency.

Limitations and Future Work

While highly effective, SNGP does have a few limitations. The method relies on a spectral norm bound ($c$), which is a hyperparameter that may need tuning depending on the architecture and task. Furthermore, the authors note that for convolutional layers, a looser norm bound is often needed to maintain state-of-the-art predictive performance, suggesting the current regularization might be slightly too aggressive for some vision tasks.

Finally, SNGP focuses primarily on "data uncertainty" (aleatoric) and "distance-based epistemic uncertainty." It does not explicitly account for "model uncertainty"—the variance between different possible weight configurations—in the way that ensembles do, though it provides a remarkably strong and efficient proxy for real-world applications.

Summary updated

BibTeX
@inproceedings{liu2020simple,
  author = {Jeremiah Z. Liu and Zi Lin and Shreyas Padhy and Dustin Tran and Tania Bedrax-Weiss and Balaji Lakshminarayanan},
  title = {{Simple and Principled Uncertainty Estimation with Deterministic Deep Learning via Distance Awareness}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=9A8SWa6UotC},
}
Figure