Is There Life Before fit/predict?

Daniil Karpov27 Jun 2024

Problem

Teams training NLP models on large raw datasets pay for data that adds nothing: near-duplicate texts that give almost no new information, and labels that are simply wrong. Both raise training cost, and wrong labels also lower quality. Exact duplicates are easy to drop, but near-duplicates and noisy labels need dedicated methods. Often the dataset is a finished one, so the labeling process cannot be inspected and only the model's behavior during training is available.

Example from the article: in the Russian part of Amazon Massive (11.5K training examples), MinHashLSH removed 827 records (7.2%), of which 514 were exact duplicates.

Solution in brief

Clean in two passes. First remove duplicates: MinHash+LSH for lexical near-duplicates, then semantic deduplication on embeddings (SemDeDup, SSL Prototypes, or both combined as D4). Then, for a labeled set, flag suspicious labels with two signals from a trained model: Dataset Cartography (confidence and variability across epochs) or pointwise V-information (PVI).

Questions this case answers
  • How to cut the size of a large raw training set while keeping the diversity the model needs to generalize
  • How to find mislabeled examples in a labeled training set when the labeling process cannot be inspected and only the trained model is available
  • How to remove near-duplicate texts from a large raw training set before training?
  • How to find mislabeled examples in a labeled text dataset when you have no access to the labeling process?

Tools and methods

  • MinHash + LSH — fast lexical near-duplicate detection on character n-grams
  • SemDeDup, SSL Prototypes, D4 — semantic deduplication and pruning on embedding clusters
  • Dataset Cartography (Data Maps) — per-sample confidence and variability over epochs to locate mislabeled data
  • V-usable information and PVI — per-sample difficulty score that also flags wrong labels
  • Apache Spark — MinHashLSH implementation used for the demo
  • ruBERT — the base model fine-tuned in the cleaning experiment
Continue reading — it's free

Google or a one-time email code. No password.