Skip to main content
QUICK REVIEW

[Paper Review] Deduplicating Training Data Makes Language Models Better

Katherine Lee, Daphne Ippolito|arXiv (Cornell University)|Jul 14, 2021
Topic ModelingComputer Science7 citations
TL;DR

This paper proposes a scalable deduplication framework for language model training datasets using exact substring matching and approximate document matching via n-gram hashing. It demonstrates that removing near-duplicate and verbatim repeated text from datasets like C4 reduces memorization in fine-tuned models by 10×, improves training efficiency, and enables more accurate model evaluation by eliminating train-test overlap.

ABSTRACT

We find that existing language modeling datasets contain many near-duplicate examples and long repetitive substrings. As a result, over 1% of the unprompted output of language models trained on these datasets is copied verbatim from the training data. We develop two tools that allow us to deduplicate training datasets -- for example removing from C4 a single 61 word English sentence that is repeated over 60,000 times. Deduplication allows us to train models that emit memorized text ten times less frequently and require fewer train steps to achieve the same or better accuracy. We can also reduce train-test overlap, which affects over 4% of the validation set of standard datasets, thus allowing for more accurate evaluation. We release code for reproducing our work and performing dataset deduplication at https://github.com/google-research/deduplicate-text-datasets.

Motivation & Objective

  • To investigate the prevalence of duplicate and near-duplicate content in widely used language model training datasets such as C4, Wiki-40B, LM1B, and RealNews.
  • To address the problem that train-test data overlap and data duplication lead to inflated model performance metrics and increased memorization in language models.
  • To develop and evaluate a scalable, computationally efficient deduplication pipeline that removes verbatim and near-duplicate text from large-scale datasets.
  • To demonstrate that deduplicated datasets lead to models with significantly reduced memorization, improved training efficiency, and more reliable evaluation.

Proposed method

  • Using exact substring matching to detect and remove verbatim repetitions of text segments across the dataset, even when they appear in different examples.
  • Applying approximate document matching via locality-sensitive hashing (LSH) based on n-gram overlap to identify near-duplicate documents with high similarity.
  • Processing datasets with a CPU-only, linear-time algorithm to enable scalable deduplication on terabyte-scale datasets like C4.
  • Measuring the impact of deduplication on model memorization rates, perplexity, and training efficiency across multiple model architectures and datasets.
  • Validating results by comparing model outputs on original vs. deduplicated datasets, focusing on frequency of memorized text and test set overlap.
  • Releasing the deduplication framework as open-source code to promote reproducibility and adoption in NLP research.

Experimental results

Research questions

  • RQ1How prevalent are near-duplicate and verbatim duplicate examples in standard NLP training datasets like C4, Wiki-40B, LM1B, and RealNews?
  • RQ2To what extent does train-test data overlap in standard benchmark datasets affect model evaluation and lead to overfitting?
  • RQ3What is the impact of deduplicating training data on the rate of memorized text generation in fine-tuned language models?
  • RQ4Does deduplication improve training efficiency and model performance, as measured by perplexity and convergence speed?
  • RQ5Can deduplicated datasets lead to more reliable and accurate model evaluation by reducing spurious memorization and data leakage?

Key findings

  • Over 1% of unprompted model outputs from models trained on standard datasets like C4 contain verbatim memorized text from the training data.
  • Deduplication reduces the rate of memorized text generation by a factor of 10×, with models trained on deduplicated data emitting memorized content at 0.14–0.19% frequency compared to 1.93–3.34% on original data.
  • A single 61-word sentence was found repeated 61,036 times in C4 and 61 times in the validation set, illustrating significant train-test overlap.
  • Deduplicated datasets are up to 19% smaller, reducing training time, cost, and environmental impact while maintaining or improving perplexity.
  • Models trained on deduplicated data achieve the same or better accuracy in fewer training steps, demonstrating improved training efficiency.
  • Perplexity is not degraded by deduplication; in some cases, it improves by up to 10%, indicating higher-quality training data leads to better generalization.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.