olmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models
- Publication
- ICML CODEML Workshop 2025Workshop
- First submitted to arXiv
- arXiv:2502.18443
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{textspottingolmocr2025,
title = {{olmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models}},
author = {Jake Poznanski and Aman Rangapur and Jon Borchardt and Jason Dunkelberger and Regan Huff and Daniel Lin and Aman Rangapur and Christopher Wilhelm and Kyle Lo and Luca Soldaini},
year = {2025},
eprint = {2502.18443},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2502.18443}
}
The internet holds trillions of PDFs. Papers, reports, manuals, government documents: much of this content exists only in PDFs and can't be found on any web page. For teams training language models, it is an untapped mine.
The trouble is that PDFs were never designed for “reading out the text.”
The format was originally meant to describe “how to print a document on paper.” What the file stores is a series of glyphs, each with its font, size, and coordinates, rather than meaningful units such as headings and paragraphs. In the example from Figure 2 of the paper, the title “olmOCR” is six records in the PDF, one per letter, each carrying its own transformation matrix. Which character to read first, and which paragraph follows which, is not the PDF's concern.
The Allen Institute for AI (Ai2) introduced olmOCR in February 2025 with the goal of converting large numbers of PDFs into clean plain text in reading order. The model, training data, and code are all open source under permissive licenses.
Defining the Problem
Approaches at the time fell roughly into two camps:
- Pipeline tools such as MinerU and Marker chain together several models for layout segmentation, table parsing, and so on; tools like GROBID and PaperMage specialize in academic papers.
- End-to-end models such as Nougat and GOT take a page image and output text directly.
The authors point out that end-to-end models look only at the image, yet many PDFs are born digital and already contain the text. That text may be jumbled, but the characters are correct.
On the other hand, simply having a general-purpose VLM like GPT-4o read the page wasn't good enough either. The authors observed that on text-dense or complex-layout pages, GPT-4o working from the image alone tends to omit content, rewrite or “complete” the original, and caption images when nobody asked it to. The appendix states more specifically that, given only the page image, the model finishes incomplete sentences, and when the image is ambiguous, it even invents longer passages.
Could a VLM, then, look at the image while also receiving the PDF's text as a reference?
Solving the Problem
Document Anchoring: Give the Model the PDF's Text Too
![Document anchoring illustration: on the left, a PDF page; on the right, the anchor text extracted from it, including the page dimensions, image positions, and text blocks with coordinates such as “[71x459]Figure 1” and “[71x398]1 Introduction”](/content/papers/assets/044c3df431d57e98d00da32fff3b3df21f0cad1cb9a2e9176487efa55b628c17.png)
The box on the right is what the authors call document anchoring. It works like this:
- Use pypdf to read the PDF's internal structure and extract every text block and image, along with their coordinates on the page.
- Select blocks for the prompt in priority order until a character limit is reached. Blocks at the beginning and end of the document come first, since titles, abstracts, and footer information usually sit there.
- Give this anchor text to the VLM together with the page image, and ask it to output the page's plain text.
In the format shown in the figure, [71x459]Figure 1 means there is a text block reading “Figure 1” at coordinates (71, 459); [Image 480x298 to 525x312] marks the position of an image.
The authors say frankly that this anchor text is very noisy, with no preserved reading order and the body text mixed in with all kinds of boilerplate and noise from PDF rendering. But it gives the model characters it can copy, along with their approximate positions on the page. The VLM's job is to understand the layout and put things in order; the PDF text's job is to pin the characters down.
If the page is a scan with no embedded text, the anchor text shrinks to the page dimensions and image positions, and the model reads mainly from the image.
Generating Training Data with GPT-4o
With the anchoring method in hand, the authors first used it to build training data.
Among the candidate “teacher” models they compared in October 2024, Gemini 1.5 frequently returned RECITATION errors, GPT-4o mini hallucinated too much, and Claude Sonnet 3.5 was too expensive. They settled on gpt-4o-2024-08-06.
The prompt asks GPT-4o to answer in structured JSON: first metadata about the page, such as its language, orientation, and whether it contains tables, then the text in reading order. The authors found this structure crucial; it keeps GPT-4o from making up image captions when a page has no text.
The resulting dataset, olmOCR-mix-0225, has 258,641 pages from 102,825 documents, of which 96,929 were sampled from about 240 million public web PDFs and 5,896 are public-domain books from the Internet Archive. Based on a sample, academic documents make up about 56%, followed by brochures and legal documents.
Fine-Tuning a Specialized 7B Model
The anchored prompt worked well for steering GPT-4o, but the authors found that its effect varies from model to model, which makes it better suited as a data-generation technique. They next wanted to know whether a smaller specialized VLM could do as well as GPT-4o.
Starting from Qwen2-VL-7B-Instruct, they fine-tuned on olmOCR-mix-0225 for about 1.2 epochs, training for 16 hours on one machine with eight H100s. During fine-tuning, pages are resized so that the longest side is 1,024 pixels, and the anchor text is capped at 6,000 characters. A typical page input is about 1,000 tokens for the image and about 1,800 for the anchor text, around 3,000 in total.
Discussion
olmOCR-Bench: Scoring with Unit Tests
To compare OCR systems, the authors didn't want metrics like edit distance that measure “how close the output is to the reference.” They give math as an example, where the strings for and differ only slightly yet mean completely different things.
So they built olmOCR-Bench: about 1,400 PDFs and 7,010 pass/fail unit tests, each of which a program can decide unambiguously:
- Text presence: whether a passage of one to three sentences appears in the output.
- Text absence: whether peripheral content such as headers, footers, and page numbers has been left out.
- Reading order: whether two passages appear in the correct order. On a page with several news stories, for example, a test can check only that each story's headline comes before its first sentence, without caring how the stories are ordered relative to each other.
- Tables: a cell with a given value exists, and the cells above it and to its left are as expected.
- Math: render the reference LaTeX with KaTeX, record the relative position of each symbol, then check whether the output contains a set of symbols arranged the same way.
- Baseline: present on every page; it checks that some text was output, that the ending contains no more than 30 repeated n-grams, and that there are no Chinese, Japanese, or emoji characters.
The baseline check effectively turns “falling into repetition” and “text that shouldn't be there” into mandatory questions on every exam.

The highest overall score goes to anchored olmOCR at 75.5; the commercial Mistral OCR API scores 72.0, Marker 70.1, MinerU 61.5, and GOT only 48.3. The authors make a point of noting that olmOCR-Bench was built after the model was trained, to avoid tuning the model against the benchmark again and again.
The table shows that anchoring helps different models by very different amounts.
| Model | Without anchoring | With anchoring | Difference |
|---|---|---|---|
| GPT-4o | 68.9 | 69.9 | +1.0 |
| Gemini Flash 2 | 57.8 | 63.8 | +6.0 |
| olmOCR | 74.7 | 75.5 | +0.8 |
For olmOCR itself, anchoring adds only 0.8 points, roughly the size of the confidence interval. Its progress comes mainly from the training data built with anchoring, since the same Qwen2-VL base model scores only 31.5 without fine-tuning.
Also, olmOCR scores only 42.2 in the Old Scans column and around 71.0 on tables. Scans have no embedded text to anchor to, and they remain the hard part.
Training Language Models on the Output
The authors also tested whether this text is useful for language models. They took an intermediate checkpoint of OLMo-2-7B and continued pretraining on 50 billion tokens in each of two runs, one on the peS2o academic papers originally extracted with GROBID plus rules and the other on the same PDFs reprocessed with olmOCR.
Across six tasks, including MMLU, ARC, DROP, and HellaSwag, the average rose from 53.9 to 55.2, a gain of 1.3 percentage points.
Cost
| System | Cost per million pages (USD) |
|---|---|
| GPT-4o (batch) | 6,240 |
| Marker (H100) | 1,484 |
| Mistral OCR API | 1,000 |
| MinerU (L40S) | 596 |
| Gemini Flash 2 (batch) | 249 |
| olmOCR (L40S) | 176 |
The abstract's “a million pages for only 176 US dollars” refers to the estimate for running inference yourself on an L40S.
Community Reaction
olmOCR reached Hacker News on February 28, 2025, and someone in the thread pointed straight at generative OCR's long-standing problems of hallucination and inconsistent results. User vikp, who develops Marker, replied that his team had seen olmOCR drop a fair amount of text and hallucinate on their own test set, and he questioned the paper for comparing Marker's API price with olmOCR's self-hosted inference cost, an unequal comparison. Hacker News, 2025-02-28
vikp develops a competing product, and his position should be weighed accordingly; still, the comparison conditions he points out are visible in Table 6, which lists Marker in forced-OCR mode on an H100 and olmOCR on an L40S.
What to Know When Reading This Paper
- The training data comes from GPT-4o. olmOCR learns GPT-4o's output under the anchored prompt, so it may pick up the teacher's mistakes as well. The authors separately measure how closely student and teacher agree in the appendix.
- The benchmark is their own. The design of olmOCR-Bench is a useful reference, but the first comparison results come from the authors themselves.
- Anchoring depends on PDF quality. Born-digital PDFs work best; pure scans have no embedded text to use.
Conclusion
The PDF already has the text, so show it to the model. That plain idea is the core of olmOCR.
- Document anchoring puts the PDF's embedded text and coordinates into the prompt, giving the VLM characters it can copy.
- Build data with anchoring, then fine-tune a small model: 260,000 pages labeled by GPT-4o plus a 7B Qwen2-VL produce an overall score higher than GPT-4o's own.
- olmOCR-Bench replaces similarity with unit tests, turning repetition, missing text, and reading order into questions that can be graded automatically.
Generative OCR fills in characters on its own when it can't see clearly, and that is its biggest risk. olmOCR first looks for characters it can use without guessing.