CCNet: Extracting High Quality Monolingual Datasets from Web Crawl Data

TL;DR

CCNet pipeline automates extraction of high-quality monolingual datasets from Common Crawl, covering 174 languages with 532 billion tokens, boosting multilingual NLP.

cs.CL 🔴 Advanced 2019-11-01 63 views
Guillaume Wenzek Marie-Anne Lachaux Alexis Conneau Vishrav Chaudhary Francisco Guzmán Armand Joulin Edouard Grave
NLP data preprocessing web crawl multilingual dataset construction

Key Findings

Methodology

The pipeline integrates SHA-1 paragraph hashing for deduplication, fastText (Joulin et al., 2016b) for language identification, and Kneser-Ney (Heafield, 2011) 5-gram perplexity scoring trained on domain-specific corpora like Wikipedia. It processes web data in parallel, filtering out boilerplate, duplicates, and low-quality content. The process involves downloading WET files, segmenting into 5GB shards, computing hashes, identifying language, and scoring perplexity to select high-quality documents. This multi-stage filtering ensures scalable, high-fidelity monolingual corpora suitable for pretraining large models.

Key Results

  • From the Feb 2019 snapshot, 1.5 billion documents across 174 languages were processed, yielding 700 million filtered English documents with 532 billion tokens. Experiments show that training word embeddings (fastText) on top-tier data improves semantic and syntactic tasks by ~15% over tail data. BERT models trained on this corpus outperform Wikipedia-based models by 3.3% on XNLI, especially benefiting low-resource languages like Urdu, which saw a 7-point accuracy increase. These results validate the filtering pipeline’s effectiveness in enhancing model performance.

Significance

This work addresses the critical challenge of acquiring large-scale, high-quality monolingual data from noisy web sources, enabling more inclusive and effective multilingual pretraining. It democratizes access to vast datasets, especially for low-resource languages, reducing reliance on curated sources like Wikipedia. The pipeline’s automation and scalability significantly lower data collection barriers, fostering advancements in multilingual NLP, cross-lingual transfer, and low-resource language modeling. It paves the way for more equitable language technology development and broadens the scope of pretraining datasets beyond traditional boundaries.

Technical Contribution

The core innovation lies in combining large-scale deduplication via SHA-1 hashing, fastText-based language identification, and perplexity-based filtering using domain-specific language models. The pipeline is designed for high efficiency and scalability, capable of processing petabytes of web data within hours on thousands of CPU cores. It introduces a systematic, multi-stage filtering framework that maintains data diversity and quality simultaneously. The open-source tools and pretrained language models facilitate community adoption, reproducibility, and extension to new languages and domains, representing a significant step forward in automated web data curation.

Novelty

This work uniquely integrates multi-stage filtering—hash deduplication, language identification, and perplexity scoring—into a scalable pipeline for extracting high-quality monolingual corpora from uncurated web data. Unlike prior approaches relying on manual rules or limited datasets, CCNet automates the process across 174 languages, including low-resource ones, with minimal human intervention. Its combination of content deduplication and domain-aware perplexity filtering is a novel contribution, enabling the rapid construction of large, clean datasets suitable for state-of-the-art NLP models.

Limitations

  • The pipeline's reliance on domain-specific language models (e.g., Wikipedia) may bias data towards formal, encyclopedic content, potentially filtering out informal or specialized language. Hardware requirements are substantial, limiting accessibility for some researchers. Low-resource languages still face challenges in accurate identification and filtering, and the perplexity model may not fully capture content quality for all domains. Further optimization is needed to reduce processing costs and improve coverage of niche languages.

Future Work

Future directions include developing adaptive, multilingual perplexity models to better handle diverse content types, integrating multimodal data sources for richer corpora, and optimizing algorithms for lower computational costs. Expanding the pipeline to include more domain-specific corpora and refining low-resource language identification will further improve coverage. Additionally, exploring semi-supervised or active learning approaches could enhance data quality and diversity, ultimately supporting more robust multilingual NLP systems.

AI Executive Summary

The rapid growth of pre-trained language models like BERT (Devlin et al., 2018) and GPT (Radford et al., 2019) has underscored the importance of large-scale, high-quality training data. However, sourcing such data from uncurated web sources presents significant challenges due to noise, redundancy, and language diversity. Traditional methods relying on curated datasets like Wikipedia are limited in scale and scope, especially for low-resource languages. To address this, the authors introduce CCNet, an automated pipeline that extracts high-quality monolingual datasets from the Common Crawl corpus.

The pipeline employs a combination of content deduplication via SHA-1 hashing, language identification using fastText, and domain-specific perplexity filtering with Kneser-Ney language models trained on Wikipedia. This multi-stage process efficiently filters out boilerplate, duplicates, and low-quality content, resulting in a vast, diverse corpus covering 174 languages with over 532 billion tokens. Processing each snapshot takes approximately 8.5 hours on 5000 CPU cores, demonstrating high scalability.

Experimental results validate the pipeline’s effectiveness: models trained on filtered data outperform those trained on unfiltered web data, with significant improvements in downstream tasks. For instance, BERT models trained on CCNet data achieve 3.3% higher accuracy on XNLI, with especially notable gains for low-resource languages like Urdu. The approach democratizes access to large multilingual datasets, fostering more inclusive NLP research.

Despite its success, the pipeline faces limitations such as high computational costs and potential biases towards formal content. Future work aims to optimize efficiency, expand coverage, and incorporate multimodal data. Overall, CCNet represents a major step forward in scalable, automated web data curation, enabling the development of more capable and equitable multilingual language models.

Deep Analysis

Background

近年来,预训练模型如BERT(Devlin et al., 2018)和GPT(Radford et al., 2019)极大推动了自然语言处理的发展。早期工作主要依赖于有限的高质量语料,如Wikipedia和新闻数据,难以满足模型规模扩大带来的数据需求。Web Crawl数据因其丰富多样,成为潜在的宝贵资源,但其噪声和重复内容严重影响模型效果。此前,Grave et al. (2018)提出了多语种词向量训练方法,利用网页数据进行大规模预训练,但缺乏高效的过滤机制。随着数据规模的不断扩大,如何自动筛选出高质量的单语语料成为亟待解决的问题。近年来,研究逐渐转向利用深度学习模型进行内容过滤和质量评估,但仍缺乏一套系统化、可扩展的流程。Common Crawl作为一个庞大的网页存档,为多语种预训练提供了丰富的原材料,但其非结构化、噪声多、重复多的特性限制了其直接应用。本文在此背景下,提出了CCNet管道,旨在突破现有瓶颈,自动化、高效地从海量Web数据中提取高质量单语语料,为多语种预训练提供坚实基础。

Core Problem

核心问题在于如何从海量、多样、噪声繁杂的网页数据中筛选出高质量的单语语料。传统方法多依赖手工规则或简单过滤,难以应对数据规模的快速增长和多样性。具体挑战包括:去重效率不足导致冗余信息过多、语言识别的准确性不足、噪声内容(如广告、导航菜单)干扰模型训练、以及低资源语言缺乏有效过滤机制。这些问题限制了Web Crawl数据的利用效率,影响预训练模型的性能,尤其在低资源语种中表现尤为明显。解决这些瓶颈,要求开发一套自动化、可扩展、精确的过滤流程,兼顾数据质量与规模,满足大规模预训练的需求。

Innovation

本研究的创新点在于引入多阶段过滤策略,包括:• 基于SHA-1的段落哈希实现大规模去重,有效减少冗余内容;• 利用fastText的多语言识别模型(Joulin et al., 2016b)对网页进行语言识别,提升识别效率和准确性;• 训练领域特定的语言模型(如Wikipedia)使用SentencePiece分词器(Kudo, 2018)和Kneser-Ney(Heafield, 2011)5-gram模型,计算困惑度(perplexity)筛选内容。该流程结合了内容去重、语言识别和语料专业性筛选,形成一套高效、自动化的Web数据过滤框架。区别于传统单一过滤规则,该方法能在大规模数据环境中保持高效率和高质量,特别适合低资源语言的语料构建。其创新在于将深度学习模型与统计语言模型结合,提升过滤的智能化水平,为多语种预训练提供了可行的技术方案。

Methodology

  • �� 下载Common Crawl的WET网页文本,划分为5GB的片段(shards)以便处理。• 计算每段文本的SHA-1哈希(只取前64位)实现段落去重,减少冗余。• 使用fastText(Joulin et al., 2016b)对网页进行语言识别,支持176语种,剔除识别不明确的网页。• 训练特定领域(如Wikipedia)语言模型(SentencePiece + Kneser-Ney),计算网页困惑度。• 根据困惑度将语料分为头部(高质量)、中部和尾部(低质量),筛选出与高质量语料相似的内容。• 最终整理成按语言分类的JSON文件,支持多快照、多语言扩展。流程高度并行,利用多核CPU实现快速处理,确保每快照在8.5小时内完成。

Experiments

采用2019年2月的Common Crawl快照,处理后获得174种语言的语料,英文文档达7亿,词数达5320亿。通过在不同困惑度分段的语料上训练fastText词向量(300维),在语义和句法任务中表现优异,头部(高质量)数据优于尾部(低质量)约15%。在BERT(Devlin et al., 2018)预训练中,使用筛选后数据,模型在XNLI(Conneau et al., 2018)任务中的平均准确率提升3.3%,乌尔都语等低资源语种表现尤为显著。对比未筛选数据,过滤后语料在模型性能和泛化能力方面均优越,验证了多阶段过滤策略的有效性。

Results

过滤后语料库在多项任务中表现优异,XNLI任务中,英语模型准确率由82.8%提升至85.0%,俄语由73.3%提升至76.4%,乌尔都语由57.3%提升至64.3%。词向量任务中,头部数据表现比尾部高出约15%。低资源语言的语料规模显著增加,模型训练的多样性和泛化能力得到增强。实验还验证了不同困惑度阈值对数据质量的影响,合理设置阈值能最大化模型性能提升。

Applications

该方法适用于多语种预训练模型的构建,尤其在低资源语言中扩展语料。企业和研究机构可利用此流程快速生成定制化语料库,用于行业专用模型、跨语言信息检索和机器翻译。未来结合主动学习和人工校验,可进一步提升数据的专业性和多样性,为低资源语言模型提供坚实基础。

Limitations & Outlook

当前流程对硬件资源需求高,处理大规模数据耗时长,成本较大。低资源语言识别准确率仍需提升,部分专业或非正式内容可能被误过滤。困惑度模型偏向高质量内容,可能忽略一些有价值的边缘内容。未来需优化算法效率,提升低资源语言识别能力,降低成本,增强模型的普适性。

Plain Language Accessible to non-experts

想象你在整理一个超级大的图书馆,里面有来自不同国家、不同类型的书。有些书新颖、内容丰富,有些则重复、旧得快散架。为了让大家更快找到好书,你设计了一套自动筛选系统。它会用特殊的标签标记重复的书,避免放在架子上多次;还会根据书的语言和内容的专业程度,筛掉不符合标准的书。它还会用一种“智能眼镜”看一看书的内容,判断是不是像百科全书那样高质量。经过筛选,图书馆里的书变得更有价值,也更容易被读者找到。这个比喻就像CCNet的工作流程,把网页变成了高质量的“书”,让机器学习模型可以更好地理解和学习各种语言。

ELI14 Explained like you're 14

你知道在学校里,老师会帮你整理书架,把最好的书放在显眼的地方,让你更容易找到吗?其实,科学家也在做类似的事情,只不过他们用电脑和算法帮忙。网页就像是很多不同的书,有的内容丰富,有的重复很多。科学家设计了一个“筛选器”,它会把重复的内容去掉,还会判断网页用的是什么语言,内容是不是像百科全书一样专业。它还会用一种特别的“智能检测器”来评估网页内容的质量,把像百科那样高质量的网页留下来。这样,训练出来的模型就能学到更好的知识,也能更聪明地理解不同语言的内容。这个方法让我们可以从海量网页中快速找到最有用、最干净的资料,就像整理一个超级棒的图书馆一样。

Abstract

Pre-training text representations have led to significant improvements in many areas of natural language processing. The quality of these models benefits greatly from the size of the pretraining corpora as long as its quality is preserved. In this paper, we describe an automatic pipeline to extract massive high-quality monolingual datasets from Common Crawl for a variety of languages. Our pipeline follows the data processing introduced in fastText (Mikolov et al., 2017; Grave et al., 2018), that deduplicates documents and identifies their language. We augment this pipeline with a filtering step to select documents that are close to high quality corpora like Wikipedia.

cs.CL cs.IR cs.LG stat.ML