Document Neural Autoregressive Distribution Estimation

Stanislas Lauly, Yin Zheng, Alexandre Allauzen, Hugo Larochelle

Abstract

We present an approach based on feed-forward neural networks for learning the distribution over textual documents. This approach is inspired by the Neural Autoregressive Distribution Estimator (NADE) model which has been shown to be a good estimator of the distribution over discrete-valued high-dimensional vectors. In this paper, we present how NADE can successfully be adapted to textual data, retaining the property that sampling or computing the probability of an observation can be done exactly and efficiently. The approach can also be used to learn deep representations of documents that are competitive to those learned by alternative topic modeling approaches. Finally, we describe how the approach can be combined with a regular neural network N-gram model and substantially improve its performance, by making its learned representation sensitive to the larger, document-level context.

Introduction

Modeling high-dimensional discrete data, such as the "bag-of-words" representation of a document, presents significant challenges due to the curse of dimensionality. While Restricted Boltzmann Machines (RBMs) have been employed for this task, they suffer from computational intractability; calculating the exact probability of an observation requires computing a complex partition function. Traditional generative models like Latent Dirichlet Allocation (LDA) are tractable but often lack the representational depth of neural architectures. This paper introduces DocNADE, a model that provides exact probability estimates efficiently while learning rich, semantic document representations.

Methodology

DocNADE adapts the Neural Autoregressive Distribution Estimator (NADE) framework to the multinomial nature of text. Unlike standard autoencoders that learn a single bottleneck representation, NADE decomposes the joint probability of a document into a product of conditional probabilities using the probability chain rule: $p(\mathbf{v}) = \prod p(v_i | \mathbf{v}_{<i})$.

Comparison of standard Autoencoder (A) and the autoregressive NADE (B) architectures.

Key Architectural Features

  1. Autoregressive Decomposition: The model predicts each word $v_i$ conditioned on all preceding words $\mathbf{v}_{<i}$.
  2. Parameter Tying: To accommodate the "bag-of-words" assumption where word order is ignored for topic modeling, DocNADE shares a single word-representation matrix $\mathbf{W}$ across all positions. The hidden state $\mathbf{h}_i$ is computed by summing the embeddings of all previous words, ensuring the representation is invariant to the specific order of the history.
  3. Hierarchical Softmax: To manage large vocabularies ($V$), DocNADE utilizes a probabilistic binary tree. This reduces the computational complexity of word prediction from $O(V)$ to $O(\log V)$.
DocNADE computation logic showing the summation of word embeddings to form the hidden state and the hierarchical softmax tree for prediction.

Extensions

  • DeepDocNADE: The architecture can be extended to multiple hidden layers. By randomly shuffling documents during training and selecting arbitrary split points, the model learns increasingly abstract features.
  • DocNADE-LM: The model can be hybridized with a standard neural N-gram model. In this configuration, the hidden layer combines a "topic" vector (capturing long-term document context) with a "syntactic" vector (capturing short-term local context).

Experimental Results

The models were evaluated on the 20 Newsgroups, RCV1-V2 (Reuters), and APNews datasets.

  • Perplexity: On the large-scale RCV1-v2 dataset, a 3-layer DeepDocNADE achieved a perplexity of 539, significantly outperforming LDA (1437) and the Replicated Softmax RBM (988).
  • Document Retrieval: DocNADE consistently surpassed standard Autoencoders and LDA in precision-recall benchmarks, demonstrating that its learned embeddings are superior for semantic similarity tasks.
  • Language Modeling: Integrating DocNADE’s document-level context into a 6-gram neural language model reduced test perplexity on APNews from 119.78 to 109.22, outperforming contemporary LSTM and GRU models.

Discussion and Conclusion

DocNADE demonstrates that tractability is a significant advantage in document modeling. By allowing exact calculation of $p(\mathbf{v})$, training becomes more stable and evaluation more reliable compared to RBMs. While depth improves performance on large datasets like Reuters, smaller datasets like 20 Newsgroups are prone to overfitting with deeper architectures.

Furthermore, the hybrid DocNADE-LM reveals a clear separation between semantics and syntax. The DocNADE component learns thematic associations (e.g., grouping "Israel" with "Palestinians"), while the N-gram component focuses on grammatical categories. Future work includes extending this autoregressive approach to multimodal data, such as joint distributions of images and text.

Summary updated

BibTeX
@article{lauly2017document,
  author = {Stanislas Lauly and Yin Zheng and Alexandre Allauzen and Hugo Larochelle},
  title = {{Document Neural Autoregressive Distribution Estimation}},
  journal = {J. Mach. Learn. Res.},
  year = {2017},
  url = {https://openreview.net/forum?id=0_zmqqVN81S},
}
Figure