The usual PDF pipeline is a loop: split the file, run OCR (optical character recognition, turning page images into text) on each page, concatenate the strings. When a table starts on one page and ends on another, every later page returns a headless fragment, and your code cannot tell they belong together.

Unlimited OCR 2, a document parser Baidu's team released under the MIT license, drops the loop: you send the whole PDF in one request. We served it on one RTX 4090 with the 59-page IRS employer's tax guide, where one table spans pages 46 to 52. It worked once we flipped one setting. One failed run raised no error. The full test of Unlimited OCR 2 on the 59-page tax guide has every table, flag and timing.

The setting that decides the result: crop_mode

By default the model sees each page twice over: one overview image plus a grid of zoomed-in tiles, meant to help with small print. Set crop_mode=false and it gets the overview alone.

For this guide, the overview alone won on speed and accuracy:

59 pages, one request, RTX 4090 Tiles (default) crop_mode=false
Whole document 6 min 45 s 3 min 44 s
Distance to the PDF's own text 38.1% 4.2%

The errors are not spread evenly. Drop pages 46 to 54 and both modes sit near 2.4% on ordinary prose. The table did the damage. With tiles on, page 46 came back with eight rows crammed into one cell, followed by "Taxable if wages subject to social security tax and Medicare tax" written 1,508 times. Only the per-page cap of 20,000 tokens stopped it (a token is a word piece, the unit a model reads and writes). Pages 47, 50 and 52 were blank. The authors' anti-repetition guard was on, and resending pages 46 to 54 alone looped again.

Page 46 of IRS Publication 15 from Unlimited OCR 2 on one RTX 4090. Left, tile mode: 156 s, one sentence repeated 1,508 times. Right, crop_mode=false: 25 s, rows with four columns as printed, within 0.7% of the PDF text

With long tables, start with tiles off and spot-check the figures on the table pages.

The trap: a context limit that truncates instead of failing

Baidu ships the model with its own patched build of SGLang, an open source inference server (the program that loads the weights and answers HTTP requests). By default it reads in windows of 10 pages, freeing memory for pages that leave the window. A switch turns windowing off so the model sees all 59 pages together. The context, meaning everything the model can hold at once, is 131,072 tokens, and the page images alone used about 89,000 of it. Output ended halfway through page 27, and the server only wrote this to its log:

Requested token count (89331 input + 472000 new) exceeds the model's context length (131072 tokens). Truncating max_new_tokens. 

The cause is the --allow-auto-truncate server flag. From the client side the stream simply finishes. Your only defence is to count pages in the output, which is cheap because every page opens with a <PAGE> tag. Assert on it in every mode.

One window with crop_mode=false might fit (an 18,277-token prompt); untested.

What to measure, and how to get a free reference

A born-digital PDF grades its own OCR: the embedded text layer, the selectable text you can copy out, is an exact answer key. Our score was the share of characters you would need to edit to turn the model's text into that layer, so 0% is a perfect match. Two caveats. It punishes reading order, so a sidebar placed before its paragraph loses points with every word correct. And it needs a text layer, which scans lack; we tested no scans.

Why run a model when the text is already in the file? The layer has no reading order, no block positions, no HTML tables and no markers across page breaks. Those come from the model, and they need their own checks. Each run flagged 31 to 34 paragraphs as continuing on the next page. The big table still arrived as seven per-page pieces, but five of its six joins carried an append_table tag; the page 49 join was untagged. We never merged the pieces, so stitching is your code and your test.

Sizing the GPU: read the share, not the peak

SGLang reserves a fixed fraction of whatever GPU it lands on (70% unless told otherwise) and fills it with working memory. So the 19.4 GB peak on the 4090 measures that reservation, not the model's needs. A real 16 GB RTX 2000 Ada, a 70-watt workstation card, parsed the full guide with tiles off at a 13.8 GB peak and 5.6 pages per minute, 4.23% off the text layer, the same quality as the bigger card.

Scope: one 59-page English document, one request at a time. Baidu aims at hundreds of pages; its 100 to 300-page benchmark is its claim, not our measurement.

Credit

The model and paper are the work of Baidu's ERNIE team. Shu Wei, Jingjing Wu and Qunyi Xie are the core contributors, with Lingshu Zhang, Xiangcheng Du, Yannian Fu, Mengjie Wang, Zuyi Wang, Zhichao Liu, Yangliu Xu, Youyang Yin, Huanhuan Liu, YY and Yi Yang as contributors. It builds on their first Unlimited OCR and on DeepSeek-OCR, so the DeepSeek-OCR team shares the credit. The server is the SGLang project's, patched by Baidu and shipped in the Unlimited OCR 2 model card repository. We spotted it in the AI Search channel's 1 November news video, then wrapped that server in an API and checked what it returned on a real document.

The write-up with the VRAM ladder, server flags and the two open rough edges links an SDK example for your own NVIDIA card.

To compare your numbers with ours, start from the Unlimited OCR 2 whole-document parsing results on inferencekey.com.