Abstract
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.
Introduction
Standard neural networks are notoriously overconfident. Even when presented with an image of something they’ve never seen before, they often assign a high-probability "guess" to one of the known classes. To build reliable systems, we must distinguish between Aleatoric Uncertainty (inherent noise in data) and Epistemic Uncertainty (lack of knowledge about the data).
Existing solutions like Ensembles or Monte Carlo Dropout are computationally expensive at inference time. Prior Networks are faster but typically require exposure to out-of-distribution (OOD) samples during training—an unrealistic requirement given the infinite nature of the "unknown." Posterior Network (PostNet) addresses these issues by learning to "know what it doesn't know" using density estimation in a latent space.
The PostNet Architecture
PostNet utilizes a three-part pipeline to estimate uncertainty in a single forward pass:
- Encoder: A neural network (e.g., a CNN) maps the input $x$ to a low-dimensional latent space.
- Normalizing Flows (NF): The model learns a probability density function for each class within this latent space. Normalizing Flows provide the flexibility to model complex distributions while remaining mathematically tractable.
- Dirichlet Posterior: The density values from the NF are treated as "pseudo-counts" (evidence) for each class. These counts parameterize a Dirichlet distribution—a distribution over class probability distributions.
Density as Evidence
The core innovation of PostNet is linking density estimation to Bayesian evidence. If an input is mapped to a region in the latent space where training data density is high, the model has high "counts" of evidence and low epistemic uncertainty. Conversely, if the input lands in a "ghost town" where no training data was observed, the density is near zero. In these regions, the pseudo-counts vanish, and the Dirichlet distribution reverts to a flat, high-entropy state, signaling high epistemic uncertainty.
To train this without OOD data, the authors introduce a Bayesian loss function (Uncertain Cross Entropy) combined with an entropy regularizer. This encourages the model to be certain only in regions where it has observed data.
Experimental Results
The authors evaluated PostNet across tabular (UCI) and image (MNIST, CIFAR-10) datasets, testing for OOD detection and robustness to dataset shifts (e.g., image corruption).
- OOD Detection: On the Sensorless Drive dataset, PostNet improved OOD detection (AUC-PR) by over 30% compared to previous Dirichlet-based models.
- Robustness to Shift: In CIFAR-10 corruption tests, PostNet showed graceful degradation; as corruption increased, confidence dropped significantly, unlike overconfident baselines.
- Inference Speed: Requiring only one forward pass, PostNet is significantly faster than Ensembles or Dropout-based methods.
- Sanity Checks: PostNet was the only model to consistently assign 100% uncertainty to unscaled "OODom" data (e.g., raw pixel values), a test where other models often failed.
Conclusion and Future Work
PostNet represents a significant step toward "plug-and-play" uncertainty estimation. By performing density estimation in a low-dimensional latent space, it avoids the curse of dimensionality while capturing semantic features. However, the model's performance is sensitive to the choice of latent dimensionality and the quality of the encoder. Future work may explore more robust ways to ensure class separation in the latent space to further enhance the reliability of the Normalizing Flow density estimates.
Summary updated