Topology of Out-of-Distribution Examples in Deep Neural Networks
Esha Datta, Johanna Hennig, Eva Domschot, Connor Mattes, Michael R. Smith
TL;DR
This work investigates how deep neural networks handle out-of-distribution (OOD) inputs from a topological perspective by applying persistent homology to latent-layer embeddings. It shows that well-trained networks topologically simplify in-distribution data, evidenced by short $H_0$ lifetimes, whereas OOD inputs retain longer $H_0$ lifetimes, providing a detectable signal for OOD detection across datasets like MNIST and CIFAR with ResNet18. The approach leverages Vietoris-Rips complexes, bootstrap inference, and PH summaries on penultimate-layer embeddings (dimension $512$) to reveal robust differences between ID and OOD topologies in realistic models. These findings offer a scalable, topology-based signal for uncertainty and open avenues for refining PH-based OOD detection across architectures and topological summaries.
Abstract
As deep neural networks (DNNs) become increasingly common, concerns about their robustness do as well. A longstanding problem for deployed DNNs is their behavior in the face of unfamiliar inputs; specifically, these models tend to be overconfident and incorrect when encountering out-of-distribution (OOD) examples. In this work, we present a topological approach to characterizing OOD examples using latent layer embeddings from DNNs. Our goal is to identify topological features, referred to as landmarks, that indicate OOD examples. We conduct extensive experiments on benchmark datasets and a realistic DNN model, revealing a key insight for OOD detection. Well-trained DNNs have been shown to induce a topological simplification on training data for simple models and datasets; we show that this property holds for realistic, large-scale test and training data, but does not hold for OOD examples. More specifically, we find that the average lifetime (or persistence) of OOD examples is statistically longer than that of training or test examples. This indicates that DNNs struggle to induce topological simplification on unfamiliar inputs. Our empirical results provide novel evidence of topological simplification in realistic DNNs and lay the groundwork for topologically-informed OOD detection strategies.
