Source-linked AI summary

Posterior Network: Uncertainty Estimation without OOD Samples via Density-Based Pseudo-Counts

Bertrand Charpentier, Daniel Zügner, Stephan Günnemann

arXiv:2006.09239v2cs.LGstat.ML

TL;DR

Existing uncertainty methods either require costly inference-time sampling or depend on arbitrary prior targets and OOD samples during training. PostNet instead combines latent-space density estimation with Bayesian uncertainty-aware training to produce input-specific posterior distributions. It achieves state-of-the-art uncertainty estimation, including strong in- and out-of-distribution detection and improved calibration.

  • Problem

    Uncertainty estimation must distinguish aleatoric from epistemic uncertainty, while existing approaches incur costly sampling or require arbitrary prior targets and OOD training samples.

  • Method

    PostNet uses an encoder, class-conditional normalizing-flow densities in a low-dimensional latent space, and a Bayesian uncertainty-aware loss to produce input-specific Dirichlet posteriors.

  • Results

    PostNet achieves state-of-the-art performance with strong improvement in detecting in- and out-of-distribution samples, while improving calibration without costly sampling.

  • Takeaways & Limitations

    PostNet provides uncertainty-aware classification without OOD training data or costly test-time sampling, while retaining competitive accuracy and confidence scores.

  • Takeaways & Limitations

    Prior Networks can assign arbitrarily high epistemic certainty to unseen OOD data and may predict degenerate concentration parameters.

Abstract

from arXiv · show

Accurate estimation of aleatoric and epistemic uncertainty is crucial to build safe and reliable systems. Traditional approaches, such as dropout and ensemble methods, estimate uncertainty by sampling probability predictions from different submodels, which leads to slow uncertainty estimation at inference time. Recent works address this drawback by directly predicting parameters of prior distributions over the probability predictions with a neural network. While this approach has demonstrated accurate uncertainty estimation, it requires defining arbitrary target parameters for in-distribution data and makes the unrealistic assumption that out-of-distribution (OOD) data is known at training time. In this work we propose the Posterior Network (PostNet), which uses Normalizing Flows to predict an individual closed-form posterior distribution over predicted probabilites for any input sample. The posterior distributions learned by PostNet accurately reflect uncertainty for in- and out-of-distribution data -- without requiring access to OOD data at training time. PostNet achieves state-of-the art results in OOD detection and in uncertainty calibration under dataset shifts.

1 Introduction

Reliable AI systems need uncertainty estimates that distinguish data uncertainty from knowledge uncertainty, but common methods are costly at inference and newer prior-based methods rely on arbitrary targets and OOD training data. PostNet addresses these constraints by learning uncertainty from latent-space densities without OOD samples.

  • Reliable systems require uncertainty estimates that distinguish aleatoric uncertainty from epistemic uncertainty, especially in sensitive applications.Aleatoric uncertainty is associated with the data, whereas epistemic uncertainty concerns the categorical probability prediction.
  • Ensembles and dropout estimate uncertainty from implicit prediction distributions but require costly sampling during inference.These approaches aggregate predictions from collections of sub-models to estimate statistics such as class-probability means and variances.
  • Prior-distribution models avoid inference-time sampling but require arbitrary target prior distributions and OOD samples during training.The use of OOD data during training is described as unrealistic for most applications.
  • Without explicit OOD training data, prior-based models can become increasingly confident on samples far from observed data.For MNIST, the paper contrasts this behavior with PostNet’s high epistemic uncertainty on OOD samples and its differentiated uncertainty near same- versus different-class data.
  • PostNet uses normalizing flows to learn class-conditional latent-space densities and parameterize an individual Dirichlet distribution for each input.It avoids OOD training samples, arbitrary target priors, and costly sampling for uncertainty estimation at test time.

2 Posterior Network

Posterior Network models an input-dependent posterior over categorical predictions by combining latent-space class densities with Bayesian pseudo-counts. This yields uncertainty estimates that become confident on likely in-distribution inputs and uncertain on unfamiliar inputs without requiring OOD training data.

  • Bayesian uncertainty: PostNet separates aleatoric uncertainty in the class label from epistemic uncertainty in the predicted categorical distribution.It models the epistemic distribution q(i) over probability vectors and derives the aleatoric distribution from its mean.
  • Bayesian uncertainty: Unlike ensembles and dropout, PostNet computes the epistemic distribution, aleatoric distribution, and class prediction in one pass.Ensembles and dropout estimate prediction statistics through sampling, while PostNet explicitly parameterizes the distribution.
  • Limitations of prior approaches: Prior Networks require OOD training samples and arbitrary target priors, while PostNet avoids both requirements.The prior approach also cannot characterize the infinitely large OOD distribution with an explicit dataset.
  • Posterior construction: PostNet forms input-specific posterior Dirichlet parameters from a fixed prior and learned pseudo-counts, extending Bayesian updating to classification.The learned pseudo-counts are generated from class-conditional latent densities and training class counts.
  • Posterior construction: Its encoder maps inputs to low-dimensional latent vectors, where normalizing flows learn normalized class-conditional densities used to parameterize each Dirichlet posterior.The model can use density estimators such as mixtures of Gaussians, radial flows, or IAFs.
  • Uncertainty behavior: For likely in-distribution inputs, predictions approach the true categorical distribution and epistemic uncertainty vanishes; for OOD inputs, predictions approach a flat prior.Increasing the training-set size likewise drives the mean prediction toward the class posterior, whereas no observations recover the flat prior.
  • Uncertainty behavior: Normalizing-flow density constraints make latent regions with many training examples high-density and force low density elsewhere, enabling OOD uncertainty from in-distribution data alone.The density integral is tied to the number of training examples per class, creating a finite certainty budget.
  • Uncertainty behavior: The overview distinguishes low overall uncertainty for unambiguous inputs, high aleatoric uncertainty for ambiguous in-distribution inputs, and high epistemic uncertainty for OOD inputs.Inputs are encoded into latent coordinates, evaluated by class densities, and assigned corresponding Dirichlet distributions.

3 Uncertainty-Aware Loss Computation

PostNet learns a distribution over categorical predictions by combining an expected cross-entropy term with entropy regularization, jointly optimizing network and flow parameters. Closed-form evaluation makes the resulting uncertainty estimation efficient and exact.

  • PostNet learns q(i) to approximate the posterior distribution of categorical predictions given each input and the training data.
  • The optimization objective combines expected cross-entropy under q(i) with a negative entropy term that favors smooth distributions.
  • Joint optimization over neural-network parameters θ and flow parameters φ enables uncertainty-aware Dirichlet predictions for unseen data points.
  • With Dirichlet distributions, the loss is equivalent to an ELBO under a uniform Dirichlet prior, whereas the more general Bayesian loss need not be an ELBO.
  • Using Dirac distributions instead yields traditional cross-entropy, which makes a point estimate and cannot learn a distribution with non-zero variance.
  • Closed-form expressions for uncertain cross-entropy and entropy avoid sampling and provide efficient, exact computation; the entropy weight was set to 10^-5 in experiments.

4 Experimental Evaluation

The evaluation compares PostNet with prior networks, ensembles, dropout, and ablations across calibration, confidence, and OOD-detection settings. PostNet generally preserves accuracy while improving calibration and OOD detection, including under dataset shifts and without explicit OOD training data.

  • Evaluation setup: The experiments evaluate confidence coherence, uncertainty calibration, and OOD detection across tabular, image, synthetic, left-out-class, out-of-domain, and corrupted-data settings.Datasets include Segment, Sensorless Drive, MNIST, CIFAR10, and a synthetic three-Gaussian dataset.
  • Metrics: AUC-PR measures confidence calibration and OOD detection, while Brier score measures uncertainty calibration; higher AUC-PR is better and lower Brier score is better.Epistemic uncertainty for ensembles and dropout uses inverse empirical variance estimated from 10 samples.
  • Main results: PostNet performs on par for accuracy and confidence scores, improves calibration among Dirichlet models, and exceeds other models by more than +30% absolute improvement in OOD detection on Sensorless Drive.Radial-flow and IAF variants both perform strongly, while the radial-flow comparison adds only 80 parameters per class.
  • Ablations: Removing normalizing flows causes a significant OOD-detection drop, removing the Bayesian loss lowers performance, and joint training generally outperforms sequential training.Batch normalization improves stability, and overly high latent dimensionality decreases performance; flow-based density estimation generally scores better.
  • OOD and dataset shifts: Without true OOD data during training, Prior Networks struggle, whereas PostNet distinguishes CIFAR10, SVHN, and out-of-domain SVHN using low, high, and near-maximum entropy respectively.For stronger CIFAR10 corruptions, PostNet shows the largest confidence decrease while maintaining high accuracy.

5 Conclusion

Posterior Network estimates classification uncertainty without OOD training samples or costly test-time sampling, and reports strong in- and out-of-distribution detection performance.

  • PostNet estimates classification uncertainty without requiring OOD samples during training or costly sampling at inference.
  • The model combines an encoder, a latent-space normalizing flow, and a Bayesian loss for uncertainty-aware training.
  • PostNet achieves state-of-the-art performance with strong improvement in detecting in- and out-of-distribution samples.

Broader Impact

Uncertainty-aware models are presented as a way to reduce risks from autonomous predictions in anomalous or unfamiliar situations.

  • Traditional classifiers can behave unexpectedly in new anomalous situations while remaining unaware of prediction risk.
  • Uncertainty-aware models attach a confidence score to predictions to help mitigate risks from autonomous decisions.
  • Such predictions may be particularly beneficial in domains with potent risks.

A.1 Dirichlet distribution

This section introduces the Dirichlet distribution and the closed-form Bayesian loss components used for uncertainty-aware training.

  • A.1 Dirichlet distribution: The Dirichlet distribution is parameterized by concentration parameters α = (α_1, ..., α_C), with each α_c > 0.
  • A.1 Dirichlet distribution: The Dirichlet probability density function uses the gamma function Γ.
  • A.1 Dirichlet distribution: The Bayesian loss for sample x^(i) can be computed in closed form.
  • A.1 Dirichlet distribution: The loss uses q from the Dirichlet family Dir(α^(i)) and includes the UCE loss for the observed class.
  • A.1 Dirichlet distribution: Its second term is the entropy of a Dirichlet distribution, expressed using the beta function B.

A.3 Epistemic covariance for in-distribution samples in PostNet.

PostNet models epistemic uncertainty with a Dirichlet distribution whose concentration parameters depend on latent-space density, with in-distribution behavior described by increasing density.

  • PostNet’s epistemic distribution is Dir(α^(i)) with concentration parameters defined from the model’s latent representation.
  • The variance of the class probabilities is derived from the Dirichlet distribution’s concentration parameters.
  • For in-distribution data, latent density tends toward infinity in the stated limit.

B Model details

The experiments use shared neural architectures across vector and image datasets, with model-specific settings for dropout, ensembles, and PostNet. PostNet’s default configuration uses a compact radial-flow latent model, while reported metrics are rescaled to [0, 100].

  • Architectures: Vector models use three linear ReLU layers, while image models add LeakyReLU convolutional layers with max-pooling or use VGG16 with batch normalization.The vector grid search found no significant changes across 32, 64, and 128 hidden units, so 64 units were selected.
  • Training: Training uses early stopping, checking loss improvement every 2 epochs with patience equal to 10, and all models are trained on GPUs.The experiments used a 1TB SSD.
  • PostNet configuration: PostNet uses batch normalization after the encoder and defaults to radial flow of length 6 with latent dimension 6, requiring only 80 parameters.IAF comparisons use two layers of size 256; latent dimensions no larger than the number of classes were generally sufficient.
  • Evaluation: All reported metrics are multiplied by 100, producing scores in [0, 100] instead of [0, 1].

C Datasets details

The evaluation spans five datasets covering toy, vector, handwritten-digit, clothing, and natural-image settings. OOD detection uses held-out classes or separate datasets, while CIFAR10 dataset-shift experiments use its classic split to avoid leakage.

  • Evaluation protocol: The experiments use five random data splits, each dividing data into 60% training, 20% validation, and 20% test sets.The splits avoid restricting evaluation to classic MNIST and CIFAR10 partitions.
  • Toy dataset: The toy dataset contains 1,500 samples from three 2D isotropic Gaussian classes with variance 0.2.The three means are [0, 2.], [−1.73205081, −1.] and [1.73205081, −1.].
  • Vector datasets: Segment classifies 18-attribute image regions into seven classes, with sky removed from training and used as OOD data.The dataset contains 2,310 samples.
  • Vector datasets: Sensorless Drive classifies 49-attribute motor measurements into 11 classes, with classes 10 and 11 held out for OOD detection.The dataset contains 58,509 samples.
  • Image datasets: MNIST contains 70,000 1 × 28 × 28 digit images, with KMNIST and FashionMNIST used for OOD detection.
  • Image datasets: CIFAR10 contains 60,000 3 × 32 × 32 object images, with SVHN used for OOD detection and the classic split used for dataset-shift experiments.The classic split avoids data leakage with corrupted test images.

D Additional Experimental Results

Additional experiments show that PostNet remains competitive across datasets, density choices, architectures, and uncertainty visualizations. It is especially effective at avoiding overconfidence on OOD regions while preserving calibrated uncertainty transitions on interpolated inputs.

  • Cross-dataset results: PostNet is competitive across Segment, Sensorless Drive, MNIST, and CIFAR10, improving calibration among Dirichlet models and OOD detection among all models.MNIST uncertainty measures produced highly correlated results.
  • Architectures and data scale: PostNet adapts well to AlexNet, VGG, and ResNet convolutional architectures, while larger training sets improve accuracy for all models.
  • Density and latent dimension: PostNet works with mixture-of-Gaussians, radial-flow, and IAF densities, although mixture-of-Gaussians is more unstable and slightly lower-performing.No clear winner was observed between radial flow and IAF, while overly high latent dimensions reduce performance.
  • Toy visualization: On the three-Gaussians toy dataset, PostNet is the only compared model that is not overconfident in OOD regions and best fits the true in-distribution data.The other models show overconfident predictions for OOD regions and fail on this simple dataset.
  • Entropy visualization: PostNet distinguishes ID, OOD, and OODom data through entropy histograms on both MNIST and CIFAR10.For MNIST, maximal categorical entropy with 10 classes is 2.3026.
  • Interpolation visualization: During MNIST interpolation, PostNet predicts clean digits correctly, gives mixed images more balanced class predictions, and assigns higher epistemic uncertainty to improper digits.The concentration-parameter visualization attributes this higher epistemic uncertainty to low αc values.
  • Latent-dimension analysis: Across Segment, Sensorless Drive, MNIST, and CIFAR10, performance remains high at small or medium latent dimensions but drops at dimension 32.The corresponding evaluations use the density and OOD settings described in the dataset-specific tables and figures.
Loading 2006.09239v2…