Document
extraction
Methods for extracting text, tables and data from PDFs and scanned documents, and how to choose between them.
Press → to start · O for overview · N for notes

"What is the best way to extract the contents of these PDFs?"
This is a frequent client question. The answer depends on the following factors.
Agenda
How we got here
The main developments since 1993, and why several approaches remain in use.
How each approach works
How each approach works internally, with real examples.
Who the players are
About 70 options, what they cost, and where they can run.
How they are measured
The main benchmarks, who runs them, and their limitations.
Where the frontier is
Quality against cost for everyday pages, hard pages and field extraction.
What to recommend
A decision guide, default picks, and how to test on a client's own documents.
Three questions for comparing approaches
Where do the characters come from?
- From the text already stored in the PDF
- From a model that recognises characters in an image
- From a model that reads the page image and generates the text
Where does the structure come from?
- Rules based on where text sits on the page
- Separate models that find headings, columns and table cells
- Learned inside one large model, with no separate step
What can you check afterwards?
- The exact position of every character
- A box and a confidence score for each word or block
- Sometimes only the final text, with no way to trace it back
Development of document extraction, 1993–2026
- 1993PDF format launched. ABBYY FineReader 1.0.
- 2005HP open-sources Tesseract OCR. Google backs it from 2006.
- 2014–18Python PDF tools: pdfminer.six, pdfplumber, Camelot.
- 2018Tesseract 4 switches to a neural network (LSTM).
- 2019AWS Textract and Azure Form Recognizer launch. Microsoft publishes LayoutLM.
- 2020Google Document AI.
- 2021–22Donut reads pages without OCR. DocLayNet and TableFormer from IBM.
- 2023Meta's Nougat turns papers into markup. GPT-4V can read images.
- 2023–24Datalab releases Marker and Surya. IBM releases Docling. MinerU appears.
- FebolmOCR (AI2): about $176 per million pages.
- MarMistral OCR API at $1 per 1,000 pages.
- OctPaddleOCR-VL, DeepSeek-OCR, olmOCR 2, Chandra.
- MarChandra 2. dots.mocr turns charts into code.
- May–JulSurya 2, Marker 2, Mistral OCR 4 with word confidences.
- OctChandra 2.5 returns chart values as tables. Gemini 3.8 Flash tops a major benchmark.
Five families of approach
PDF text libraries
Read the text the PDF already contains, then rebuild lines, columns and tables using rules about position.
pdfminer · Camelot
≈ free
Classic OCR
Find lines and words in an image, then recognise the characters one line at a time.
PaddleOCR (PP-OCR)
≈ free to cheap
Cloud document services
OCR plus trained models for layout, tables and form fields, sold per page by the big clouds.
AWS Textract · Google Document AI
$1.50–$50 / 1k pages
Specialist document models
Small models trained only on documents. Some are pipelines of several models; others are a single model that converts the whole page image to text in one step.
MinerU · PaddleOCR-VL · olmOCR · Mistral OCR
$0.10–$15 / 1k pages
General vision language models
Large general-purpose models that take a page image and return text or JSON, following instructions.
$0.50–$80 / 1k pages
How a digital PDF stores text
1. Payment 2. Termination The Client shall pay all Either party may end this invoices within 30 days agreement with 90 days' …
1. Payment The Client shall pay all invoices within 30 days of the invoice date. 2. Termination Either party may …
How PDF libraries reconstruct structure




- The characters stored in the file, with exact positions, and no new recognition step
- Milliseconds per page on a laptop, so millions of pages cost almost nothing
- Completely repeatable and easy to audit
- Scans with no text layer, or a poor hidden OCR layer
- Text layers that are garbled, incomplete or wrong
- Columns, headers and footnotes in the wrong order
- Tables without ruling lines, and tables that span pages
- Maths, and files with broken font maps
olmOCR-Bench figures from the Marker README (Datalab, vendor-run)
How classic OCR works
Cloud document services and pricing

Azure, AWS and Google offer similar services. Each layer is a separately trained model, and each costs more per page.
List prices per 1,000 pages, first volume tier, checked 22 Oct 2026. Azure Retail Prices API, AWS Price List, Google Document AI pricing page.
- Boxes and confidence on everything
- Runs inside the client's own cloud
- Mature, with service agreements
- Complex financial tables, charts, maths
- Output is a large JSON graph to walk
- Costs add up as you add layers
Two influential research results
Using word positions as model input

A number to the right of "Total" is probably the total. Feeding positions into a language model made form and invoice extraction much better.
Generating output directly from the image

This switched the task from recognising characters to generating text. It handles difficult pages better, but it can also produce text that is not on the page.
Three designs of specialist model
A pipeline of small models
Separate models for layout, tables, formulas and OCR, joined by code. Uses the PDF's own text where it can.

Layout first, then read each block
Find the blocks on a small, low-resolution copy of the page. Then read each block at full resolution.

A single model converts the whole page
A small vision language model (1–9 billion parameters) takes the page image and outputs the full page as markdown or HTML, often with block positions.

Images: IBM Docling (MIT), OpenDataLab MinerU2.5 (arXiv 2509.22186), Datalab Chandra 2 blog. Click to zoom.
The stages of a document pipeline





Images: Datalab Surya README (GitHub). Surya 2 (May 2026) now does layout, OCR and tables in one 650M-parameter model, and gives each block a confidence score.
Reducing the number of tokens per page


DeepSeek-OCR (Oct 2025) tested how few tokens are needed to represent a page.
Compare a general model, which uses 560 to 2,700 image tokens per page. Fewer tokens reduce cost and processing time. Together with smaller models, this explains why self-hosted costs are now $0.10–0.70 per 1,000 pages in GPU time.
How a general model reads a page
Cost per page for general models
| Model family | Image tokens per page | How it is counted |
|---|---|---|
| Gemini 3.x | 560 (PDF) · 1,120 (image) | Fixed per page. PDF text is free. Google says OCR quality "typically saturates" at 560. |
| Claude 5.5 | ~2,700 | One token per 28×28 pixel patch, up to 4,784 |
| GPT-5.4 and later | ~2,500 | 32×32 patches × 1.2 |
| DeepSeek-OCR | 64–400 | Compressed by design |
US Letter page at 150 DPI. Our arithmetic from each provider's documented formula, Oct 2026.
Strengths of generative models

"axes": "x: year; y: salary ($)", "data": "<table>… 2010 | ~66,000 …", "description": "Average salary fell, then recovered…"
Chart data extraction
Values are read off the axes, marked "~" when estimated. OCR can only return the axis labels. Example from Chandra 2.5, a specialist model; general models such as Gemini and Claude handle the same cases. Image: Datalab blog.

Handwriting and forms
Handwriting, ticked boxes, stamps and photographs of documents. Training on large and varied data allows these models to read partly legible words. Example from Chandra, a specialist model. Image: Datalab README.
{
"party_a": "Acme Ltd",
"party_b": "Example Services LLC",
"notice_period_days": 90,
"payment_terms_days": 30,
"governing_law": null,
"auto_renews": null
}
// null = not stated on the page.
// Never default a missing value to false.
Direct extraction of specified fields
Fields from the slide 7 contract. Use the provider's structured-output mode with a schema: the output then matches the schema's format, but values can still be wrong and responses can be refused or cut off. Validate before use.
Weaknesses of general models

Datalab anti-hallucination blog, vendor-run
| What happens | Why |
|---|---|
| It corrects the text | The model favours likely words, so it corrects typos, normalises dates and fills gaps. |
| It leaves things out | It hits its output limit, skips repeated rows or summarises. The request still succeeds: check the finish reason and compare row counts. |
| It repeats itself | It can loop on dense or unusual pages. |
| It misreads small print | The page image is reduced to fit the model's size limit, which can make small text illegible. |
| Errors on long documents | When many pages are sent in one request, content from different pages can be mixed up. Parse page by page, then combine the results and reconcile values that span pages. |
| No confidence scores | The output does not show which parts are uncertain, so reviewers cannot tell where to check. If asked for word or block locations, the model generates approximate coordinates rather than measuring them from the page. |
| Results change | Providers update models under the same name, and outputs can differ between runs even at temperature 0. |
Verification features in recent tools

- Use the PDF's own text when it is good. Only read pixels where it is missing or broken. (Marker, Docling, Gemini and Claude with PDF input)
- Detect layout at low resolution and read text at full resolution. (MinerU, PaddleOCR-VL)
- Small model to transcribe, large model only for meaning. (Marker with an LLM, Google Layout Parser)
- Check, retry and flag uncertainty. Re-read doubtful blocks and mark text "[illegible]" instead of guessing. (Datalab)
- Return source positions. Mistral OCR 4, Chandra and Docling all return boxes, so a reviewer can see where each value came from.
Comparison of the five families
| PDF text libraries | Classic OCR | Cloud services | Specialist models | General VLMs | |
|---|---|---|---|---|---|
| Digital PDFs | ●●●●● | ●●●●● | ●●●●● | ●●●●● | ●●●●● |
| Scans and photos | ●●●●● | ●●●●● | ●●●●● | ●●●●● | ●●●●● |
| Complex tables | ●●●●● | ●●●●● | ●●●●● | ●●●●● | ●●●●● |
| Charts and handwriting | ●●●●● | ●●●●● | ●●●●● | ●●●●● | ●●●●● |
| Positions you can check | ●●●●● | ●●●●● | ●●●●● | ●●●●● | ●●●●● |
| Risk of invented text | None | Very low | Low | Low to medium | Medium |
| Cost per 1,000 pages | ≈ $0 | ≈ $0 | $1.50–50 | $0.10–15 | $0.50–80 |
| Pages per second | 100s–1,000s | ~0.2–50 (CPU) | Async batches | 1–7 per GPU | Rate limited |
Our summary judgement from the research in this session, not a benchmark result. Ratings are for a typical good tool in each family.
Products, models and where they run
Price per 1,000 pages
List price per 1,000 pages, standard (not batch) tier, checked 22 Oct 2026. General model costs are our estimate: one US Letter page at 150 DPI, 300 prompt tokens, 800 output tokens, no thinking. Self-hosted costs are GPU time only, using publisher throughput at $2.50 per GPU hour.
Licence and pricing considerations
Licence restrictions on open models
| Model | Restriction |
|---|---|
| Marker, Surya (Datalab) | Model weights free only if revenue and funding are under $5M |
| Chandra (Datalab) | Free only under $2M, and not to compete with Datalab's API |
| MinerU | Needs a commercial licence above $20M monthly revenue |
| HunyuanOCR (Tencent) | Licence excludes the EU, UK and South Korea |
| Nanonets-OCR2 | No licence stated; base model is research-only |
| PyMuPDF | AGPL: closed products need a paid licence |
Options with permissive licences: Docling, PaddleOCR-VL, olmOCR, DeepSeek-OCR, dots.ocr, GLM-OCR, LightOnOCR, Qwen3-VL.
Scheduled and recent price changes
- Gemini 3.8 and 3.6 Flash double on 1 January 2027 ($0.75 → $1.50 per million input tokens).
- Gemini 4 Argon doubles on 1 December 2026.
- GPT-5.6 Sol is on a promotional price until at least 21 November 2026.
- Mistral OCR has gone from $1 to $2 to $4 per 1,000 pages across three versions.
- Batch APIs from OpenAI, Anthropic, Google, Mistral and Bedrock halve prices for jobs that can wait.
- Thinking tokens are charged as output and can multiply a general model's cost by 2–5×.
Licences from GitHub READMEs, Hugging Face model cards and the Datalab pricing FAQ. Prices from vendor pricing pages, 22 Oct 2026.
Options by cloud provider
Azure clients
- Document Intelligence: Read, Layout, prebuilt and custom models
- Content Understanding (generative)
- Mistral OCR 4 and Mistral Document AI in Foundry (confirm the hosting option and region)
- GPT models in Azure OpenAI
- Claude in Foundry, using the hosted-on-Azure option
AWS clients
- Textract: OCR, layout, tables, forms, queries
- Bedrock Data Automation
- Claude, Qwen3-VL, GPT-6 Astra, Nova on Bedrock
- DeepSeek-OCR and Upstage deployed into your account through SageMaker
- Billing only, vendor-hosted: Reducto, LlamaParse and Unstructured on AWS Marketplace
Google Cloud clients
- Document AI: OCR, Layout Parser (uses Gemini; some versions use a global endpoint), Form Parser, custom extractors
- Gemini (only available here)
- Claude on Vertex AI
- DeepSeek-OCR and an older Mistral OCR in Model Garden
How benchmarks score results
Payment within 30 days.
Payment within 30 days.
Whether this is correct depends on the scoring method.
| Method | How it works | Verdict here | Used by |
|---|---|---|---|
| Edit distance | Count the characters you would need to change to match the answer key | Penalised for "**" and the missing ".00" | OmniDocBench |
| Pass/fail tests | Hundreds of small checks: "is this text present?", "does A come before B?", "is this value in the cell under this heading?" | Text present: pass. Exact amount: fail | olmOCR-Bench, OmniParseBench |
| Table similarity | Compare the structure of rows, columns and cells as a tree | Not a table, not scored | OmniDocBench, ParseBench, RD-TableBench |
| Field accuracy | Extract named fields to JSON and compare values | total_due = 4250: pass | ExtractBench, OmniExtractBench |
| Judges and votes | An LLM or people pick the better of two outputs | Likely preferred for its formatting | OCR Arena, older Datalab pages |
The main benchmarks
| Benchmark | Run by | Independent? | What it tests | Size | Latest | Cost shown? |
|---|---|---|---|---|---|---|
| OmniParseBench | Datalab | Vendor | Text, tables and layout as pass/fail tests, tagged by difficulty | 16,288 tests, 2,937 pages, 92 languages | Oct 2026 (new) | Yes |
| ParseBench | LlamaIndex | Vendor | Tables, charts, content, formatting, grounding on enterprise documents | ~2,078 pages, 148 systems | Live, Oct 2026 | Yes |
| ExtractBench | LlamaIndex + Kaggle | Vendor | Fields to JSON, short to long documents | 370 docs, 4,869 pages | Live, Oct 2026 | Yes |
| olmOCR-Bench | AI2 | Semi | Pass/fail tests on papers, old scans, tables, maths | 1,403 PDFs, 7,010 tests | Frozen 2025; now saturated | 2025 plot |
| OmniDocBench | OpenDataLab (MinerU team) | Mostly | Text, reading order, tables, formulas | 1,651 pages, ~50% Chinese | v1.6, Sep 2026 | No |
| OCRBench v2 | HUST and partners | Yes | Recognition, extraction, parsing, with a private test set | 10k public + 1.5k private | Quarterly, Sep 2026 | No |
| IDP Leaderboard | Nanonets | Vendor | OCR, tables, key fields, Q&A | Combines 3 benchmarks | Mar 2026 | Some |
| RD-TableBench | Reducto | Vendor | Complex tables | 1,000 tables | 2024 | No |
| RealDoc-Bench | Extend | Vendor | Answering questions from parsed real documents | 581 docs | Jun–Aug 2026 | Yes |
| DocVQA / DocVQA 2026 | CVC Barcelona | Yes | Answering questions about documents | 50k Qs / 160 Qs | Saturated / Sep 2026 | No |
| OCR Arena | Extend | Vendor | People vote between two outputs | User uploads | Live | No |
Research pack C, checked 22 Oct 2026. Full tables and links in the repository.
Datalab's OmniParseBench
- Nov 2025. Datalab says olmOCR-Bench is saturated. When Gemini re-checked failed tests, Chandra's score rose from 85.5 to 93.9. Many failures were caused by errors in the tests.
- Oct 2026. Datalab launches OmniParseBench: 16,288 pass/fail tests, open scoring code, and every system's result on every test published.
- Two views. The headline measures reliability on typical content. Tags (handwriting, degraded, rotated, tiny text, non-Latin) show the very hard cases.
OmniParseBench pass rates by slice, run 8 Oct 2026. Slices computed by our researcher from Datalab's public per-test results file. * Gemini 3.8 Flash and Claude Sonnet 5.5 helped create some tests.
Strengths and limitations of benchmarks
| Benchmark | Publisher | Leading product on cost frontier |
|---|---|---|
| OmniParseBench | Datalab | Datalab |
| OmniExtractBench | Datalab | Datalab |
| ParseBench | LlamaIndex | LlamaParse |
| ExtractBench | LlamaIndex | LlamaExtract |
| IDP Leaderboard | Nanonets | Nanonets OCR-3 |
| LongExtractionBench | micro1 for Reducto | Reducto |
| RealDoc-Bench | Extend | Extend |
Limitations
- Tuning to the benchmark. Datalab moved its small Surya model from 23rd to 3rd on ParseBench with 70 training steps. A prompt change gave another vendor 22.6 points.
- Saturation. Top systems on olmOCR-Bench are within 2 points; on OmniDocBench within 1. Differences of this size are within noise.
- Unrepresentative documents. Most are English, academic or from the publisher's own customers.
- Model involvement in test creation. Gemini and Claude helped write some OmniParseBench tests.
- Limited cost data. Only vendor boards show it, from single runs at list price.
- Few long documents. Most test single pages. Plain model calls score 5–38 on ExtractBench's long documents.
Method for the frontier charts
Everyday reliability
Is the text all there, in the right order, on typical pages?
ParseBench content faithfulness
Hard pages
Handwriting, poor scans, rotated or tiny text, and complex tables.
ParseBench tables
Field extraction
Named fields to JSON from business documents, short to long.
- An index, not a percentage. 18 systems appear on both benchmarks. We rescale each benchmark to the same average and spread on those systems, then average. The two agree only partly (correlation 0.40 on everyday pages, 0.75 on hard pages), so check the separate views.
- Own products at half weight. Datalab on its own benchmark, and LlamaParse on its own, count half. This only matters when a product appears on both benchmarks.
- Hollow dots appear on one benchmark only. They can lead the chart, so tick "Both benchmarks only" to see the better-supported frontier.
- Cost. List price for products. GPU time for self-hosted models. For general models, the token cost each benchmark actually paid, which includes "thinking".
- Why not blend extraction? The extraction benchmarks share too few systems to put on one scale.
- Near the frontier. Dashed rings mark options within 1 point of the frontier. Treat these as practical ties; the benchmarks do not publish uncertainty ranges.
Frontier: everyday reliability
Frontier: hard pages
Frontier: field extraction
ExtractBench is run by LlamaIndex, whose product tops it. On Datalab's OmniExtractBench, Datalab (93.9) and Reducto (93.5) lead, with Claude Opus 5 at 91.0.
Conclusions
Decision guide
Default picks by situation
| Situation | Start with | Test against | Watch out for |
|---|---|---|---|
| Digital PDFs, mostly text, high volume (search, RAG) | Text-layer tool (pymupdf4llm, Docling) and send only failed pages to a model | Mistral OCR 4 ($4) or Datalab balanced ($4) | Columns and headers in the wrong order; PyMuPDF's AGPL licence |
| Mixed scans and tables, documents must stay in Azure | Azure DI Layout ($10) | Mistral OCR 4 in Foundry ($4; confirm hosting and region); Claude Sonnet 5.5 in Foundry (hosted-on-Azure option) for hard pages | Azure DI Layout scores 42% on handwriting and 50% on non-Latin text |
| Mixed scans and tables, documents must stay in AWS | Claude Haiku 5.5 on Bedrock ($1–2) | Textract Tables ($15); Textract Forms when you need key–value pairs with boxes ($50) | Reducto and LlamaParse on AWS Marketplace are vendor-hosted, so documents leave your account |
| Mixed scans and tables, documents must stay in Google Cloud | Gemini 3.8 Flash with low thinking ($4–7) | Gemini 3.1 Flash-Lite ($3); Document AI Layout Parser for chunks ($10) | Gemini 3.8 Flash prices double on 1 Jan 2027; some Layout Parser versions use a global endpoint |
| Handwriting and poor scans matter most | Datalab accurate ($10; $13 with word boxes) | Gemini 3.8 Flash or Claude Sonnet 5.5 ($30–37 as benchmarked); LlamaParse Agentic Plus ($56) | Datalab's word confidence scores measure reading, not field correctness. General models give no reliable confidence scores |
| Charts and diagrams matter most | LlamaParse Agentic ($12.50) | Claude Opus 5.5 ($33–60) | The hard-pages chart does not measure charts; ParseBench (run by LlamaIndex) does. Chart values read off axes are estimates |
| Data must stay on the client's own machines | dots.mocr (MIT) or MinerU2.5-Pro | Chandra 2 (licence needed above $2M revenue), or a vendor on-premises deployment (Datalab, Reducto) | MinerU needs a commercial licence above $20M monthly revenue or 100M monthly users. Small models drop 10–30 points on handwriting and non-Latin text |
| Fields from short documents (invoices, forms) | A general model with a structured-output mode, plus validation rules | Reducto Extract, LlamaExtract or Datalab extract (94–96 on ExtractBench short documents) | Gemini 3.8 Flash scores 88 on short documents. Structured output constrains the format, not the values; record missing fields as missing |
| Fields from long documents (contracts, 100+ pages) | A vendor extraction pipeline (LlamaExtract, Reducto Deep Extract), or a cloud pipeline that parses, extracts, then reconciles across pages | A coding agent (Claude Code, Codex) for unusual one-off jobs | Plain model calls score 5–38 on long documents. Evaluate on whole documents, including amendments and tables that span pages |
| Auditors need to see where each value came from | Extraction that returns each field with its page region: Azure DI custom extraction, Textract Queries, Document AI Custom Extractor, LandingAI ADE, Reducto | Docling (free) plus matching each value to its source text | Text positions alone do not show which occurrence supports a field. Check repeated, reformatted and inferred values |
Our judgement from the benchmarks and prices in this session, dated 22 October 2026. Prices per 1,000 pages at list price.
Testing on client documents
Sample
Sample whole documents, not just pages: short, medium and long ones, including the most difficult 10%. Keep some back as a held-out check.
Create reference answers
Only for the fields, totals and tables the client will use, not for every word.
Test three options
A cheap baseline, the default pick and a premium option. Use the same pages and settings for all.
Measure
Field and table accuracy, omissions, rows dropped at output limits, values that depend on other pages, cost at the real volume, and speed.
Route
Send simple pages to a low-cost option, difficult pages to a stronger option, and low-confidence results to human review.
Repeat
Re-run every quarter. Prices and model quality change every few months.
Sources and further reading
All prices and scores as of 22 October 2026. Third-party images are credited on each slide and used for internal teaching.
Discussion questions
- Which client document problem would you run through the decision guide?
- Where have you seen a model alter text that it should have copied exactly?
- What should we test ourselves, on our own documents, before the next client asks?
Next session: web search and research agents · All sessions