Recurrent Neural Network Language Model Adaptation Derived Document Vector

Wei Li, Brian Kan Wing Mak · DOI

Abstract

In many natural language processing (NLP) tasks, a document is commonly modeled as a bag of words using the term frequency-inverse document frequency (TF-IDF) vector. One major shortcoming of the frequency-based TF-IDF feature vector is that it ignores word orders that carry syntactic and semantic relationships among the words in a document, and they can be important in some NLP tasks such as genre classification. This paper proposes a novel distributed vector representation of a document: a simple recurrent-neural-network language model (RNN-LM) or a long short-term memory RNN language model (LSTM-LM) is first created from all documents in a task; some of the LM parameters are then adapted by each document, and the adapted parameters are vectorized to represent the document. The new document vectors are labeled as DV-RNN and DV-LSTM respectively. The results show that DV-LSTM significantly outperforms TF-IDF and PV-DM in most cases, and combinations of the proposed document vectors with TF-IDF or PV-DM may further improve performance.

Introduction

Representing a document as a fixed-length vector is a fundamental challenge in NLP. Traditional methods like TF-IDF are "bag-of-words" approaches; they count word occurrences but completely ignore word order, syntax, and long-distance semantic relationships. While newer methods like Paragraph Vectors (PV-DM) capture some context using a sliding window, they can still struggle with the high-level sequential structure required for tasks like genre classification—distinguishing, for instance, an essay from a news report. This research seeks a representation that encodes the "flow" and structural patterns of a document rather than just its vocabulary.

Methodology

The authors propose a three-step "adaptation" framework to generate document vectors:

  1. Train a Parent Model: A global Language Model (RNN or LSTM) is trained on the entire corpus to learn general linguistic patterns.
  2. Document Adaptation: For a specific document, the parent model is "retrained" or adapted using only that document's text.
  3. Parameter Vectorization: Instead of using the model's output, the authors extract the parameters that changed during adaptation. These adapted parameters are concatenated and normalized to form the final Document Vector (DV).

Architectures

The study explores two main architectures: DV-RNN and DV-LSTM. For DV-LSTM, to ensure robustness, the authors limit adaptation to the biases of the network—specifically the sigmoid layer ($b_l$), the LSTM gates ($b_m$), and the output class layer ($b_c$).

The LSTM-LM architecture used for DV-LSTM, highlighting the bias parameters adapted for document vectorization.

The core idea is that the delta—how a general model must change to fit a specific document—acts as a highly descriptive fingerprint of the document's unique sequential structure.

Experimental Evaluation

The approach was evaluated on genre classification across three corpora: the Brown Corpus (10 genres), the BNC Baby Corpus (4 genres), and an artificially created Penn Treebank (PTB) dataset (4 genres: highlights, essays, letters, and news).

Results and Discussion

The proposed DV-LSTM consistently outperformed the baselines across most metrics. As shown in the results table, the DV-LSTM (denoted as $d_{m100}$) achieved superior F-scores compared to traditional n-gram and Paragraph Vector (PV) baselines.

Comparison of classification performance (F-scores) across different feature sets and corpora.

Key findings include:

  • Superior Performance: On the BNC Baby corpus, DV-LSTM achieved a perfect 1.0000 F-score. On the PTB dataset, it reached 0.8434, significantly higher than PV-DM (0.8154).
  • Complementary Information: Combining DV-LSTM with traditional features (like $z_5^{1000}$) yielded the best overall results (0.8607 on PTB), suggesting that adaptation-derived vectors capture dimensions of text that frequency-based methods miss.
  • The Power of Biases: In the LSTM model, the class layer biases ($b_c$) were particularly strong features, likely capturing an abstract, robust form of term frequency.

Conclusion

This paper demonstrates that adapting neural language model parameters provides a powerful, compact representation for documents. While computationally more expensive than TF-IDF, the resulting DV-LSTM vectors capture high-level sequential information that improves performance in structural tasks like genre classification. Future work may explore these vectors in sentiment analysis or even non-textual sequential data like genomic sequences.

Summary updated

Abstract

In many natural language processing (NLP) tasks, a document is commonly modeled as a bag of words using the term frequency-inverse document frequency (TF-IDF) vector. One major shortcoming of the frequency-based TF-IDF feature vector is that it ignores word orders that carry syntactic and semantic relationships among the words in a document, and they can be important in some NLP tasks such as genre classification. This paper proposes a novel distributed vector representation of a document: a simple recurrent-neural-network language model (RNN-LM) or a long short-term memory RNN language model (LSTM-LM) is first created from all documents in a task; some of the LM parameters are then adapted by each document, and the adapted parameters are vectorized to represent the document. The new document vectors are labeled as DV-RNN and DV-LSTM respectively. We believe that our new document vectors can capture some high-level sequential information in the documents, which other current document representations fail to capture. The new document vectors were evaluated in the genre classification of documents in three corpora: the Brown Corpus, the BNC Baby Corpus and an artificially created Penn Treebank dataset. Their classification performances are compared with the performance of TF-IDF vector and the state-of-the-art distributed memory model of paragraph vector (PV-DM). The results show that DV-LSTM significantly outperforms TF-IDF and PV-DM in most cases, and combinations of the proposed document vectors with TF-IDF or PV-DM may further improve performance.
BibTeX
@misc{li2016recurrent,
  author = {Wei Li and Brian Kan Wing Mak},
  title = {{Recurrent Neural Network Language Model Adaptation Derived Document Vector}},
  year = {2016},
  eprint = {1611.00196},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1611.00196},
}
Figure