FlowPrior: Learning Expressive Priors for Latent Variable Sentence Models

Xiaoan Ding, Kevin GimpelNAACL 2021

Introduction

Variational Autoencoders (VAEs) are a cornerstone of modern Natural Language Processing, enabling the mapping of discrete sentences into a continuous latent space. This mapping is essential for tasks such as controlled text generation and style transfer. However, standard VAEs often struggle with two primary issues: posterior collapse, where the decoder ignores the latent variable, and restrictive priors, where the assumption of a simple Gaussian distribution fails to capture the inherent complexity and multimodality of human language.

FlowPrior is a novel framework designed to overcome these hurdles by combining expressive Normalizing Flows with a robust training objective that prevents the model from reverting to simplistic distributions.

The Challenge: Why Standard VAEs Fail

Most VAEs assume the latent space follows a "Standard Gaussian" (a simple bell curve). While mathematically convenient, this is a poor fit for language, which is naturally messy and multi-peaked. Forcing diverse semantic concepts into a single bell curve limits the model's expressivity.

Furthermore, even when researchers attempt to use more complex priors, the standard training objective—the Evidence Lower Bound (ELBO)—often fails to provide a sufficient learning signal. This leads to a phenomenon where the complex prior simply collapses back into a simple Gaussian during training, rendering the architectural improvements useless.

The FlowPrior Methodology

FlowPrior introduces two key innovations to address these limitations:

  1. Normalizing Flows (Real NVP): Instead of a fixed Gaussian, the prior is parameterized using Normalizing Flows. This technique takes a simple distribution and passes it through a series of invertible, trainable transformations (specifically real-valued non-volume preserving transformations). This allows the model to learn a prior of virtually any shape, including complex, multimodal distributions.
  2. A Combined Training Objective: To ensure the prior actually learns, the authors augment the ELBO with the Importance-Sampled Log Marginal Likelihood ($M_{IS}$). This term, derived from Importance Weighted Autoencoders (IWAE), provides a tighter lower bound on the true data likelihood and gives the prior parameters a much stronger learning signal.

Visualizing the Latent Space

The impact of the $M_{IS}$ objective is most evident when visualizing the learned latent distributions. As shown below, architecture alone is insufficient; without the proper objective, even complex priors like MoG or Real NVP collapse into a single mode.

Comparison of learned latent distributions across different VAE architectures and training objectives. FlowPrior (f) successfully maintains distinct modes compared to ELBO-only variants.

Key Insights

  • Objective Over Architecture: The authors demonstrate that simply increasing prior complexity does not help if the training objective is weak. Without the $M_{IS}$ term, Normalizing Flow priors typically revert to a standard Gaussian.
  • Multimodality and Latent Usage: FlowPrior successfully learns multiple "clusters" or modes in the latent space. This results in a significant increase in "Active Units" (latent dimensions carrying information) and higher Mutual Information between the input and the latent code.
  • Smooth Semantic Transitions: When interpolating between points in the latent space, FlowPrior generates sentences that transition smoothly in meaning (e.g., from "a dog in the snow" to "a man on a bench"), avoiding the repetitive or nonsensical outputs common in simpler models.

Experimental Results

The models were evaluated on four standard benchmarks: Penn Treebank (PTB), Yahoo, Yelp Sentiment, and SNLI.

Performance metrics across Yahoo, Yelp, and SNLI datasets. FlowPrior consistently achieves lower Perplexity (PPL) and higher Mutual Information (MI) than standard VAE baselines.

Key quantitative findings include:

  • Language Modeling: FlowPrior achieved the lowest Perplexity (PPL) across all datasets. For instance, on PTB, it reached 94.72 PPL, a marked improvement over the 101.40 of a standard VAE.
  • Generation Quality: Using "Reverse Perplexity" (R-PPL) to measure how well samples match the training distribution, FlowPrior significantly outperformed baselines. On Yelp, FlowPrior achieved an R-PPL of 1,677, compared to 30,248 for the standard VAE.
  • Diversity: Lower "Self-BLEU" scores indicated that FlowPrior generates more diverse and less repetitive sentences than traditional VAEs.

Limitations and Future Work

While highly effective, FlowPrior introduces computational overhead due to the invertible matrix operations in Normalizing Flows and the multiple passes required for importance sampling. Additionally, while it excels at modeling the overall distribution, there is a slight trade-off in reconstruction accuracy compared to models using "free bits" (FB) techniques. Future research may explore more efficient flow architectures, such as Inverse Autoregressive Flows, or integrate FlowPrior into large-scale Transformer-based models like GPT.

Summary updated

BibTeX
@inproceedings{ding2021flowprior,
  author = {Xiaoan Ding and Kevin Gimpel},
  title = {{FlowPrior: Learning Expressive Priors for Latent Variable Sentence Models}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.naacl-main.259},
}
Figure