Evaluating n-Gram Novelty of Language Models Using Rusty-DAWG

William Merrill, Noah A. Smith, Yanai Elazar
6/18/2024
33 citations
cs.CLcs.AI

Official code: viking-sudo-rm/rusty-dawg (31 stars, Rust, MIT, Rust, last commit 2025-10-30).

Abstract

How novel are texts generated by language models (LMs) relative to their training corpora? In this work, we investigate the extent to which modern LMs generate $n$-grams from their training data, evaluating both (i) the probability LMs assign to complete training $n$-grams and (ii) $n$-novelty, the proportion of $n$-grams generated by an LM that did not appear in the training data (for arbitrarily large $n$).

Show full abstract

To enable arbitrary-length $n$-gram search over a corpus in constant time w.r.t. corpus size, we develop Rusty-DAWG, a novel search tool inspired by indexing of genomic data. We compare the novelty of LM-generated text to human-written text and explore factors that affect generation novelty, focusing on the Pythia models. We find that, for $n > 4$, LM-generated text is less novel than human-written text, though it is more novel for smaller $n$. Larger LMs and more constrained decoding strategies both decrease novelty. Finally, we show that LMs complete $n$-grams with lower loss if they are more frequent in the training data. Overall, our results reveal factors influencing the novelty of LM-generated text, and we release Rusty-DAWG to facilitate further pretraining data research.

View on arXivView PDF

Code Implementations(1)

RustMIT

Rust library for indexing and quickly searching large pretraining corpora

314Rust, PythonMay 19, 20231 years agoMIT
automata-theoryllms

Similar Papers

Cite this paper

@article{merrill2024evaluating,
  title  = {Evaluating n-Gram Novelty of Language Models Using Rusty-DAWG},
  author = {William Merrill and Noah A. Smith and Yanai Elazar},
  year   = {2024},
  eprint = {2406.13069},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.13069v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.13069.svg)](https://codeofpaper.com/paper/2406.13069)

Discussion