Unlimited-OCR-2 rejoins tables split across PDF pages Baidu's open-source Unlimited-OCR-2 document parsing model reads multiple PDF pages in a single request, returning tables that span page breaks as one table instead of two, according to a hands-on test by Khuyen Tran, Senior DevRel at OpenTeams. In Baidu's tests at 100 pages, each word was 7 times faster to write than with a read-every-page approach, and the model runs on NVIDIA GPUs via Baidu's Transformers code or on Apple Silicon Macs through the mlx-vlm conversion (pip install mlx-vlm==0.7.11). Tran tested it on the Federal Reserve's 214-page 2024 Annual Report, where Table 5.3 starts on page 71 and continues on page 72, and contrasted it with DeepSeek-OCR-2, which reads one page per request and returns the split table as two tables requiring manual cleanup. Parse Long PDFs Without Breaking Tables Using Unlimited-OCR-2 Unlimited-OCR-2 reads many PDF pages in one request, so tables split across pages come back as one table. See how it compares to page-by-page OCR. Khuyen TranSenior DevRel at OpenTeams https://openteams.com/engineering-blog/author/khuyen-tran/ If you run OCR on a long PDF report, a table that spans two pages may come back as two separate tables instead of one. This happens because most OCR models read one page at a time, so they can't tell that a table on one page continues onto the next. Unlimited-OCR-2 solves this by reading many pages in one request, so a table split across pages comes back as one table. It scores well on long-document benchmarks https://huggingface.co/baidu/Unlimited-OCR-2/blob/main/Unlimited-OCR-2.pdf , but benchmarks don't always reflect real-world documents. So I tested it on a long PDF report to see how good it is in practice. 💻 Get the Code : The scripts for every example are on GitHub https://github.com/khuyentran1401/codecut-blog/tree/main/unlimited-ocr-2-vs-deepseek-ocr-2 . Unlimited-OCR-2 https://huggingface.co/baidu/Unlimited-OCR-2 is an open-source document parsing model from Baidu. It is built on DeepSeek-OCR and has the same size as DeepSeek-OCR-2 https://huggingface.co/deepseek-ai/DeepSeek-OCR-2 . The main difference between them is how they read a document. DeepSeek-OCR-2 reads one page per request, while Unlimited-OCR-2 reads many pages in one request: The obvious way to let a model see across a page break is to have it look at every page while it writes. But then the model would reread every page before writing each word, which gets very slow for long documents. Unlimited-OCR-2 avoids this slowdown by: Because the number of bands it reads in full stays small no matter how long the document is, each word gets only a little slower to write as you add pages. In Baidu's tests at 100 pages, each word was 7 times faster to write than with the read-every-page approach. To see how well this works, I ran DeepSeek-OCR-2 and Unlimited-OCR-2 on several tables that span multiple pages. Both models are built on DeepSeek-OCR and have the same size, so differences in their outputs come mostly from whether they read across page breaks. Unlimited-OCR-2 runs on an NVIDIA GPU through Baidu's Transformers code, or on an Apple Silicon Mac through the MLX conversion in mlx-vlm https://github.com/Blaizzy/mlx-vlm . This article uses the Mac path, but the outputs are the same format on both. On a Mac: pip install mlx-vlm==0.7.11 On an NVIDIA GPU, follow the model card's Transformers setup https://huggingface.co/baidu/Unlimited-OCR-2 transformers . The first test is the simplest: give the model the two pages around one split table, and see whether it can recognize them as one table. The tests use the Federal Reserve's 2024 Annual Report https://www.federalreserve.gov/publications/files/2024-annual-report.pdf , a 214-page report with many tables that cross a page break. Its Table 5.3 starts on page 71 and continues on page 72, with its header repeated. A page-by-page model like DeepSeek-OCR-2 parses each page separately, so these two pages come back as two tables. The first one ends at the bottom of page 71: | Item | 2024 | 2023 | |---|---|---| | ... | | | | For currency costs | 1,242 | 1,047 | | For Consumer Financial Protection Bureau costs | 663 | 721 | The second one starts with the page title and the header as ordinary rows: | Table 5.3—continued | | | |---|---|---| | Item | 2024 | 2023 | | Reserve Bank net loss from operations | -77,606 | -114,386 | | Consolidated variable interest entities: Income, net | 22 | 1,124 | | ... | | | Before you can use the table, you have to delete the extra title and header rows from the second table, then join the two tables yourself. Now let's try Unlimited-OCR-2. Pass both page images to mlx vlm.generate in one call, with the prompt Multi page parsing. : mlx vlm.generate --model mlx-community/Unlimited-OCR-2-8bit \ --image p071.png p072.png \ --prompt "Multi page parsing." --max-tokens 8000 This prints one