A Method to Model Conditional Distributions with Normalizing Flows

Zhisheng Xiao, Qing Yan, Yali AmitarXiv 2019

Introduction

Modeling conditional distributions—predicting a target $x$ given an observation $y$—is a fundamental challenge in machine learning. Applications range from image colorization to solving complex inverse problems in physics. While Normalizing Flows (NFs) excel at modeling marginal data distributions, their extension to conditional tasks has historically been complex. Previous state-of-the-art Invertible Neural Networks (INNs) relied on a delicate "balancing act" of four distinct loss terms, including Maximum Mean Discrepancy (MMD). This multi-objective optimization required extensive manual hyperparameter tuning to prevent training instability, particularly in high-dimensional spaces.

Methodology

This paper introduces a more direct and stable training objective based on Maximum Likelihood Estimation (MLE). The authors simplify the problem by modeling the forward process (mapping data $x$ to observation $y$) as $y$ plus a small amount of Gaussian noise.

Single Loss Function

By assuming this additive noise, the authors derive a single log-likelihood objective for the conditional probability $p(x|y)$. This unified term integrates both the forward regression and the latent distribution into a mathematically grounded framework, eliminating the need for ad-hoc loss weighting.

Architecture

The model utilizes standard affine coupling layers. In the "Conditional Normalizing Flow" setup, the input data $x$ (padded with small noise $x_0$ for dimensionality matching) is mapped to a latent space partitioned into a "dummy" variable $z$ and the condition $c$.

  • $z$ (Stochasticity/Style): Captures the inherent variation or "style" in the data.
  • $c$ (Condition): Represents the label or observation.

Because the network is fully invertible, it serves a dual purpose: conditional generation (mapping $z$ and $c$ to $x$) and inference/classification (mapping $x$ to $c$).

Experimental Results

The method was evaluated on a synthetic toy task and two image datasets (MNIST and Fashion-MNIST).

Toy Gaussian Mixtures

The toy task involves a 2D dataset with 8 clusters arranged in a circle. The goal is to recover the cluster coordinates given a label, testing the model's ability to solve inverse problems.

Comparison of cluster modeling across different training configurations on the toy Gaussian mixture task.

As shown in the figure above, the model successfully learns to disentangle the clusters. The proposed MLE-based approach matched the performance of the complex 4-loss INN method while requiring significantly less tuning and only a single loss function.

Final learned distribution of the 8 clusters using the proposed single-loss conditional normalizing flow.

Image Datasets

For MNIST and Fashion-MNIST, the authors employed a "latent flow" approach, training on the low-dimensional latent space of a pre-trained auto-encoder.

  • Classification Accuracy: When used as an inference network, the model achieved 98.4% accuracy on MNIST and 90.1% on Fashion-MNIST.
  • Qualitative Diversity: The model produced sharp, diverse images. By holding the style variable $z$ constant and varying the label $c$, the model demonstrated successful disentanglement of content and style.

Conclusion

By moving from implicit to explicit posterior maximization, the proposed method simplifies the training of conditional normalizing flows. The shift from four losses to one removes the need for manual hyperparameter tuning, resulting in a more robust and easier-to-train model. While preliminary, these results suggest that MLE-based conditional flows are a powerful tool for inverse problems and conditional generation, offering high performance with reduced computational overhead.

Summary updated

BibTeX
@misc{xiao2019method,
  author = {Zhisheng Xiao and Qing Yan and Yali Amit},
  title = {{A Method to Model Conditional Distributions with Normalizing Flows}},
  year = {2019},
  eprint = {1911.02052},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1911.02052},
}
Figure