TL;DR
This paper introduces olmOCR, an open-source toolkit that unlocks the vast potential of PDF documents for language model training by converting them into clean, structured plain text. It achieves state-of-the-art performance, outperforming leading commercial and open-source models, at a fraction of the cost, making high-quality PDF data more accessible for AI development.
What Problem Does This Paper Address?
The vast majority of valuable, high-quality text data resides in PDF documents, which are notoriously difficult to process for language model training. Unlike web pages, PDFs are designed for visual presentation, not logical structure, making it challenging to extract text in a coherent, natural reading order while preserving crucial elements like tables, equations, and sections. Existing solutions either produce low-quality output, are prohibitively expensive (e.g., GPT-4o at $6,240/million pages), or require sending sensitive documents to proprietary APIs. This creates a significant bottleneck in accessing and utilizing this rich data source for advancing AI.
Methods
The core of olmOCR is a fine-tuned 7B parameter Vision Language Model (VLM) trained on a massive dataset of 260,000 PDF pages. A key innovation is DOCUMENT-ANCHORING, a prompting technique that augments the visual input of the VLM with extracted text blocks and their positional information from the PDF's internal structure. This helps the model better understand the layout and context, leading to more accurate and faithful text extraction. The toolkit is designed for efficient, large-scale batch processing, leveraging backends like vLLM and SGLang.
Datasets
- olmOCR-mix-0225: A newly created dataset comprising 260,000 PDF pages, paired with OCR output from GPT-4o. This dataset is diverse, including academic papers, books, legal documents, and brochures, and was used for training the olmOCR VLM.
- OLMOCR-BENCH: A new benchmark dataset consisting of 1,400 challenging PDFs with over 7,000 fine-grained "unit tests." These tests are designed to be simple, unambiguous, and machine-verifiable, allowing for direct comparison of OCR systems across various aspects like text presence, reading order, table accuracy, and math formula extraction. This benchmark aims to overcome the limitations of existing evaluation methods that rely on fuzzy matching or LLM-as-judge.
Key Insights and Ideas
- DOCUMENT-ANCHORING is crucial: Simply feeding a rasterized PDF page to a VLM is insufficient. Augmenting the visual input with structured text and positional metadata significantly improves extraction quality, especially for complex layouts.
- Cost-effectiveness matters: The paper highlights the substantial cost savings of olmOCR ($176/million pages) compared to commercial APIs, democratizing access to high-quality PDF data.
- A dedicated benchmark is needed: Existing benchmarks often fall short in evaluating the nuances of PDF linearization. OLMOCR-BENCH's unit-test approach provides a more rigorous and equitable evaluation framework.
- Open-source is key: The release of the model, data, and toolkit fosters further research and development in this critical area.
Key Results
- State-of-the-art performance: OLMOCR outperforms leading commercial tools (Mistral OCR) and top VLMs (GPT-4o, Gemini Flash 2, Qwen-2.5-VL) on the OLMOCR-BENCH benchmark.
- Significant cost reduction: OLMOCR can process a million PDF pages for approximately $176 USD, a fraction of the cost of GPT-4o ($6,240 USD/million pages).
- Improved downstream performance: Training an OLMO-2 checkpoint with content extracted by OLMOCR resulted in a +1.3 percentage point average improvement on various LM benchmark tasks compared to using content processed by traditional methods.
- High alignment with teacher model: OLMOCR shows good alignment (0.875 average) with GPT-40, indicating faithful content extraction and linearization.
Limitations and Future Work
- Retries can impact throughput: While olmOCR employs retries to improve robustness, frequent retries can reduce overall generation throughput and increase memory usage. Future work aims to detect repeated generations sooner.
- Reliance on PDF structure: For documents without embedded digital metadata (e.g., scanned images), olmOCR relies solely on the rasterized page, which might limit its performance compared to born-digital PDFs.
- Further VLM development: The authors suggest that continued development of VLMs and their fine-tuning on diverse PDF data will further enhance performance.
- Expanding the benchmark: The OLMOCR-BENCH is a valuable resource, and future work could involve expanding its scope and complexity.
Summary updated