Source-linked AI summary

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

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

arXiv:2006.10108v2cs.LGstat.ML

TL;DR

The paper addresses the cost of Bayesian neural networks and deep ensembles for scalable predictive uncertainty estimation. It formalizes uncertainty quantification as a minimax problem, identifies input distance awareness as necessary, and proposes SNGP using spectral normalization and a Gaussian-process output. Across vision and language tasks, SNGP is competitive with deep ensembles while preserving single-DNN accuracy and latency, though the study does not capture the full complexity of real-world uncertainty use cases.

  • Problem

    Bayesian neural networks and deep ensembles provide principled uncertainty estimates but impose heavy memory and inference costs, motivating high-quality uncertainty estimation with a single DNN.

  • Method

    SNGP improves DNN distance awareness by spectrally normalizing hidden layers and replacing the dense output layer with a scalable Gaussian-process approximation.

  • Results

    Across vision and language understanding tasks, SNGP is competitive with deep ensembles in prediction, calibration, and out-of-domain detection while retaining single-DNN accuracy and latency.

  • Takeaways & Limitations

    Input distance awareness is identified as a key design principle for high-quality uncertainty estimation in deterministic deep learning.

  • Takeaways & Limitations

    The study’s analysis and experiments may not capture the full complexity of real-world use cases, so the paper does not claim to solve model uncertainty entirely.

Abstract

from arXiv · show

Bayesian neural networks (BNN) and deep ensembles are principled approaches to estimate the predictive uncertainty of a deep learning model. However their practicality in real-time, industrial-scale applications are limited due to their heavy memory and inference cost. This motivates us to study principled approaches to high-quality uncertainty estimation that require only a single deep neural network (DNN). By formalizing the uncertainty quantification as a minimax learning problem, we first identify input distance awareness, i.e., the model's ability to quantify the distance of a testing example from the training data in the input space, as a necessary condition for a DNN to achieve high-quality (i.e., minimax optimal) uncertainty estimation. We then propose Spectral-normalized Neural Gaussian Process (SNGP), a simple method that improves the distance-awareness ability of modern DNNs, by adding a weight normalization step during training and replacing the output layer with a Gaussian process. On a suite of vision and language understanding tasks and on modern architectures (Wide-ResNet and BERT), SNGP is competitive with deep ensembles in prediction, calibration and out-of-domain detection, and outperforms the other single-model approaches.

1 Introduction

Reliable uncertainty estimation is important for real-time, industrial-scale DNN applications, but common models may fail to recognize inputs far from training data. SNGP addresses this through distance-aware representations and a Gaussian-process output layer while retaining single-DNN efficiency.

  • Motivation: Industrial applications require DNNs to quantify predictive uncertainty reliably and in real time.Examples include autonomous-driving object recognition, online advertising, and conversational intent understanding.
  • Motivation: Deep classifiers can perform arbitrarily badly on inputs far from the training-set support, motivating distance-aware uncertainty estimates.For out-of-domain inputs, the desired behavior is a uniform, maximum-entropy label distribution.
  • Approach: SNGP adds spectral normalization to hidden layers and replaces the output layer with a Gaussian process to improve distance awareness.The method uses a Laplace approximation to random Fourier features for scalable posterior uncertainty estimation without Monte Carlo sampling.
  • Results: SNGP is competitive with deep ensembles in calibration and out-of-domain detection while maintaining the accuracy and latency of a single deterministic DNN.The evaluation uses Wide ResNet on CIFAR datasets and BERT on the CLINC out-of-scope intent dataset.

2 Distance Awareness: An Important Condition for High-Quality Uncertainty Estimation

The paper frames uncertainty estimation over both in-domain and unknown out-of-domain inputs as a minimax problem. Its key conclusion is that high-quality uncertainty requires estimating how far a test input lies from the training domain.

  • Problem setup: Training data cover only the in-domain subset, while testing requires predictive distributions over the entire input space, including unknown out-of-domain inputs.The out-of-domain conditional label distribution is not learned during training and may differ substantially from the in-domain distribution.
  • Uncertainty risk minimization: Expected Calibration Error is unsuitable as the sole loss because a random predictor can achieve perfect calibration without matching the true distribution.The paper instead considers strictly proper scoring rules, including log-loss and Brier score.
  • Uncertainty risk minimization: The minimax-optimal predictive distribution trusts the learned in-domain model and uses a uniform maximum-entropy prediction outside the training domain.This form is optimal for a broad family of Bregman scores, including Brier and log scores.
  • Distance awareness: A model therefore needs to quantify the domain probability of an input or, equivalently, its distance from the training data under a meaningful data-manifold metric.Input distance awareness can be expressed through an uncertainty statistic such as entropy or predictive variance.
  • Distance awareness: Gaussian processes with suitable kernels are distance aware, whereas standard DNN confidence often reflects distance to decision boundaries rather than distance from the training domain.For an RBF-kernel GP, predictive uncertainty increases toward its maximum as the test input moves away from the in-domain set.
  • Conditions for distance awareness: Deep models can achieve input distance awareness by combining a distance-aware output layer with a distance-preserving hidden representation.The bi-Lipschitz condition is presented as a way for hidden representations to preserve semantically meaningful input distances.

3 SNGP: A Simple Approach to Distance-aware Deep Learning

SNGP improves distance awareness by combining a Gaussian-process output layer with distance-preserving hidden representations. Its scalable implementation uses random Fourier features, Laplace approximation, spectral normalization, and efficient posterior updates.

  • Method overview: SNGP improves a residual DNN’s input distance awareness by making its output layer distance aware and its hidden layers distance preserving.The method targets modern residual architectures such as ResNet and Transformer models.
  • Distance-aware output layer: SNGP replaces the dense output layer with a Gaussian process whose posterior variance reflects hidden-space distance from the training data.The GP uses an RBF kernel and produces distance-sensitive uncertainty at test inputs.
  • Distance-aware output layer: Random Fourier features approximate the GP kernel with a low-rank representation, yielding a closed-form posterior that is end-to-end trainable with the neural network.This converts the infinite-dimensional GP into a Bayesian linear model over fixed random features and learnable output weights.
  • Distance-aware output layer: The Laplace approximation uses a Gaussian posterior around the maximum a posteriori estimate and provides a convenient closed-form posterior variance.The resulting posterior precision has a simple expression under the random-feature linear-model formulation.
  • Scalable inference: Posterior mean parameters are updated with stochastic gradient descent, while posterior precision is updated cheaply using minibatch statistics.The precision update only needs to pass through the training data once during the final epoch.
  • Distance-preserving hidden layers: Spectral normalization bounds residual-layer weight norms, making the hidden mapping distance preserving under Lipschitz constraints.For α-Lipschitz residual mappings, the overall representation satisfies bounds L1 = (1−α)^L−1 and L2 = (1+α)^L−1.
  • Scalable training: The method controls the spectral-norm upper bound with a hyperparameter c and integrates normalization and final-epoch precision updates into the DNN training pipeline.The implementation is designed to remain compatible with other hidden-layer regularization mechanisms.

4 Related Work

SNGP is positioned among efficient single-model uncertainty methods and differs from prior neural-GP work in where it applies Laplace approximation. Related ensemble methods reduce parameter overhead but still require multiple forward passes.

  • Efficient ensemble methods: Efficient ensemble methods use low-rank perturbations to encourage independent member predictions within a single model.They are parameter-efficient but still require multiple model forward passes.
  • Efficient ensemble methods: SNGP investigates an alternative to efficient ensembles that aims to retain single-model inference while estimating uncertainty.Its approach is presented as orthogonal to low-rank ensemble methods.
  • Laplace approximation and GP inference: Unlike earlier DNN-GP combinations and related Laplace work, SNGP applies Laplace approximation to the posterior of a neural Gaussian process.The cited prior approaches include shallow-GP and dense-output-layer DNN formulations.

5 Experiments

Experiments evaluate SNGP against deterministic, ensemble, and other single-model approaches across synthetic, vision, and language tasks. SNGP preserves distance-aware uncertainty and achieves competitive prediction while improving calibration and out-of-domain detection.

  • 2D Synthetic Benchmark: Shallow Gaussian processes assign low uncertainty in supported regions and high uncertainty far from training data, whereas dense-output methods can remain overconfident on OOD examples.The synthetic benchmarks compare two ovals and two moons distributions with unseen OOD regions.
  • 2D Synthetic Benchmark: SNGP maintains an uncertainty surface analogous to the shallow Gaussian-process reference despite using a 12-layer network.Its bi-Lipschitz constraint preserves input distance awareness in the deep representation.
  • Experimental Setup: The experiments compare Wide ResNet-28-10 and BERTBase with deterministic, MC Dropout, deep-ensemble, MCD-GP, and DUQ baselines.The reported table results are averaged over 10 seeds, and Table 1 distinguishes methods requiring multiple predictive-distribution forward passes.
  • CIFAR-10 and CIFAR-100: SNGP is competitive with deterministic networks in CIFAR predictive accuracy, outperforms other single-model approaches in calibration, and leads OOD detection against ensembles and GP-based alternatives.The evaluations use clean and corrupted CIFAR data, with SVHN and cross-dataset settings for OOD detection.
  • Conversational Language Understanding: SNGP is competitive with a deterministic baseline in CLINC OOS predictive accuracy and outperforms other approaches in calibration and OOD detection.The benchmark trains on in-domain services and evaluates on combined in-domain and out-of-domain utterances.

6 Conclusion

The paper concludes that input distance awareness and good representation learning are central to single-model uncertainty estimation, with SNGP providing a practical implementation. It also identifies open questions about how broadly bi-Lipschitz representations explain uncertainty improvements and how precisely spectral regularization should be bounded.

  • Conclusion: SNGP combines spectral normalization, a random-feature GP output layer, and a closed-form Laplace approximation for scalable single-model uncertainty estimation.The approximation makes the GP posterior end-to-end trainable in linear time with the neural network.
  • Conclusion: Across vision and language tasks, SNGP is competitive with deep ensembles in prediction, calibration, and out-of-domain detection while outperforming other single-model approaches.The evaluation includes modern ResNet and BERT architectures.
  • Open Questions: The paper highlights bi-Lipschitz representations as important for uncertainty quality, while noting that data augmentation and unsupervised pretraining may also contribute.Whether these techniques improve the bi-Lipschitz condition, and whether that condition is sufficient, remains open.
  • Limitations: The spectral norm bound α < 1 is sufficient but not necessary for bi-Lipschitzness, and convolutional layers may require a looser bound for state-of-the-art performance.This raises questions about the precision of the current regularization approach.

Broader Impact

The methodology improves calibration and OOD detection while maintaining similar accuracy and latency, supporting industrial-scale use. The authors caution that it does not solve model uncertainty entirely.

  • SNGP improves calibration and OOD detection while maintaining similar accuracy and latency.These properties illustrate feasibility for industrial-scale applications.
  • The analysis and experiments may not capture the full complexity of real-world use cases.The authors therefore leave room for further improvement and urge users to confront model and confidence shortcomings.

A Method Summary

SNGP combines spectral normalization in hidden layers with a Gaussian-process output layer to improve distance awareness while retaining scalable inference. Its prediction procedure computes posterior means and variances from a single feed-forward pass, with optional Monte Carlo averaging.

  • SNGP adds spectral normalization to hidden weights and replaces the dense output layer with a GP layer.The GP layer uses a random-feature approximation with frozen randomly initialized weights.
  • Spectral normalization is applied after each minibatch SGD update using power iteration.The training loop also updates the precision matrix, with power iteration complexity scaling with hidden-layer dimensions.
  • The computation scales linearly with sample size when the random-feature dimension is fixed, using D_L = 1024 in experiments.The stated architecture constraint is typically D_L ≤ 1024.
  • Prediction computes hidden features, posterior means, and predictive variances during the conventional forward pass.The predictive variance is ˆσ_k(x)^2 = Φ(x)^⊤ˆΣΦ(x), with posterior parameters obtained from the model’s covariance computation.
  • Monte Carlo averaging is cheap because samples come from a closed-form distribution whose parameters are computed in one feed-forward pass.The experiments use 10 samples, while mean-field approximation is proposed as a future lower-latency alternative.

B Formal Statements

The formal analysis casts uncertainty estimation as minimax risk minimization under unknown out-of-domain label distributions. Its unique solution combines the learned in-domain predictive distribution with a uniform distribution outside the in-domain region.

  • The minimax formulation asks how to construct the best predictive distribution given the learned in-domain distribution and domain probability.The analysis emphasizes that domain probability is necessary for optimal uncertainty quantification.
  • Proposition 2 states that the unique optimal solution can be constructed from the learned in-domain predictive distribution and domain assumptions.The proposition formalizes the construction under stated conditions.
  • The resulting mixture is optimal for a broad family of separable Bregman scores, including the Brier and log scores.The proof proceeds by decomposing risk into disjoint in-domain and out-of-domain components.
  • For out-of-domain inputs, the minimax solution uses the discrete uniform distribution over K classes.This conclusion follows from Lemma 1 for strictly proper scoring rules.
  • The result depends on strictly proper scoring rules; with non-strict rules such as ECE, infinitely many optima can make the minimax problem ill-posed.The authors identify this as a limitation of Lemma 1.

C Experiment Details and Further Results

The experiments evaluate SNGP and alternative uncertainty methods on synthetic, vision, and language tasks using calibration, OOD detection, accuracy, and latency metrics. Further results examine uncertainty metrics, hyperparameters, and implementation settings.

  • C.1 2D Synthetic Benchmark: The synthetic benchmark samples 500 observations per in-domain class and uses a 12-layer, 128-unit residual feedforward architecture.The model uses dropout rate 0.01 and projects two-dimensional inputs to 128 dimensions.
  • C.1 2D Synthetic Benchmark: The comparison includes GP, Deep Ensemble, MC Dropout, DNN-GP, SNGP, and DNN-SN.Deep Ensemble uses 10 models, while MC Dropout uses 10 dropout samples.
  • C.1 2D Synthetic Benchmark: Figure 2-3 measure predictive-probability uncertainty as u(x) = 1−2∗|p−0.5|, with background color encoding estimated uncertainty.The figures cover the two-ovals and two-moons benchmarks.
  • C.1 2D Synthetic Benchmark: Predictive-probability uncertainty is more influenced by the decision boundary than predictive variance, motivating future comparison of uncertainty metrics for calibration and OOD performance.The paper suggests GP-logit uncertainty may be a better metric for these evaluations.
  • Hyperparameters: Spectral normalization trades residual-block expressiveness against preservation of the bi-Lipschitz property through the spectral bound c.Small c can shrink blocks toward identity, while large c may lose the bi-Lipschitz property.
  • Hyperparameters: The GP layer uses random-feature dimension D_L, RBF length-scale l, output-weight regularization, and covariance-update parameters s and m.The experiments generally use D_L = 1024 or 2048, l = 2.0, and zero L2 regularization.
  • Hyperparameters: Experiments enable input layer normalization and set its dimension to 128, although ablations found performance insensitive to these values.Input projection can reduce the penultimate hidden dimension before the GP layer.
  • C.2 Vision and Language Understanding: CIFAR evaluation measures accuracy and calibration on clean and corrupted data, OOD detection with AUPR, and inference latency in milliseconds per image.CIFAR10-C contains 15 corruption types across five intensity levels; calibration uses ECE with M = 15 bins.

E.2 Proof of Lemma 1

The proof applies a generalized maximum-entropy theorem to Bregman scores, then shows that the maximum-entropy distribution under no information is discrete uniform and therefore minimax optimal.

  • The generalized maximum-entropy theorem states that, under regularity conditions on the entropy function, a maximum-entropy distribution attains minimax optimality.The stated conditions include well-definedness and lower semicontinuity.
  • For out-of-domain inputs, the proof reduces minimax optimality for Bregman scores to showing that the discrete uniform distribution is maximum entropy.The argument relies on the fact that Bregman-score entropy satisfies the theorem’s regularity conditions.
  • The optimization imposes only that predictive probabilities sum to one because no other information is available for the out-of-domain input.A Lagrangian is used to optimize Bregman entropy under this normalization constraint.
  • Strict concavity makes ψ′ invertible, enabling the maximum-entropy equations to be simplified until all class probabilities are equal.The resulting equal probabilities are compatible with the normalization constraint.
  • The proof concludes that the discrete uniform distribution is the unique distribution satisfying the equal-probability and normalization conditions.This establishes the claimed maximum-entropy result for the Bregman-score setting.
Loading 2006.10108v2…