TzK: Flow-Based Conditional Generative Model

Micha Livne, David J. FleetarXiv 2019

Abstract

We formulate a new class of conditional generative models based on probability flows. Trained with maximum likelihood, it provides efficient inference and sampling from class-conditionals or the joint distribution, and does not require a priori knowledge of the number of classes or the relationships between classes. This allows one to train generative models from multiple, heterogeneous datasets, while retaining strong prior models over subsets of the data (e.g., from a single dataset, class label, or attribute). In this paper, in addition to end-to-end learning, we show how one can learn a single model from multiple datasets with a relatively weak Glow architecture, and then extend it by conditioning on different knowledge types (e.g., a single dataset). This yields log likelihood comparable to state-of-the-art, compelling samples from conditional priors.

Introduction

Generative modeling has seen massive leaps with Variational Auto-encoders (VAEs) and Generative Adversarial Networks (GANs), but both have inherent limitations. VAEs often rely on approximations that make exact probability density estimation difficult, while GANs lack a straightforward way to perform inference—mapping data back to a latent space. Normalizing flows, such as the Glow model, addressed these issues by using invertible transformations to provide exact likelihoods. However, most flow-based models are monolithic; they are trained on fixed datasets and struggle to incorporate new classes or attributes post-training without redesigning the architecture and retraining from scratch.

The TzK framework addresses this by introducing a compositional flow-based model. It allows for learning from heterogeneous data and specializing to new domains without disrupting the original joint distribution, effectively making generative models modular.

Methods: Dual Factorization and Compositionality

The core innovation of TzK is its dual encoder-decoder factorization. Rather than a single path, the model defines two perspectives on the joint distribution of data ($t$) and latent codes ($k$):

  1. The Encoder ($p^{enc}$): Focuses on inferring the latent code given the data.
  2. The Decoder ($p^{dec}$): Focuses on generating data given a latent code.
Graphical representation of the TzK encoder and decoder architectures.

The model is trained by optimizing a lower bound of the log-likelihood that forces the encoder and decoder to agree on the probability density of every data point. The architecture consists of a shared t-flow (based on Glow) that transforms raw pixels into a latent space ($z$), and specialized z-flows that condition this latent space based on specific knowledge types (e.g., dataset origin or labels). By assuming independence between different knowledge types in the latent space, TzK becomes compositional; new "z-flows" can be added for new attributes without retraining the primary "t-flow."

Experiments and Results

TzK was evaluated on a large-scale "multi-data" set comprising nearly 1.9 million images from six benchmarks: CIFAR-10, MNIST, Omniglot, SVHN, ImageNet, and CelebA.

Performance and Sample Quality

TzK achieved a Negative Log-Likelihood (NLL) of 2.99 on CIFAR-10, outperforming baseline Glow (3.35) and other flow-based methods like RealNVP. The model produces high-quality, diverse samples across these heterogeneous domains.

Representative samples generated by the TzK model trained on natural image datasets.

Key Insights

  • Transferability: A "t-flow" trained solely on natural images (CIFAR-10) provided a latent representation robust enough to isolate the MNIST manifold using only a simple conditional "z-flow," despite never seeing grayscale digits during primary training.
  • Efficiency: Researchers can "freeze" a pre-trained unsupervised flow and train conditional models on top in roughly half the usual training time while maintaining sample quality.
  • Diversity Benefits: Training on heterogeneous data improved latent space interpolations for specific subsets, suggesting that exposure to diverse data helps the model build a more continuous and dense manifold.

Conclusion

TzK demonstrates that flow-based models can be both modular and highly performant. While the independence assumption between knowledge types simplifies the architecture, it may struggle with highly correlated attributes. Future work will explore complex interactions between knowledge types and further optimize z-flow architectures for faster online learning. Despite these challenges, TzK provides a scalable path toward generative models that can grow and adapt as new data and knowledge become available.

Summary updated

BibTeX
@misc{livne2019tzk,
  author = {Micha Livne and David J. Fleet},
  title = {{TzK: Flow-Based Conditional Generative Model}},
  year = {2019},
  eprint = {1902.01893},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1902.01893},
}
Figure