Neural Variational Inference for Text Processing

Yishu Miao, Lei Yu, Phil Blunsom

Introduction

Probabilistic generative models are powerful tools in natural language processing (NLP) because they can handle unlabeled data and learn interpretable structures. However, as these models become deeper and more complex, performing "true" Bayesian inference—calculating the probability of latent (hidden) variables given the observed text—becomes mathematically intractable.

Traditionally, researchers relied on workarounds like Markov Chain Monte Carlo (MCMC), which is accurate but painfully slow, or Variational Bayes (VB), which is faster but relies on simplistic analytic approximations that often underestimate uncertainty and perform poorly in non-conjugate models.

This paper introduces a generic framework for applying neural variational inference to text. By combining deep learning with stochastic latent variables via flexible "inference networks," the authors achieve state-of-the-art results in both unsupervised document modeling and supervised question answering.

Methods: Variational Auto-Encoders for Text

The core of the paper adapts the Variational Auto-Encoder (VAE) framework for text processing. Key technical components include:

  • Inference Networks: Instead of deriving a rigid mathematical formula for latent variables, the authors train a neural network (such as an MLP, CNN, or RNN) to directly predict the parameters (mean and variance) of the latent distribution from the data.
  • The Reparameterization Trick: To allow backpropagation through stochastic (random) layers, they use a clever coordinate transformation. This makes the entire training process end-to-end differentiable.
  • NVDM (Neural Variational Document Model): An unsupervised model that treats a document as a "bag-of-words." An MLP encoder compresses the document into a continuous latent vector, and a softmax decoder attempts to reconstruct the original words.
  • NASM (Neural Answer Selection Model): A supervised model for question answering. Unlike standard models that use deterministic attention, NASM employs a latent stochastic attention mechanism. It models the semantics of a question as a distribution, allowing it to better handle ambiguity.

Key Insights and Results

The authors evaluated their models on standard benchmarks, including 20NewsGroups and Reuters RCV1-v2 for document modeling, and QASent and WikiQA for answer sentence selection.

State-of-the-Art Performance

  • NVDM: Achieved the lowest reported perplexities (a measure of how well a probability model predicts a sample) on both 20NewsGroups and RCV1-v2, outperforming established models like LDA and docNADE. On RCV1-v2, NVDM reached a perplexity of 550, compared to the previous best of 598.
  • NASM: Set new benchmarks for Answer Selection. On the QASent dataset, it reached a Mean Average Precision (MAP) of 0.7339, significantly higher than the previous best of 0.7186.

Stochasticity as a Regularizer and Peaked Attention

In the NASM model, making the attention mechanism stochastic rather than deterministic acts as a natural safeguard against overfitting—a major problem in small QA datasets. Furthermore, the stochastic model learns to produce more "peaked" attention scores on relevant words compared to deterministic counterparts, effectively filtering out noise in long answer sentences.

Comparison of attention distributions between NASM and LSTM models.

The "How" Difficulty

Through Hinton diagrams visualizing variance, the authors discovered that questions starting with "How" exhibit much higher variance in their latent representations than "What" or "Who" questions. This empirically confirms that "How" questions are fundamentally harder for models to understand and answer.

Hinton diagram visualizing the variance of latent representations for different question types.

Continuous vs. Discrete Latents

Most prior document models used binary semantic vectors. This paper demonstrates that continuous latent variables are significantly more expressive and generalize better to unseen text.

Limitations and Future Work

While highly effective, the current NVDM model treats documents as a "bag-of-words," ignoring word order and missing the structural nuances of language. Additionally, despite improvements, the model still struggles with complex reasoning (e.g., the "How" questions).

However, the proposed framework is generic enough to be applied to any neural network architecture. Future iterations could easily incorporate Recurrent Neural Networks (RNNs) or Convolutional Neural Networks (CNNs) as encoders to capture rich sequence information, paving the way for even more sophisticated text processing models.

Summary updated

BibTeX
@inproceedings{miao2016neural,
  author = {Yishu Miao and Lei Yu and Phil Blunsom},
  title = {{Neural Variational Inference for Text Processing}},
  booktitle = {International Conference on Machine Learning},
  year = {2016},
  url = {https://openreview.net/forum?id=rJEQacWuWr},
}
Figure