Source-linked AI summary
CCpdf: Building a High Quality Corpus for Visually Rich Documents from Web Crawl Data
Michał Turski, Tomasz Stanisławek, Karol Kaczmarek, Paweł Dyda, Filip Graliński
TL;DR
Document-understanding pretraining corpora are often single-domain, monolingual, or nonpublic, while web-wide corpora have focused on text rather than multimodal PDFs. This paper builds a Common Crawl pipeline for collecting and processing PDF documents, shares a 14.5-million-page corpus index, and reports a two-step OCR and text-extraction procedure with a speed–quality trade-off.
Problem
Document-understanding pretraining corpora are often single-domain, monolingual, or nonpublic, and web-wide corpora have focused on text rather than multimodal PDFs.
Source: §1 · pp. 2–3Method
The paper uses Common Crawl to collect diversified PDF samples and processes them with a pipeline designed to balance data quality and processing time.
Source: §1 · p. 3, §6 · p. 15Results
The authors report a two-step PDF-processing procedure that classifies files for OCR or direct extraction, with predefined OCR languages speeding processing at some cost to data quality.
Source: §5 · p. 14Takeaways & Limitations
The paper provides a downloadable PDF index and metadata analyses intended to help readers understand the corpus and Internet PDF content.
Source: §6 · p. 15The study evaluates the processing pipeline but does not analyze how project decisions affect final language-model performance.
Source: §5 · p. 14
Abstract
from arXiv · showhide
In recent years, the field of document understanding has progressed a lot. A significant part of this progress has been possible thanks to the use of language models pretrained on large amounts of documents. However, pretraining corpora used in the domain of document understanding are single domain, monolingual, or nonpublic. Our goal in this paper is to propose an efficient pipeline for creating a big-scale, diverse, multilingual corpus of PDF files from all over the Internet using Common Crawl, as PDF files are the most canonical types of documents as considered in document understanding. We analysed extensively all of the steps of the pipeline and proposed a solution which is a trade-off between data quality and processing time. We also share a CCpdf corpus in a form or an index of PDF files along with a script for downloading them, which produces a collection useful for language model pretraining. The dataset and tools published with this paper offer researchers the opportunity to develop even better multilingual language models.
1 Introduction
Document-understanding models need large multimodal pretraining corpora, yet existing document datasets are often domain-limited and web-wide corpora focus on text. The paper presents a Common Crawl pipeline for collecting PDFs and shares a 14.5-million-page corpus index and download script.
1 Introduction
- Document-understanding models use multimodal document representations, including token positions and page images, and require large pretraining datasets.Document understanding is defined as converting a document into meaningful information.Source: §1 · p. 2
- Existing document-dataset efforts have focused on single domains, while web-wide corpora have focused on text rather than multimodal documents such as PDFs.The paper identifies an all-over-the-Internet approach to multimodal documents as missing.Source: §1 · pp. 2–3
- The paper describes a PDF-corpus pipeline and shares an index and download script for a 14.5-million-page collection intended for 2D language-model pretraining.The corpus may also serve as a source for derived datasets.Source: §1 · p. 3
2 Related works
Prior document corpora include large collections concentrated in particular domains or languages, while web-crawl research has mainly produced text corpora. The paper distinguishes its aim as a diverse, multilingual dataset of PDF documents.
2 Related works
- Existing document collections are generally single-domain or single-language; the paper aims instead for a diverse, multilingual PDF dataset.A previously presented dataset was not shared, and its paper described processing decisions without analyzing them.Source: §2 · pp. 3–4
- Prior PDF and document collections include domain-specific datasets such as IIT-CDIP, DoRe, Docbank, and Publaynet.The collections described include tobacco-library reports, company annual reports, and scientific articles.Source: §2 · p. 3
- Common Crawl has supported text-focused corpora for multilingual, parallel-text, and question-answering uses, distinct from this paper’s focus on PDF documents.Examples include CCNet, CCMatrix, and CCQA.Source: §2 · pp. 3–4
3 Collecting and processing PDFs
The collection pipeline uses Common Crawl indexes and extracts PDF links from CDX files rather than processing raw crawl data. Its scope centers on the May 2022 dump and PDFs captured as text files by Common Crawl.
3.1 Common Crawl
- The May 2022 Common Crawl dump contained 3.45 billion web pages and 462 TB of uncompressed content; the authors selected it to focus on recent documents.The paper notes that applying the procedure to earlier crawls could yield more PDFs and enable diachronic analysis.Source: §3.1 · p. 5
- Common Crawl dumps include PDFs because the crawler treats them as text files, but not image, Excel, or DOCX files.The dumps consist mostly of HTML pages and include an index of crawled pages.Source: §3.1 · p. 5
3.2 PDF links extraction
- The selected CDX method filtered captures by the application/pdf MIME type, while WARC-linked files were less likely to be available in the dump or at their original address.The authors note that processing even a small share of WARC files could still add a significant number of PDF links.Source: §3.2 · p. 5
- The authors compared extracting PDF links from CDX index files with searching raw WARC crawl data, then chose CDX files to speed up the pipeline.CDX files were simpler to download; WARC processing could yield more links but only a limited number of WARC files could be processed.Source: §3.2 · p. 5
3.3 URL-based language detection
The pipeline first uses URL heuristics to filter for a chosen set of languages, then applies content-based language detection after download. It also filters suspected spam PDFs using URL patterns and domain-level exclusion.
3.3 URL-based language detection
- The authors limited the language set to 11 languages and used URL heuristics as a preliminary filter before proper language detection on downloaded contents.For example, PDFs from .pl domains were assumed Polish unless the URL indicated English.Source: §3.3 · p. 6
- Common Crawl’s language metadata was unusable for this task because its detector applies only to plain text or HTML and few PDF links had language metadata.The metadata was added to CDX files in August 2018.Source: §3.3 · p. 6
3.4 Filtering out spam
- The authors characterize PDF files on the Internet as having relatively little spam compared with HTML pages and often containing formal business, legal, or scientific material.Source: §3.4 · p. 6
- A URL-pattern heuristic flagged suspicious PDFs and discarded domains with a large share of such URLs; a manually annotated sample of 1,000 documents contained no spam PDFs.The telltale pattern was a long filename of lowercase letters interspersed with hyphens.Source: §3.4 · p. 6
3.5 PDF data download methods
The pipeline limits downloads per domain to diversify files, then separates documents needing OCR from those suitable for direct text extraction. Crawl-dump extraction is constrained by a 1 MB truncation limit.
3.5 PDF data download methods
- At most three PDFs per domain were downloaded for each language, reduced to one for English and two for German to balance diversity and abundance.Source: §3.5 · p. 6
- The provided script can extract individual PDFs directly from a Common Crawl dump without downloading the whole dump.Source: §3.5 · p. 7
- A 1 MB crawler truncation limit means only small PDFs can be extracted from dumps; larger files must be downloaded from their original sites.Source: §3.5 · p. 7
- 94.94% of downloaded documents were successfully processed, according to Table 2’s processing statistics.Source: Table 2 · p. 7
3.6 Born Digital scanner
- Documents with textual content in the PDF structure can avoid OCR: direct extraction supplies tokens and bounding boxes while reducing time and OCR errors.Source: §3.6 · pp. 7–8
3.7 Born Digital detection heuristics
The pipeline uses a heuristic detector to identify PDFs that can bypass OCR, then selects an extraction or OCR strategy. Tests found the detector useful and DjVu-based extraction the fastest strategy.
3.7 Born Digital detection heuristics
- The detector marks files with visible text length above 100, no hidden text, and no images as not requiring OCR.The statistics were extracted with the authors’ Digital-born PDF Scanner tool.Source: §3.7 · p. 8
3.8 OCR processing
- The DjVu-based tool with a born-digital detector was fastest and produced better output than OCR engines; Tesseract with built-in language detection was slowest and excluded from the final pipeline.The tested alternatives also included Tesseract with URL-based language detection and Azure CV API.Source: §3.8 · p. 9, Table 4 · p. 9
3.9 Language Identification
The paper tests URL-based and content-based language identification for PDFs and reports their performance, including the effect of supplying the appropriate Tesseract language model.
- The final pipeline uses URL-based detection and content-based detection with the langdetect library.Source: §3.9 · p. 10
- 97.3% of documents were correctly assigned a language, although both mechanisms detect only one language and 27 sampled documents contained multiple languages.Source: §3.9 · p. 10
- Content-based detection achieved a 94.21% average F1-score, compared with 90.51% for URL-based detection.Japanese was the exception where content-based detection did not perform better; Arabic and English were the least satisfactory languages for both mechanisms.Source: §3.9 · p. 10
- 98.05% average F1-score was achieved when the proper Tesseract model was used.The paper attributes the increase to language identification operating on the proper alphabet.Source: §3.9 · p. 10
Possible alternatives
The authors select langdetect to balance language-identification quality and processing time, then cap the corpus at 200,000 documents per language. The resulting index emphasizes multilingual, multi-domain, and relatively recent documents.
Possible alternatives
- Spacy and langdetect achieved the best similar F1-scores, at 94.33% and 94.21%, respectively; gcld3 was fastest, but langdetect was selected to balance quality and resource use.Source: Possible alternatives · p. 10, Table 6 · p. 11
3.10 Produced index
- The index caps downloads at 200,000 documents per language to balance language representation with dataset size.Statistics for the index are presented in Table 2.Source: §3.10 · p. 11
- The corpus is smaller than prior corpora by total documents and pages, but has the longest average documents, spans 11 languages and many websites, and mostly contains files created after 2010.Source: §3.10 · p. 11