A Tutorial on Deep Latent Variable Models of Natural Language

Yoon Kim, Sam Wiseman, Alexander M. RusharXiv 2018

Abstract

This tutorial bridges the gap between classical probabilistic graphical models and modern deep learning for natural language processing. It explores "deep latent variable models" (DLVMs), which combine the interpretability and structural priors of traditional models with the representational power of neural networks, primarily through the lens of Variational Inference.

Introduction

In the current era of "black box" deep learning, models like LSTMs and Transformers excel at predictive tasks but often lack transparency and the ability to incorporate domain-specific constraints. Conversely, classical latent variable models, such as Hidden Markov Models (HMMs) or Topic Models, are highly interpretable and allow for explicit structural specifications but lack the flexibility to learn complex features from raw data. This tutorial addresses the unification of these paradigms, focusing on the mathematical and algorithmic hurdles of training models with unobserved (latent) variables.

Methods and Frameworks

Deep Latent Variable Models (DLVMs)

DLVMs use neural networks to parameterize conditional likelihoods. For instance, instead of a simple lookup table for word probabilities in a cluster, a deep version might utilize an RNN language model conditioned on a latent topic vector. This allows the model to capture complex dependencies within the observed data while maintaining a structured latent space.

A deep latent variable model where a global latent variable $z^{(n)}$ influences a sequence of observations $x_1 \dots x_T$ with autoregressive dependencies.

Variational Inference and the ELBO

Calculating the exact posterior distribution in these models is often computationally intractable. To solve this, researchers maximize the Evidence Lower Bound (ELBO), transforming an inference problem into an optimization problem.

Amortized Inference (VAEs)

A central theme in modern DLVMs is the Variational Autoencoder (VAE) framework. Rather than optimizing latent variables for every individual sentence—a slow process—we train a global "inference network" (an encoder) to predict latent variables directly from the input. This is known as amortized inference.

The difference between traditional Variational Inference (left), which optimizes parameters per data point, and amortized VI (right), which uses a shared network $\phi$.

To enable training via backpropagation, the "reparameterization trick" is used to differentiate through random samples by shifting randomness to an external noise variable. For discrete latent variables, techniques like the Gumbel-Softmax relaxation allow gradients to flow through non-differentiable assignments.

Key Insights and Challenges

  • Posterior Collapse: A significant challenge in training DLVMs is when the decoder (the generative part) becomes too powerful and learns to ignore the latent variables entirely. Strategies like "KL annealing" are essential to prevent this.
  • The Amortization Gap: While amortized inference is efficient, it introduces a gap in accuracy compared to per-example optimization.
  • Inductive Bias: Latent variables serve as a "declarative language," allowing researchers to encode expectations about data structure, such as sequences of tags or hierarchical trees.

Conclusion and Future Directions

DLVMs have shown success in unsupervised discovery of linguistic structures and providing continuous control over text generation (e.g., sentence morphing). While deterministic models like Transformers currently dominate performance benchmarks, they lack the explicit structural guarantees of latent variable models. The next frontier involves better integrating these structural priors into massive-scale neural architectures to combine the best of both worlds.

Summary updated

BibTeX
@misc{kim2018tutorial,
  author = {Yoon Kim and Sam Wiseman and Alexander M. Rush},
  title = {{A Tutorial on Deep Latent Variable Models of Natural Language}},
  year = {2018},
  eprint = {1812.06834},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1812.06834},
}
Figure