Skip to main content
QUICK REVIEW

[Paper Review] InFlow: Robust outlier detection utilizing Normalizing Flows

Nishant Kumar, Pia Hanfeld|arXiv (Cornell University)|Jun 10, 2021
Adversarial Robustness in Machine LearningComputer Science41 references5 citations
TL;DR

This paper proposes InFlow, a normalizing flow enhanced with an attention mechanism to improve robust outlier detection without requiring outlier data during training. By leveraging attention to capture high-level semantic features, InFlow achieves state-of-the-art performance in OOD detection by assigning significantly lower likelihoods to out-of-distribution samples than in-distribution data, resolving the overconfidence problem of standard normalizing flows.

ABSTRACT

Normalizing flows are prominent deep generative models that provide tractable probability distributions and efficient density estimation. However, they are well known to fail while detecting Out-of-Distribution (OOD) inputs as they directly encode the local features of the input representations in their latent space. In this paper, we solve this overconfidence issue of normalizing flows by demonstrating that flows, if extended by an attention mechanism, can reliably detect outliers including adversarial attacks. Our approach does not require outlier data for training and we showcase the efficiency of our method for OOD detection by reporting state-of-the-art performance in diverse experimental settings. Code available at https://github.com/ComputationalRadiationPhysics/InFlow .

Motivation & Objective

  • To address the overconfidence issue in normalizing flows, where OOD samples are assigned higher likelihoods than in-distribution samples.
  • To develop a reliable, unsupervised OOD detection method that does not require labeled outlier data during training.
  • To demonstrate that extending existing normalizing flows with attention mechanisms improves semantic feature representation and separation of in-distribution from OOD data.
  • To validate that architectural variations in the flow model do not compromise OOD detection performance, suggesting attention is the key factor for robustness.

Proposed method

  • Integrates an attention mechanism into the coupling blocks of a normalizing flow to improve modeling of high-level semantic features rather than just local pixel correlations.
  • Uses invertible, bijective transformations $ f: \mathcal{X} \to \mathcal{Z} $ with learnable parameters $ \theta $, applying the change of variables formula to compute tractable log-likelihoods.
  • Applies a multivariate Gaussian prior on the latent space $ z $, enabling likelihood-based OOD detection via thresholding on $ \log p_\theta(x) $.
  • Employs non-shared weights for the $ s $ and $ t $ sub-networks in coupling blocks to increase representational capacity and avoid mode collapse.
  • Visualizes activations, coupling block outputs, and latent space representations to analyze feature learning dynamics across in-distribution and OOD samples.
  • Evaluates performance using AUCROC at significance level $ \alpha = 0.05 $, comparing log-likelihood distributions across multiple OOD datasets.

Experimental results

Research questions

  • RQ1Can attention mechanisms in normalizing flows improve the separation of in-distribution and out-of-distribution samples?
  • RQ2Why do standard normalizing flows fail at OOD detection despite having tractable likelihoods?
  • RQ3Does the inclusion of attention in normalizing flows reduce overconfidence in OOD predictions without requiring outlier data for training?
  • RQ4How does the architectural design of the flow (e.g., number of coupling blocks, weight sharing) affect OOD detection performance?
  • RQ5Can attention-based normalizing flows generalize across diverse OOD datasets including MNIST, SVHN, CIFAR10, and Tiny ImageNet?

Key findings

  • InFlow achieves state-of-the-art AUCROC performance across all evaluated OOD datasets, with AUCROC values of 1.0 for MNIST, FashionMNIST, SVHN, CIFAR10, Tiny ImageNet, Noise, and Constant datasets when trained on CelebA.
  • The model assigns significantly lower log-likelihoods to all OOD datasets compared to in-distribution CelebA samples, even at $ \alpha = 0.05 $, demonstrating robust OOD detection.
  • Visualizations confirm that InFlow preserves semantic structure in the latent space for in-distribution data while transforming OOD inputs into less structured, lower-likelihood representations.
  • The attention mechanism enables the model to learn high-level semantics rather than relying on local pixel-level statistics, which explains its improved generalization.
  • Changing architectural hyperparameters such as number of coupling blocks ($ K=2 $ vs $ K=4 $) and weight sharing (shared vs non-shared) does not degrade OOD detection performance, indicating the robustness of the attention mechanism.
  • The results suggest that future efforts in OOD detection should focus on enhancing existing normalizing flows with attention mechanisms rather than redesigning the flow architecture.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.