[Paper Review] Do Deep Generative Models Know What They Don't Know?
The paper shows that state-of-the-art deep generative models (including flow-based, VAE, and PixelCNN) assign higher likelihood to out-of-distribution data (e.g., SVHN when trained on CIFAR-10), challenging the use of density as an out-of-distribution detector. It analyzes causes in flow models and cautions against relying on density estimates for anomaly detection without further understanding.
A neural network deployed in the wild may be asked to make predictions for inputs that were drawn from a different distribution than that of the training data. A plethora of work has demonstrated that it is easy to find or synthesize inputs for which a neural network is highly confident yet wrong. Generative models are widely viewed to be robust to such mistaken confidence as modeling the density of the input features can be used to detect novel, out-of-distribution inputs. In this paper we challenge this assumption. We find that the density learned by flow-based models, VAEs, and PixelCNNs cannot distinguish images of common objects such as dogs, trucks, and horses (i.e. CIFAR-10) from those of house numbers (i.e. SVHN), assigning a higher likelihood to the latter when the model is trained on the former. Moreover, we find evidence of this phenomenon when pairing several popular image data sets: FashionMNIST vs MNIST, CelebA vs SVHN, ImageNet vs CIFAR-10 / CIFAR-100 / SVHN. To investigate this curious behavior, we focus analysis on flow-based generative models in particular since they are trained and evaluated via the exact marginal likelihood. We find such behavior persists even when we restrict the flows to constant-volume transformations. These transformations admit some theoretical analysis, and we show that the difference in likelihoods can be explained by the location and variances of the data and the model curvature. Our results caution against using the density estimates from deep generative models to identify inputs similar to the training distribution until their behavior for out-of-distribution inputs is better understood.
Motivation & Objective
- Assess whether deep generative models calibrated by density can detect inputs from different distributions than training data.
- Examine why flow-based models sometimes assign higher density to out-of-distribution images.
- Analyze contributions to likelihood to identify the source of the phenomenon.
- Evaluate the role of volume elements and constant-volume flows in likelihood behavior.
Proposed method
- Train Glow (flow-based) models on FashionMNIST vs MNIST and CIFAR-10 vs SVHN (and CelebA, ImageNet comparisons).
- Compute and compare log-likelihoods (bits per dimension) on in-distribution, and out-of-distribution test sets.
- Decompose the change-of-variables likelihood into log p(z) and log|det df/dx| to identify contributing terms.
- Investigate constant-volume (CV) and non-volume-preserving (NVP) transforms to control volume effects.
- Explore second-order analysis to relate likelihood gaps to data covariance and model curvature.
- Test ensembles to assess robustness of the phenomenon.
Experimental results
Research questions
- RQ1Can modern deep generative models assign higher density to out-of-distribution data compared with training data?
- RQ2What components of the likelihood (latent density vs volume change) drive any observed out-of-distribution advantage in density?
- RQ3Do constant-volume flow transformations eliminate or reduce the out-of-distribution likelihood paradox?
- RQ4How do data variance and model curvature interact to produce higher likelihoods for out-of-distribution sets?
- RQ5Can ensembles or graying of images affect the likelihood gap between in-distribution and out-of-distribution data?
Key findings
- Flow-based, VAE, and PixelCNN models can assign higher likelihood to out-of-distribution data (e.g., SVHN) than to training data (e.g., CIFAR-10).
- For flow models, the out-of-distribution effect largely arises from the volume term rather than the latent p(z) term.
- Constant-volume flows do not remove the phenomenon; SVHN can still have higher likelihood than CIFAR-10.
- Second-order analysis predicts higher likelihood for SVHN due to data covariance and model curvature differences.
- Graying images (reducing variance) increases likelihood for CIFAR-10 and SVHN, consistent with the curvature-based explanation.
- Ensembling does not substantially remove the likelihood gap between in-distribution and out-of-distribution data.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.