Modeling the Unigram Distribution

Irene Nikkarinen, Tiago Pimentel, Damián E. Blasi, Ryan Cotterell

Introduction

In linguistics, the unigram distribution represents the probability of encountering a specific word form in isolation. This distribution is a cornerstone of psycholinguistics and historical linguistics, yet in Natural Language Processing (NLP), it is often simplified to raw sample frequency. This "counting" approach suffers from two critical defects: the Out-of-Vocabulary (OOV) problem, where unseen words are assigned zero probability, and sample bias, where Zipfian distributions cause infrequent word estimates to fluctuate wildly based on corpus size.

This paper presents a "neuralized" two-stage model that separates the generation of word forms from the modeling of their frequencies. By doing so, the model provides robust probability estimates for both common and rare words, effectively addressing the "long tail" of language.

The Two-Stage Framework

The proposed architecture builds upon the framework of Goldwater et al. (2011), dividing the task into two components:

  1. The Adaptor: Utilizing a Pitman-Yor Process (PYP), this component captures the power-law behavior of word tokens. It manages the "rich-get-richer" dynamics, determining the likelihood of re-encountering a known word versus discovering a novel one.
  2. The Generator: A character-level LSTM learns the graphotactics—the underlying rules of character combination—of a language. This allows the model to assign non-zero probabilities to OOV words based on their structural plausibility.

The components are jointly optimized using a Monte Carlo Expectation-Maximization (EM) algorithm. During the E-step, Gibbs sampling assigns tokens to clusters, while the M-step updates the LSTM to better predict the word forms within those clusters. This process effectively creates a training objective that interpolates between unique word types and raw word tokens.

Experimental Evaluation

The model was evaluated on Wikipedia datasets across seven typologically diverse languages: English, Finnish, Hebrew, Indonesian, Tamil, Turkish, and Yoruba. These languages represent a wide spectrum of morphological complexity and script types. Training was conducted on 1 million tokens for most languages, with performance measured via cross-entropy on a held-out test set.

Results

The two-stage model consistently outperformed baseline LSTMs trained exclusively on types or tokens. As shown in the table below, the model achieved the lowest cross-entropy across all seven languages, demonstrating its superior ability to generalize the unigram distribution.

Cross-entropy performance across seven typologically diverse languages.

The performance gains were particularly notable in morphologically rich languages like Finnish and Turkish, where the character-level generator's ability to model complex word forms provided a significant advantage over simple counting.

Analysis of the Long Tail

A key insight of this work is the "sweet spot" found by the two-stage model. Training on raw tokens causes models to over-prioritize high-frequency function words, while training on unique types ignores the reality of frequency altogether. The two-stage approach respects the Zipfian nature of language while maintaining the ability to predict rare "singletons"—words appearing only once—which often constitute over 50% of a dataset.

Word surprisal (nats) as a function of word frequency for different modeling strategies.

As illustrated in the figure above, the two-stage model effectively balances surprisal across the frequency spectrum. It outperforms type-based models on non-singleton rare words, proving that the interpolation of frequency and form is more ecologically valid than either extreme.

Conclusion

By modeling the unigram distribution through a decoupled adaptor-generator framework, this research provides a more accurate tool for both NLP and cognitive modeling. While the computational cost of Gibbs sampling remains a limitation, the model's ability to handle OOV words and the long tail of language represents a significant step forward. Future work will explore the generator's potential as a standalone model for graphotactics and address the genre bias inherent in Wikipedia-sourced data.

Summary updated

BibTeX
@inproceedings{nikkarinen2021modeling,
  author = {Irene Nikkarinen and Tiago Pimentel and Damián E. Blasi and Ryan Cotterell},
  title = {{Modeling the Unigram Distribution}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.findings-acl.326},
}
Figure