Source-linked AI summary

Being Bayesian, Even Just a Bit, Fixes Overconfidence in ReLU Networks

Agustinus Kristiadi, Matthias Hein, Philipp Hennig

arXiv:2002.10118v2stat.MLcs.LG

TL;DR

ReLU networks trained with point estimates can become arbitrarily confident far from the training data, while theoretical analysis of Bayesian approximations has been limited. The paper analyzes Gaussian weight distributions and finds that even a last-layer Bayesian approximation mitigates this overconfidence, with empirical validation in binary and multi-class settings.

  • Problem

    Point-estimated ReLU networks can be arbitrarily overconfident far from training data, while theoretical understanding of approximate Bayesian uncertainty in these networks is limited.

  • Method

    The paper theoretically analyzes Gaussian approximate weight distributions for binary ReLU classifiers and empirically evaluates Laplace approximations, including last-layer-only treatment.

  • Results

    Gaussian weight approximations mitigate asymptotic overconfidence, and experiments validate the approach in binary and multi-class classification settings.

  • Takeaways & Limitations

    Being “a bit” Bayesian—applying a Gaussian-based Bayesian method to the last layer—can provide desirable uncertainty benefits at low cost overhead.

  • Takeaways & Limitations

    The theoretical analysis focuses on binary classification, while extension to multi-class classification is not straightforward despite empirical evidence in that setting.

Abstract

from arXiv · show

The point estimates of ReLU classification networks---arguably the most widely used neural network architecture---have been shown to yield arbitrarily high confidence far away from the training data. This architecture, in conjunction with a maximum a posteriori estimation scheme, is thus not calibrated nor robust. Approximate Bayesian inference has been empirically demonstrated to improve predictive uncertainty in neural networks, although the theoretical analysis of such Bayesian approximations is limited. We theoretically analyze approximate Gaussian distributions on the weights of ReLU networks and show that they fix the overconfidence problem. Furthermore, we show that even a simplistic, thus cheap, Bayesian approximation, also fixes these issues. This indicates that a sufficient condition for a calibrated uncertainty on a ReLU network is "to be a bit Bayesian". These theoretical results validate the usage of last-layer Bayesian approximation and motivate a range of a fidelity-cost trade-off. We further validate these findings empirically via various standard experiments using common deep ReLU networks and Laplace approximations.

1. Introduction

ReLU networks can become arbitrarily overconfident far from training data, motivating uncertainty-aware alternatives. The paper shows theoretically and empirically that Gaussian weight approximations, even applied only to the last layer, mitigate this problem.

  • Motivation: ReLU networks can produce arbitrarily high confidence far away from the training data, making their predictions vulnerable to out-of-distribution examples.This behavior arises for scaled training points as δ →∞.
  • Approach: The paper theoretically analyzes binary ReLU classifiers with logistic outputs equipped with Gaussian approximate weight distributions.The analysis concerns predictive confidence under uncertainty in the weights.
  • Theoretical results: Gaussian approximations bound predictive confidence far from training data away from one, with the limit controlled by the covariance.Under Laplace approximations with a probit approximation, the decision boundary is unchanged.
  • Theoretical results: Applying a Bayesian Gaussian approximation only to the last layer is sufficient for desirable uncertainty behavior at low computational overhead.The first L−1 layers can remain a fixed feature map while the final layer acts as a Bayesian linear classifier.
  • Empirical validation: Experiments with common deep ReLU networks and Laplace approximations validate the findings in binary and multi-class classification settings.The theoretical analysis focuses on binary classification, while the multi-class result is empirical and suggests the analysis may extend.

2. Analysis

ReLU networks can become arbitrarily confident far from training data, but Gaussian uncertainty over weights makes far-away confidence converge to a covariance-controlled limit. This guarantee holds for full-network and last-layer approximations, while covariance selection trades off out-of-distribution calibration against in-distribution confidence.

  • Problem: ReLU networks are piecewise affine and can attain confidence arbitrarily close to one when inputs are scaled sufficiently far from the training data.The result applies when the relevant affine-region weight matrices do not contain identical rows.
  • Gaussian approximation: Gaussian weight uncertainty preserves the MAP decision boundary while replacing deterministic confidence with a covariance-dependent predictive confidence.For a Gaussian approximation, the binary confidence is expressed through σ(|z(x)|), and the decision boundary remains unchanged.
  • All-layer approximation: As δ → ∞, |z(δx)| converges to a quantity determined only by the Gaussian mean and covariance, so far-away confidence approaches a limit bounded away from one.The convergence also holds in a finite asymptotic regime sufficiently far from the training data.
  • Last-layer approximation: Assigning Gaussian uncertainty only to the last layer provides a guarantee similar to the all-layer result, corresponding to Bayesian logistic regression on fixed ReLU features.This establishes a lower-cost approximation scheme while retaining the relevant asymptotic confidence control.
  • Laplace approximations: Increasing prior variance decreases far-away confidence up to a limit, whereas variance approaching zero recovers the MAP far-away confidence.Choosing variance too aggressively can also lower confidence on training and nearby test data, causing underconfident predictions.
  • Laplace approximations: The approximation objectives combine cross-entropy on observed data with predictive-entropy control on uniform-noise inputs through a trade-off parameter λ ∈ [0, 1].The noise set is taken as uniform noise in the input space in the reported experiments.

3. Related Work

Prior work documents severe overconfidence in ReLU networks and develops Bayesian and non-Bayesian approaches to improve uncertainty estimation. Bayesian methods have theoretical motivation, while this paper adds theoretical justification for the ReLU-logistic case.

  • ReLU networks can remain arbitrarily overconfident on inputs far from the training data.
  • Post-hoc temperature and Platt scaling methods cannot detect arbitrarily high confidence far away from the training data.
  • Existing uncertainty methods include Bayesian approximations, probabilistic output models, ensembles, frequentist calibration, and enhanced training objectives.
  • Bayesian methods are motivated as a way to mitigate neural-network overconfidence, with prior empirical evidence supporting this intuition.
  • The paper complements prior empirical support with a theoretical justification for Bayesian treatment in the ReLU-logistic case.

4. Experiments

Experiments test Gaussian-based Bayesian approximations on binary and multi-class ReLU networks, finding that they reduce far-away overconfidence and improve OOD detection, with last-layer methods offering favorable efficiency.

  • Experimental setup: The experiments use toy, binary, and multi-class datasets with LeNet or ResNet-18 and compare MAP, temperature scaling, and several Laplace approximations.The Bayesian methods include LLLA, DLA, and KFLA.
  • Binary classification: LLLA retains high confidence near binary training data while its confidence converges toward one-half as inputs move sufficiently far away.MAP and temperature scaling remain overconfident for large δ.
  • Binary classification: For binary far-away OOD data with δ = 100, LLLA achieves MMC and AUR close to the ideal values of 50 and 100, while MAP and temperature scaling saturate confidence near one.The reported metrics are mean maximum-confidence (MMC) and area-under-ROC-curve (AUR).
  • Multi-class classification: All Bayesian methods improve multi-class OOD detection in both non-asymptotic and asymptotic regimes, and LLLA often outperforms DLA and KFLA.The experiments use far-away Noise datasets constructed with δ = 2000.
  • Multi-class classification: Laplace approximations can be combined with ACET and Outlier-Exposure to achieve state-of-the-art non-asymptotic performance while retaining high asymptotic uncertainty.This result is reported for the methods evaluated in the appendix.
  • Computational cost: LLLA prediction is up to two orders of magnitude faster than DLA and KFLA because its cost is constant with respect to network depth.The comparison concerns Bayesian methods’ prediction cost.
  • Last-layer Gaussian processes: Deep kernel learning also mitigates asymptotic overconfidence, but LLLA generally performs better on MMC and AUR and avoids DKL’s retraining requirement.The comparison is made in the multi-class OOD setting.

5. Conclusion

The paper formalizes why Gaussian weight approximations mitigate asymptotic overconfidence in binary ReLU classifiers, addressing a previously missing theoretical characterization.

  • 5. Conclusion: Gaussian approximations of weight distributions mitigate asymptotic overconfidence in binary ReLU classification networks.The paper presents analytical statements for a behavior previously supported mainly by empirical observations.

A. Proofs

The proofs establish confidence behavior for Gaussian approximations over all layers and the last layer of binary ReLU classifiers, including Laplace-specific covariance properties.

  • Binary confidence: The invariance proposition shows that predictive confidence equals one-half exactly when the corresponding mean logit equals zero.The result applies to Gaussian-distributed network parameters.
  • Linear regions: ReLU networks become affine within linear regions, and sufficiently large scalings δx remain in one such region.This supplies the asymptotic structure used in the proofs.
  • All-layer approximation: The all-layer Gaussian approximation theorem bounds asymptotic predictive confidence away from one, with the limit controlled by the parameter covariance.The network has p ≥ n parameters, and the no-bias case admits a sufficiently large-scaling regime.
  • Asymptotic behavior: Positive-definite covariance makes the absolute logit magnitude non-decreasing with input scaling in the asymptotic linear region.The proof uses the covariance quadratic form and its derivative with respect to δ.
  • Last-layer approximation: The last-layer approximation theorem applies the same Gaussian-weight analysis to a fixed ReLU feature map followed by a Bayesian linear classifier.This formalizes the theoretical basis for last-layer Bayesian approximation.
  • Laplace approximations: For Laplace approximations, posterior covariance is determined by the prior precision and the likelihood Hessian, with eigenvalues increasing as the prior variance grows.The limiting eigenvalues are 1/λ_i(H) as σ0^2 grows without bound and zero as σ0^2 approaches zero.
  • Last-layer Laplace: LLLA applies Laplace inference only to the final-layer weights while fixing the preceding feature extractor, keeping Hessian inversion manageable for large models.The method uses the Hessian of the negative log-posterior at the MAP weights.

B.2. DLA

DLA infers a diagonal Gaussian covariance over every network layer and samples whole networks during prediction. This provides a full-network approximation but makes prediction substantially more expensive than last-layer Bayesian approximation.

  • DLA: DLA estimates each layer’s covariance diagonal using the Fisher information matrix rather than the exact diagonal Hessian.The method requires several backpropagation passes to compute gradients for all weight matrices.
  • DLA: The resulting posterior is a Gaussian centered at the MAP parameters with diagonal covariance, and predictions average samples from repeatedly drawn whole networks.Sampling and averaging are performed across all network layers.
  • DLA: Prediction cost scales with network size, making DLA orders of magnitude more expensive than LLLA.Unlike LLLA, DLA’s prediction cost grows with the network.
  • KFLA: KFLA likewise infers posteriors for all network parameters, using Kronecker factors of each layer’s Hessian.Its layerwise posterior uses factors obtained, for example, with KFAC.
  • KFLA: KFLA samples each layer’s weight matrix during prediction and is more expensive than DLA.Both methods use MC integration, with prediction cost scaling with network size.

C. Training Detail

The experiments train all Table 2 networks for 100 epochs with specified optimizers, learning-rate schedules, batch size, and standardization choices. Computation uses a graphics card with 11GB of memory.

  • C. Training Detail: All Table 2 networks are trained for 100 epochs with batch size 128.ADAM and SGD with 0.9 momentum are used.
  • C. Training Detail: Initial learning rates are 0.001 for MNIST and 0.1 for CIFAR-10, SVHN, and CIFAR1-00 experiments.The rates are divided by 10 at epochs 50, 75, and 95.
  • C. Training Detail: CIFAR-10 training uses random cropping and standardization as standard data augmentations.
  • C. Training Detail: All computations use a graphics card with 11GB memory.

D. Further Experiments

Further experiments test a simple isotropic last-layer Gaussian and compare uncertainty behavior across in-distribution, far-away OOD, and multiclass settings. Bayesian methods separate OOD confidence more clearly, although LLLA is less effective on MNIST.

  • D. Further Experiments: Far from training data, the isotropic Gaussian’s confidence is constant and less than one.Around training data, its predictions lack structure because the isotropic covariance does not capture training-data structure.
  • D. Further Experiments: LLLA produces clear separations between in-distribution and far-away OOD histograms, unlike MAP and temperature scaling.The MAP and temperature-scaling histograms are close together, leading to low AUR scores.
  • D. Further Experiments: In the multiclass experiment, LLLA mitigates asymptotic overconfidence but is less effective on MNIST.The paper suggests this may reflect the architecture and training procedure, or covariance eigenvalues that are too small.

D.4. Rotated MNIST

The rotated MNIST experiment evaluates whether Bayesian methods detect dataset shifts of increasing strength using Brier score. All Bayesian methods achieve lower Brier scores than MAP and temperature scaling.

  • D.4. Rotated MNIST: Rotated MNIST measures detection of increasingly strong dataset shifts using Brier score, where lower values are favorable.
  • D.4. Rotated MNIST: All Bayesian methods achieve lower Brier scores than MAP and temperature scaling on rotated MNIST.The authors interpret this as Bayesian methods being better at detecting dataset shift.

D.6. Bayesian Methods on Top of State-of-the-art OOD Detectors

Applying Bayesian methods after training ACET and outlier-exposure models generally improves OOD detection, especially for sufficiently distant inputs.

  • Bayesian post-hoc methods generally improve ACET and outlier-exposure models further, especially in the asymptotic regime.

D.7. Frequentist Calibration

The paper evaluates Bayesian predictive distributions using expected calibration error and compares them with temperature scaling. Across the reported experiments, Bayesian methods are competitive with this dedicated frequentist calibration method.

  • Expected calibration error (ECE) is used to assess whether Bayesian predictive distributions yield better calibration.
  • The calibration experiments use the same models and hyperparameters as the preceding out-of-distribution experiments.
  • All Bayesian methods are competitive with temperature scaling, which is specifically designed to improve frequentist calibration.
  • The calibration results are presented in Table 5 as expected calibration errors.
Loading 2002.10118v2…