olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines
by Allen Institute for AI (AI2)
Turn messy PDFs into clean Markdown locally, with open weights, open data, and a benchmark that actually checks tables.
Overview
olmOCR is the Allen Institute for AI's open-source (Apache 2.0, ~19.4k GitHub stars) toolkit for turning PDFs and image-based documents into clean, linearized plain text or Markdown suitable for RAG ingestion and LLM training corpora. The current generation, olmOCR 2, was released on 22 October 2025 and has iterated through the v0.4.x line into 2026. It fine-tunes Qwen2.5-VL-7B with a document-anchoring prompt and — the genuinely novel part — trains it with reinforcement learning against unit tests: a synthetic pipeline rendered 2,186 PDF pages into semantic HTML to derive 30,381 verifiable pass/fail checks, and Group Relative Policy Optimization rewards the model for passing them rather than for fuzzy string similarity. The result scores 82.4 on olmOCR-Bench, a suite of 7,000+ binary tests over 1,400+ documents, ahead of Marker at 76.1 and MinerU at 75.2, with 84.9% on tables and 83.7% on multi-column layouts. Everything ships open: FP8 and full-precision weights on Hugging Face, the 270,000-page olmOCR-mix-1025 dataset, the training code, and the production batch-inference pipeline. The README covers Installation, Usage Examples, Using Docker and a Code overview, including the `pip install olmocr[gpu]` install and the `olmocr ./localworkspace --markdown --pdfs sample.pdf` entry point. A recent NVIDIA GPU with 12GB+ VRAM and 30GB of free disk is the practical floor; the FP8 model sustains roughly 3,400 output tokens/sec on a single H100, putting 10,000 pages under $2 with no third-party API calls.
At a Glance
- Topic
- RAG
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- ~1-2 hours to read the docs and convert your first PDFs; a full GPU pipeline run scales to millions of pages
- Provider
- Allen Institute for AI (AI2)
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Install and run a local vision-language OCR pipeline over a directory of PDFs
- ✓Produce Markdown that preserves tables, equations, headings and multi-column reading order
- ✓Strip repeated headers and footers automatically so chunks do not poison your RAG index
- ✓Run batch and multi-node GPU jobs, and estimate per-million-page cost before committing
- ✓Read olmOCR-Bench results critically and understand what its binary unit tests do and do not measure
- ✓Use the released olmOCR-mix dataset and training code to fine-tune the model on your own document classes
- ✓Deploy via Docker or the FP8 quantized weights when GPU memory is the constraint
Highlights
- •Trained with RL against 30,381 verifiable unit tests, not fuzzy text-similarity rewards — a genuinely different recipe
- •Fully open: weights, the 270k-page training dataset, training code and the inference pipeline
- •Runs entirely locally, so regulated or air-gapped document corpora never leave your infrastructure
- •Roughly 10,000 pages for under $2 on one H100, versus per-page commercial API pricing
- •Honest limitation, per LlamaIndex's independent bench review: olmOCR-Bench skews ~56% academic and excludes forms, handwriting and non-English text, so validate on your own documents
Who It’s For
Best For
- ✓Engineers building RAG ingestion over large PDF corpora
- ✓Teams assembling pretraining or fine-tuning datasets from scanned documents
- ✓Anyone blocked from commercial OCR APIs by cost, data residency or air-gap requirements
- ✓ML engineers wanting a worked example of unit-test-reward RL on a VLM
Prerequisites
- •Comfortable with Python and the command line
- •Access to an NVIDIA GPU with 12GB+ VRAM for local inference (remote inference otherwise)
- •Basic understanding of RAG chunking and why document structure matters
FAQ
What is olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines?
The official toolkit and documentation for olmOCR, AI2's Apache-2.0 system for converting PDFs and scanned images into clean, reading-order text and Markdown for RAG ingestion and LLM training corpora. For engineers who have hit the wall where a commercial OCR API is too expensive at corpus scale or forbidden by data-residency rules, this documents a fully local vision-language pipeline plus the benchmark and dataset behind it.
Is olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines free?
olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines is free to access.
What level is olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines for?
olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines is aimed at a intermediate audience. Recommended background: Comfortable with Python and the command line, Access to an NVIDIA GPU with 12GB+ VRAM for local inference (remote inference otherwise), Basic understanding of RAG chunking and why document structure matters.
How long does olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines take?
Expect roughly ~1-2 hours to read the docs and convert your first PDFs; a full GPU pipeline run scales to millions of pages. Most learners work through it at their own pace.
What will I learn from olmOCR 2 — Open-Source PDF and Document Linearization for LLM Pipelines?
You'll learn: Install and run a local vision-language OCR pipeline over a directory of PDFs; Produce Markdown that preserves tables, equations, headings and multi-column reading order; Strip repeated headers and footers automatically so chunks do not poison your RAG index; Run batch and multi-node GPU jobs, and estimate per-million-page cost before committing; Read olmOCR-Bench results critically and understand what its binary unit tests do and do not measure; Use the released olmOCR-mix dataset and training code to fine-tune the model on your own document classes; Deploy via Docker or the FP8 quantized weights when GPU memory is the constraint.
Topics
Sources
This page was written from 4 sources, 2 on domains other than github.com.