Approximations to the Fisher Information Metric of Deep Generative Models for Out-Of-Distribution Detection
Sam Dauncey, Chris Holmes, Christopher Williams, Fabian Falck
TL;DR
This work addresses the failure of likelihood-based deep generative models to distinguish OOD data by exploiting the gradient of the log-likelihood with respect to model parameters, formalized via the Fisher Information Metric (FIM). It shows that the FIM is diagonally dominant in layer blocks, motivating a practical, layer-wise set of gradient features whose log-norms approximate chi-square behavior; these are combined into a model-agnostic, hyperparameter-free OOD detector that is representation-invariant under invertible transformations. Empirically, the method yields stronger OOD discrimination than the Typicality test on Glow models across multiple image datasets and achieves competitive results for diffusion models, while exhibiting a clear invariance property and scalability across layers. The approach offers a principled, gradient-based alternative for unsupervised OOD detection with broad applicability to differentiable likelihood-based models.
Abstract
Likelihood-based deep generative models such as score-based diffusion models and variational autoencoders are state-of-the-art machine learning models approximating high-dimensional distributions of data such as images, text, or audio. One of many downstream tasks they can be naturally applied to is out-of-distribution (OOD) detection. However, seminal work by Nalisnick et al. which we reproduce showed that deep generative models consistently infer higher log-likelihoods for OOD data than data they were trained on, marking an open problem. In this work, we analyse using the gradient of a data point with respect to the parameters of the deep generative model for OOD detection, based on the simple intuition that OOD data should have larger gradient norms than training data. We formalise measuring the size of the gradient as approximating the Fisher information metric. We show that the Fisher information matrix (FIM) has large absolute diagonal values, motivating the use of chi-square distributed, layer-wise gradient norms as features. We combine these features to make a simple, model-agnostic and hyperparameter-free method for OOD detection which estimates the joint density of the layer-wise gradient norms for a given data point. We find that these layer-wise gradient norms are weakly correlated, rendering their combined usage informative, and prove that the layer-wise gradient norms satisfy the principle of (data representation) invariance. Our empirical results indicate that this method outperforms the Typicality test for most deep generative models and image dataset pairings.
