Table of Contents
Fetching ...

olmOCR 2: Unit Test Rewards for Document OCR

Jake Poznanski, Luca Soldaini, Kyle Lo

TL;DR

olmOCR 2 addresses the challenge of robust, accurate document OCR by training an OCR-specialized vision-language model with reinforcement learning using verifiable rewards derived from binary unit tests. The authors build a scalable synthetic-data pipeline that renders PDFs to semantically rich HTML and generates verifiable unit tests, enabling RL training with multiple seeds and model soups. The approach yields state-of-the-art results on olmOCR-Bench, especially in math, tables, and multi-column layouts, while emphasizing openness of data, models, and code. This work highlights binary-unit-test rewards as a viable alternative to continuous metrics and paves the way for further advancements in end-to-end OCR with VLMs.

Abstract

We present olmOCR 2, the latest in our family of powerful OCR systems for converting digitized print documents, like PDFs, into clean, naturally ordered plain text. olmOCR 2 is powered by olmOCR-2-7B-1025, a specialized, 7B vision language model (VLM) trained using reinforcement learning with verifiable rewards (RLVR), where our rewards are a diverse set of binary unit tests. To scale unit test creation, we develop a pipeline for generating synthetic documents with diverse and challenging layouts, known ground-truth HTML source code, and extracted test cases. We show that RL training on these test cases results in state-of-the-art performance on olmOCR-Bench, our English-language OCR benchmark, with the largest improvements in math formula conversion, table parsing, and multi-column layouts compared to previous versions. We release our model, data and code under permissive open licenses.

olmOCR 2: Unit Test Rewards for Document OCR

TL;DR

olmOCR 2 addresses the challenge of robust, accurate document OCR by training an OCR-specialized vision-language model with reinforcement learning using verifiable rewards derived from binary unit tests. The authors build a scalable synthetic-data pipeline that renders PDFs to semantically rich HTML and generates verifiable unit tests, enabling RL training with multiple seeds and model soups. The approach yields state-of-the-art results on olmOCR-Bench, especially in math, tables, and multi-column layouts, while emphasizing openness of data, models, and code. This work highlights binary-unit-test rewards as a viable alternative to continuous metrics and paves the way for further advancements in end-to-end OCR with VLMs.

Abstract

We present olmOCR 2, the latest in our family of powerful OCR systems for converting digitized print documents, like PDFs, into clean, naturally ordered plain text. olmOCR 2 is powered by olmOCR-2-7B-1025, a specialized, 7B vision language model (VLM) trained using reinforcement learning with verifiable rewards (RLVR), where our rewards are a diverse set of binary unit tests. To scale unit test creation, we develop a pipeline for generating synthetic documents with diverse and challenging layouts, known ground-truth HTML source code, and extracted test cases. We show that RL training on these test cases results in state-of-the-art performance on olmOCR-Bench, our English-language OCR benchmark, with the largest improvements in math formula conversion, table parsing, and multi-column layouts compared to previous versions. We release our model, data and code under permissive open licenses.
Paper Structure (23 sections, 4 figures, 3 tables)

This paper contains 23 sections, 4 figures, 3 tables.

Figures (4)

  • Figure 1: Binary unit test vs edit distance for reading order errors. The HTML]F1D0CDcaption is floating and can be correctly represented either before or after the section that contains the HTML]D9E7D6green and HTML]FDF3D0yellow passages. A unit test that checks the presence of text ordering "green, then yellow, uninterrupted by red" will place an equivalent score to OCR output that places caption before or after the main passage. Yet, edit distance highly penalizes cases where the caption occurs after the yellow text. Furthermore, edit distance sometimes partially rewards cases which should be considered a severe reading order failure, such as when the caption occurs in-between the green and yellow texts or the green then yellow text ordering is flipped.
  • Figure 2: Binary unit test vs edit distance for math equation parsing. For a given equation and its reference LaTeX, model A produces a text output that is more dissimilar to the reference LaTeX than model B; however, after rendering and comparing the relative bounding box positions of rendered equation DOM elements, model A passes the unit test, while model B fails. Limitations of edit distance for math formulas are explored further in CDM cdm.
  • Figure 3: HTML page generation for our olmOCR 2 synthetic data pipeline. We sample a page from a real document (left) and prompt a general VLM to generate a highly similar HTML page (right). The rendered HTML page image paired with the raw HTML serves as supervision for our OCR-specialized VLM.
  • Figure 4: Unit test rewards for olmOCR 2's RLVR training. Given a generated HTMl page and its unit tests (left), we can easily score a generated Markdown page (right) according to these unit tests. Each test contributes a binary reward which is aggregated at a page-level as a pass rate. For example, with 4 of 6 passes, the page level reward is 0.67.