Towards a Cleaner Document-Oriented Multilingual Crawled Corpus

Julien Abadji, Pedro Javier Ortiz Suárez, Laurent Romary, Benoît Sagot

Abstract

This paper introduces OSCAR 22.01, a massive multilingual corpus derived from Common Crawl that shifts from line-level to document-level language classification. By implementing new filtering techniques and non-destructive quality annotations, the authors provide a cleaner, more contextually coherent dataset better suited for pre-training large generative language models.

Introduction: The Problem with Line-Level Identification

Most massive web-crawled datasets, including previous versions of OSCAR, rely on line-level language identification. While efficient, this approach often compromises document integrity. For instance, if a single webpage contains multiple languages—such as a French article with an English navigation menu—line-level tools split these into different language buckets, stripping away the surrounding context.

Furthermore, raw web data is notoriously noisy, containing boilerplate text, source code, and adult content. Researchers typically face a binary choice: use the data as-is or apply aggressive filters that might accidentally discard valuable information, especially for low-resource languages. The authors aim to provide a "document-oriented" version of OSCAR that preserves context and offers granular metadata for smarter filtering.

Methods: The Ungoliant Pipeline

The authors updated their pipeline, Ungoliant, with several key innovations:

  1. Document-Level Identification: Instead of classifying every line independently, the pipeline now identifies the language of the entire document using a weighted confidence score from FastText across all lines.
  2. Multilingual Logic: A specific check for multilingual documents was introduced. A document is labeled "multilingual" only if it has at least 5 lines, contains between 2 and 5 languages, and each language represents a significant portion (at least $1/(m+1)$) of the text.
  3. Refined Filtering:
    • Header/Footer Filter: Removes contiguous short lines only at the very beginning or end of a document to clean up navigation menus without touching the body.
  4. Short Lines Proportion Filter: Discards documents where the majority of lines are very short, which often indicates low-quality "link farms" or list-heavy pages.
  5. Non-Destructive Annotations: Instead of just deleting "bad" data, documents are tagged with metadata (e.g., tiny, noisy, short_sentences, adult). This allows users to decide their own threshold for quality versus quantity.

Datasets

The primary source is the November/December 2021 Common Crawl dump. The resulting corpus, OSCAR 22.01, is compared against its predecessor, OSCAR 21.09. The dataset covers a wide range of languages, from English (3.2 TB) to low-resource languages like Alemannic German and Divehi.

Key Insights: Context and the Low-Resource Shrinkage

Moving to document-level classification ensures that generative models (like GPT-style LLMs) see contiguous blocks of text, preserving the flow of human thought rather than a jumble of disconnected lines.

Interestingly, some low-resource language sub-corpora shrank significantly in the new version. For example, Alemannic German dropped from 7MB to 360KB. This occurred because previous line-level pipelines were "hallucinating" these languages by misclassifying noisy lines within larger German documents. The document-level approach correctly identifies these as German, revealing that the actual amount of pure Alemannic data was much smaller than previously thought.

The content size comparison highlights how stricter document-level identification impacts low-resource languages like Somali and Alemannic more heavily than high-resource ones like French.

By providing a clean tag for documents that pass all quality checks, the authors empower researchers. High-resource language users can stick to "clean" data, while those working on low-resource languages can opt to include "noisy" or "tiny" documents to maintain a usable sample size.

Key Results

The release of OSCAR 22.01 provides a massive, document-oriented multilingual corpus that maintains a similar size distribution to previous versions but with significantly higher internal coherence.

Comparison of corpus size distributions and proportions between OSCAR 21.09 and OSCAR 22.01.

Using the new annotations, the authors found that low-resource languages tend to have a much higher proportion of "tiny" or "short sentence" documents compared to high-resource languages. Additionally, the pipeline successfully identified common language pairings in web data, such as Russian/Uzbek or Czech/Slovak, which often appear together due to regional proximity or translation.

Limitations and Future Work

The authors acknowledge several hurdles:

  • Hard Thresholds: Defining a document as "tiny" if it has fewer than 5 lines is somewhat arbitrary. Some high-quality data might be lost just because it's short.
  • Adult Content Filtering: The use of the UT1 blocklist (a list of domains) is a blunt instrument. It suffers from both false positives and false negatives, and risks unfairly filtering out LGBTQI+ content that is not pornographic.
  • Boilerplate: While the header/footer filter helps, web crawls still contain significant "noise" from sidebars and ads. Future work may involve processing raw HTML to better distinguish between content and template.

Summary updated

BibTeX
@inproceedings{abadji2022towards,
  author = {Julien Abadji and Pedro Javier Ortiz Suárez and Laurent Romary and Benoît Sagot},
  title = {{Towards a Cleaner Document-Oriented Multilingual Crawled Corpus}},
  booktitle = {LREC},
  year = {2022},
  url = {https://openreview.net/forum?id=d25H5bFCf6},
}
Figure