Semi-Conditional Normalizing Flows for Semi-Supervised Learning

Andrei Atanov, Alexandra Volokhova, Arsenii Ashukha, Ivan Sosnovik, Dmitry P. VetrovarXiv 2019

Abstract

This paper proposes a semi-conditional normalizing flow model for semi-supervised learning. The model uses both labelled and unlabeled data to learn an explicit model of joint distribution over objects and labels. Semi-conditional architecture of the model allows us to efficiently compute a value and gradients of the marginal likelihood for unlabeled objects. The conditional part of the model is based on a proposed conditional coupling layer. We demonstrate performance of the model for semi-supervised classification problem on different datasets. The model outperforms the baseline approach based on variational auto-encoders on MNIST dataset.

Introduction

Semi-supervised learning (SSL) leverages small amounts of labeled data alongside large unlabeled datasets to build robust classifiers. Deep generative models are particularly suited for this task as they can capture the underlying structure of the data. However, standard generative models face trade-offs: Variational Autoencoders (VAEs) rely on approximate likelihoods (the Evidence Lower Bound, or ELBO), while standard Normalizing Flows (NFs), which offer exact likelihoods, are often computationally expensive in SSL settings.

To calculate the marginal likelihood $p(x) = \sum_y p(x, y)$ for unlabeled data, a standard flow would need to be evaluated once for every possible class $K$. For high-dimensional data and many classes, this becomes computationally prohibitive. This paper introduces Semi-Conditional Normalizing Flows (SCNF), an architecture designed to make exact likelihood training efficient for SSL.

The SCNF Architecture

The core innovation of SCNF is the separation of the flow into two distinct stages: a large unconditional part and a small class-conditional bottleneck.

The SCNF architecture separates the flow into a large unconditional part ($f_w$) and a small class-conditional part ($h_\phi$).
  1. Unconditional Flow ($f_w$): This is a computationally intensive component (based on the Glow architecture) that maps the input $x$ to a latent representation. It uses a multi-scale approach to partition the latent space into "semantic" components ($z_f$) and "auxiliary" components ($z_{aux}$).
  2. Conditional Flow ($h_\phi$): This is a lightweight flow that operates only on the semantic $z_f$ components, mapping them to a final latent $z_h$ conditioned on the class label $y$.

The Efficiency Trick: Because the expensive $f_w$ is independent of the label, its Jacobian determinant is calculated only once per image. During marginalization over classes, only the small conditional part $h_\phi$ needs to be repeated, drastically reducing the computational overhead.

Experimental Evaluation

The model was evaluated on the MNIST dataset using the standard SSL protocol of 100 labeled examples out of 60,000. SCNF-GLOW achieved a 1.9% test error, significantly outperforming the VAE-based M2 baseline, which recorded a 3.3% error.

A critical finding was the importance of dimension reduction. For MNIST (784 pixels), the best results were obtained by passing only the deepest 196 components to the conditional flow. Attempting to pass too many components led to overfitting, highlighting the necessity of the "bottleneck" design.

Qualitative Analysis and Data Obfuscation

A unique property of the SCNF architecture is the disentanglement of class information from the latent representation. The final latent $z_h$ is designed to follow a standard normal distribution regardless of the class $y$. Consequently, $h_\phi$ "absorbs" the class-specific information, leaving $z_h$ to represent the style or form of the object (e.g., the slant or thickness of a digit).

Style-preserving digit transformations: rows represent target classes, while columns maintain the same style latent $z_h$.

As shown in the figure above, by fixing $z_h$ and varying the label $y$ during decoding, the model can perform style-preserving transformations. This property also enables data obfuscation, where sensitive attributes can be removed from a representation while preserving non-sensitive stylistic features, offering potential benefits for fair machine learning.

Conclusion

Semi-Conditional Normalizing Flows provide a powerful and efficient framework for semi-supervised learning. By combining the exact density estimation of flows with a computationally smart architecture, SCNFs outperform traditional VAE baselines and offer unique capabilities in representation disentanglement and style transfer. Future work includes scaling these models to more complex datasets and further exploring the integration of ODE-based flows like FFJORD.

Summary updated

BibTeX
@misc{atanov2019semi,
  author = {Andrei Atanov and Alexandra Volokhova and Arsenii Ashukha and Ivan Sosnovik and Dmitry P. Vetrov},
  title = {{Semi-Conditional Normalizing Flows for Semi-Supervised Learning}},
  year = {2019},
  eprint = {1905.00505},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1905.00505},
}
Figure