Larger-Context Language Modelling

Tian Wang, Kyunghyun Cho

Abstract

In this work, we propose a novel method to incorporate corpus-level discourse information into language modelling. We call this larger-context language model. We introduce a late fusion approach to a recurrent language model based on long short-term memory units (LSTM), which helps the LSTM unit keep intra-sentence dependencies and inter-sentence dependencies separate from each other. Through the evaluation on three corpora (IMDB, BBC, and PennTree Bank), we demonstrate that the proposed model improves perplexity significantly. In the experiments, we evaluate the proposed approach while varying the number of context sentences and observe that the proposed late fusion is superior to the usual way of incorporating additional inputs to the LSTM. By analyzing the trained larger-context language model, we discover that content words, including nouns, adjectives and verbs, benefit most from an increasing number of context sentences. This analysis suggests that larger-context language model improves the unconditional language model by capturing the theme of a document better and more easily.

Introduction

Standard language models (LMs) typically operate under the assumption that sentences within a document are independent. They calculate the probability of a word based solely on the preceding words within the same sentence. However, human language is inherently contextual; the "theme" established in earlier parts of a document significantly influences the likelihood of specific words appearing later. For instance, a movie review discussing horror elements makes words like "suspense" or "dark" more probable in subsequent sentences. By ignoring corpus-level discourse, traditional LMs fail to leverage valuable information. The challenge lies in integrating this "extra" context into a Recurrent Neural Network (RNN) without compromising the model's ability to capture local syntactic structures.

Methodology

The proposed "Larger-Context Language Model" utilizes LSTMs and introduces two key components: context representation and a novel fusion mechanism.

Context Representation

To summarize the preceding $n$ sentences, three methods were evaluated:

  1. Bag-of-Words (BoW): A simple frequency count of words in preceding sentences.
  2. Sequence of BoW (SeqBoW): Treating each previous sentence as a BoW and processing the sequence with a separate RNN to capture temporal order.
  3. Attention-based: Utilizing a bidirectional RNN and an attention mechanism to dynamically weight the relevance of previous sentences to the current word prediction.

Fusion Strategies: Early vs. Late Fusion

The core architectural innovation is the placement of the context vector within the LSTM cell. In Early Fusion, the context vector is concatenated with the input word vector at every timestep, forcing the LSTM to manage both local grammar and global theme within the same internal memory cell. In contrast, Late Fusion integrates the context vector at the output stage, right before the hidden state ($h_t$) is produced. This allows the internal memory cell ($c_t$) to focus exclusively on intra-sentence dependencies (syntax), while the global theme is integrated separately.

Comparison of (a) Early Fusion and (b) Late Fusion architectures for incorporating larger-context information into an LSTM cell.

Experimental Evaluation

The models were evaluated on three diverse corpora: IMDB Movie Reviews, BBC News, and the Penn TreeBank (PTB).

Key Results

  • Perplexity Improvements: The larger-context models consistently outperformed standard LSTMs and traditional $n$-gram models across all datasets. For example, on the IMDB dataset, the late fusion model achieved significantly lower perplexity than the baseline LSTM.
  • Superiority of Late Fusion: Late fusion consistently yielded better results than early fusion, validating the hypothesis that separating local and global information prevents the "theme" from being washed out by complex nonlinear gates.
  • Impact of Attention: For complex representations like SeqBoW, attention mechanisms were crucial for filtering noise from less relevant context sentences.

Discussion and Analysis

Analysis of the trained models reveals that the performance boost is not uniform across all word types. Content words (nouns, verbs, adjectives) benefit significantly from increased context, whereas function words (prepositions, determiners) show little to no improvement. This suggests the model effectively acts as a "topic tracker," capturing the document's theme to improve semantic prediction while leaving syntactic prediction to the base LSTM.

Limitations and Future Work

While results are promising on standard benchmarks, the scale of the datasets is relatively small by modern standards. Future research should explore whether these gains scale to massive corpora and evaluate the impact on downstream tasks such as Machine Translation or Speech Recognition, where sentence-level decoding is the norm.

Summary updated

BibTeX
@inproceedings{wang2016larger,
  author = {Tian Wang and Kyunghyun Cho},
  title = {{Larger-Context Language Modelling}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2016},
  url = {https://openreview.net/forum?id=ry4t52gObr},
}
Figure