Dynamic Language Models for Streaming Text

Dani Yogatama, Chong Wang, Bryan R. Routledge, Noah A. Smith, Eric P. Xing

Abstract

Traditional language models often assume that word distributions are static over time, an assumption that fails in the face of rapidly shifting news cycles and social media trends. This paper introduces a probabilistic language model designed specifically for streaming data that adapts to temporal shifts by conditioning on non-linguistic "world" features, such as stock market fluctuations. By employing an efficient online variational learning framework, the model identifies and leverages relevant historical language patterns based on current external context. Our evaluation across multiple news and social media streams demonstrates that this approach consistently outperforms traditional static models and simple adaptive baselines in predictive perplexity.

Introduction

In real-world streaming environments, language is highly dynamic. On platforms like Twitter or in financial news feeds, the prevalence of specific terms shifts rapidly in response to external events. Standard language models (LMs) face a dilemma: training on all available history dilutes current trends, while training only on recent data leads to overfitting and the loss of long-term patterns.

This research addresses the challenge of non-stationarity by developing a model capable of capturing long-range temporal dynamics. By using external metadata to determine which past language patterns are currently relevant, the model can adapt in real-time without the need to store massive datasets in memory.

Methodology

The proposed model is a generative framework where the word distribution at any time $t$ is composed of a "background" distribution representing long-term frequencies and a time-dependent "deviation" vector ($\beta_t$).

Graphical model of the dynamic language model showing dependencies between world features $x$, word deviations $eta$, and observed words $w$.

The core innovation lies in the calculation of $\beta_t$. Rather than relying solely on the immediate past, the model examines a window of the previous $c$ days. It computes the similarity between the current "world state" (represented by a feature vector $x_t$, such as S&P 500 returns) and past states ($x_k$). If current economic conditions mirror a specific period in the past, the model assigns higher weight to the language patterns observed during that period.

Learning is conducted via a variational Expectation-Maximization (EM) algorithm. The E-step infers local word deviations, while the M-step updates global feature coefficients using stochastic gradient descent, enabling the system to process data examples sequentially as they arrive in the stream.

Experimental Results

The model was evaluated on five distinct datasets: four Reuters economic news streams (English, German, and French) and a Twitter dataset containing stock ticker symbols. The primary metric for evaluation was per-word predictive perplexity.

Predictive perplexity for unigram models across different datasets, comparing the proposed model ($c=7$) against various baselines.

As shown in the results, the proposed model (specifically with a window size $c=7$) consistently achieved lower perplexity than both "base all" (a static model using all history) and "base one" (a model using only the previous day). These gains were even more pronounced in bigram models, suggesting that external context is particularly effective at capturing specific phrases associated with market movements. Qualitatively, the model's internal coefficients for specific stock-related terms were found to align closely with periods of high volatility in the corresponding stocks.

Conclusion and Future Work

By integrating non-linguistic context into a streaming variational framework, this model successfully navigates the non-stationarity of real-world text streams. While the current implementation uses simple binary similarity metrics for stock returns, future work could incorporate more nuanced features like market capitalization or magnitude of price moves. Additionally, extending this framework to latent topic models like LDA represents a promising path toward capturing higher-level semantic shifts in dynamic environments.

Summary updated

BibTeX
@article{yogatama2014dynamic,
  author = {Dani Yogatama and Chong Wang and Bryan R. Routledge and Noah A. Smith and Eric P. Xing},
  title = {{Dynamic Language Models for Streaming Text}},
  journal = {Trans. Assoc. Comput. Linguistics},
  year = {2014},
  doi = {10.1162/tacl\_a\_00175},
}
Figure