Document AI

Document parsing: what it does, where it fails and how to test it

Parsing is the quiet step between a PDF and an AI system, and its mistakes usually get blamed on the model.

Open Dimension AI7 min read

What is document parsing?

Document parsing converts files such as PDFs, scans, forms and spreadsheets into structured text and data that software can use. It recovers reading order, tables and field values, not just characters. In an AI system it sits before retrieval or extraction, so its errors reach every answer built on top of it.

The short version

  • Document parsing converts PDFs, scans and forms into structured text and data that software can use.
  • OCR reads characters, while parsing also recovers reading order, tables and the link between a label and its value.
  • Parsing errors are quiet, because a shifted table still produces clean-looking text and raises no error.
  • Basic parsing can list at under a cent a page, so checking and fixing the output is often the larger cost.
  • The only reliable test of a parser is a field-by-field score on your own worst documents.

What does document parsing do?

Document parsing turns a file designed for human eyes into a structure a program can read. It recovers the text, the order it should be read in, and what each piece is: a heading, a table cell, a footnote or a form field. The usual output is Markdown, JSON or text tied to page coordinates.

The job exists because a document rarely stores what it shows. A PDF stores instructions for drawing characters at positions on a page. It does not reliably store paragraphs, columns or tables. A scan stores only pixels. A person sees a table at a glance. Software sees scattered fragments until something rebuilds the structure.

Take an invoice. The word 'Total' sits near a number, and a subtotal and a tax line sit near it too. Reading the characters gives you all of them. Parsing is what tells you which number belongs to which label.

How is document parsing different from OCR and data extraction?

OCR reads characters from an image. Parsing recovers the structure around those characters. Extraction pulls specific named fields out of that structure for a particular job. They are separate steps, and each one fails in its own way.

OCR is not always needed. A PDF exported from software usually has a text layer already, so the characters are available and the hard part is the layout. A scan or a phone photo has no text layer, so OCR comes first. Many products bundle these steps together, which is why the terms blur.

Which step does what?

StepTakes inProducesTypical failure
OCRImage of a pageCharacters and their positionsMisread characters, such as 0 for O
ParsingPDF, scan or office fileOrdered text, tables and headingsWrong reading order, shifted table cells
ExtractionParsed document and a list of fieldsNamed values, such as an invoice totalA real value taken from the wrong place
ValidationExtracted values and business rulesPass, fail or send to a personRules too loose to catch the error

What are the main ways to parse a document?

There are three main routes: read the file's own text layer, send pages to a hosted document service, or use an AI model that reads page images. The lines blur, because some of those models are sold as hosted services. A sensible system uses the cheapest route that works for each document type.

The choice changes how errors look. A classic OCR error often looks like an error: a garbled word or a stray symbol. A language model's error can read perfectly well, because the model is predicting likely text. That makes it harder to catch by eye.

The three routes at a glance

  • Text layer extraction: fast, cheap and repeatable, but it only works on files that have a text layer, and tables often come out flattened.
  • Hosted document services, such as Amazon Textract: little to run, but your documents leave your environment, so check how the vendor stores and uses them.
  • AI models that read page images, such as Mistral OCR 4 or olmOCR from the Allen Institute for AI: built for messy layouts, but they can produce fluent text that is not on the page.

Why does document parsing fail quietly?

Document parsing fails quietly because bad output still looks like valid text. No exception is raised when a two-column page is read straight across, or when a table shifts its values one column to the left. The pipeline finishes, and everything downstream treats the result as correct.

The common failures are structural. Multi-column pages get merged line by line. Tables that run across pages lose their header row, so the second page has numbers with no column names. Merged cells push values under the wrong heading. Footnotes land in the middle of a sentence. Stamps, signatures and handwritten notes disappear, even when they are the part that matters.

This is why parsing errors get blamed on the model. A language model given a shifted table will answer confidently from it, and the answer will point to a real document. Someone sees a wrong figure and concludes the model made it up. The model read what it was given.

Why does document parsing matter for AI agents?

Document parsing matters for AI agents because an agent acts on what it reads. In a search tool, a parsing error produces a wrong answer that a person might catch. In an agent, the same error can become a payment, a record update or an email to a customer.

So an agent needs more than text. Keep the page number and position of every extracted value, so a person can check the source in seconds. Validate values against rules the agent cannot talk its way around: line items should sum to the total, dates should fall in a sensible range, a supplier should already exist. Send anything that fails to a person.

Treat parsed text as untrusted input. A document can contain text written to instruct the model, and a parser will pass it along like any other text. Parsed content is data to read, never instructions to follow.

How much does document parsing cost?

Basic parsing can list at under a cent a page, but the per-page fee is rarely the biggest cost. Amazon's Textract pricing page works through plain text detection at $0.0015 per page. Mistral's OCR 4 launch announcement lists $2 per 1,000 pages with the batch discount and $5 per 1,000 pages for Document AI.

These figures are not like for like. They are the vendors' own list prices for different products. As plain arithmetic, 100,000 pages at those three rates comes to $150, $200 and $500. Check the rate for the feature you actually need, because plain text detection is not the same work as reading tables or forms. Prices also change, and the AWS page is undated.

Self-hosting changes the shape of the bill. The olmOCR developers publish a cost estimate for their own tool, but it rests on February 2025 GPU rental rates, is largely scaled up from a 1,288-page test, and covers plain text output only. Treat an estimate like that as a starting point, then add the cost of whoever keeps the system running.

The larger cost is usually people. Someone has to review exceptions, fix errors and maintain the pipeline as document formats change. Set a reviewer's hourly rate beside the prices above and the per-page fee stops being the interesting number. If you have no internal figure, the US Bureau of Labor Statistics publishes national median pay for bookkeeping clerks and for software developers.

How do you test a document parser?

Test a parser on your own worst documents and score it field by field. A demo on a clean sample tells you little, because it uses the easy pages. What you need to know is how the parser behaves on the faxed, rotated and multi-page material your business really receives.

Field-level scoring matters because a document-level pass hides the cost of errors. A document can be almost entirely right and still carry a wrong total. A missed address line and a wrong payment amount are not the same failure, so weight them by what each one would cost you.

A simple parser test

  1. Pull a few dozen real documents, and include the ugly ones: poor scans, phone photos, rotated pages and tables that run across pages.
  2. Write down the correct values by hand for the fields that matter. This is your answer key.
  3. Run each candidate parser and compare every field to the key, rather than reading the output by eye.
  4. Weight the errors by consequence, then check whether your validation rules catch them.
  5. Keep the set. Run it again whenever a vendor updates a model or your document mix changes.

When is document parsing not worth building?

Document parsing is not worth building when the data already exists somewhere in structured form. If a supplier portal has an export, or a partner can send a feed, take that instead. Parsing a PDF to recover data that started in a database is a last resort.

It is also a poor fit when volume is low enough for a person to handle comfortably, or when nobody will own the exceptions. Every parsing system meets documents it cannot handle. If no one is assigned to those, they pile up and people stop trusting the output.

Simple cases may not need an AI model at all. If every document comes from one system in one template, a small rules-based script is cheaper and easier to debug. Use the heavier tools when the layouts vary and that variety is the real problem.

Questions people ask

Is document parsing the same as OCR?

No. OCR reads characters from an image of a page. Document parsing goes further and recovers structure: reading order, headings, tables and the link between a label and its value. A scanned document needs both. A PDF exported from software often needs no OCR at all, because its text is already in the file.

Can we just send our PDFs straight to a language model?

You can for a prototype, and it often looks impressive. The problems appear at volume. You usually get no page coordinates to check against, no signal when text was skipped, and no easy way to tell a misread value from a correct one. Keep a parsing step you can inspect, so errors have somewhere to be found and fixed.

How accurate is document parsing?

There is no single honest figure. Accuracy depends on scan quality, layout, language and which fields you care about, so a number measured on someone else's documents says little about yours. Run candidates on a labelled set of your own documents and score each field. That result is the only accuracy figure worth planning around.

Should we use a hosted service or run a parser ourselves?

Start with a hosted service unless your documents cannot leave your environment. It is the fastest way to learn what your documents need. Self-hosting makes sense when data rules require it, or when volume is high and steady enough to justify the GPUs. Remember that self-hosting also means someone owns upgrades, capacity and failures.

Can document parsing handle handwriting and poor scans?

Sometimes, and you should assume it will be inconsistent. Legibility varies by writer and by scan, and models can return confident text for words nobody could read. Test on your real samples. Where handwriting carries something important, such as a signature date or a dosage, route it to a person rather than trusting the output.

What is the hard part of adding document parsing to a workflow?

Calling a parser is the quick part. The time goes into everything around it: collecting real samples, building an answer key, writing validation rules, designing the review queue and deciding who owns exceptions. If a quote for this work covers only the integration, ask what happens to the documents that fail.

Related on this site

Sources

  1. Textract Pricing Page, AWS's own list price, taken from a worked example for US West (Oregon); not a survey. The page is undated with a © 2026 footer. Another worked example on the page prices plain text detection at $0.0015 per page. · Amazon Web Services, data from 2026
  2. Mistral OCR 4 : SOTA OCR for Document Intelligence, Vendor's own list price from its launch announcement dated June 23, 2026; not a survey. The same page gives $2 per 1,000 pages with the batch discount and $5 per 1,000 pages for Document AI. · Mistral AI, data from 2026
  3. olmOCR: Unlocking Trillions of Tokens in PDFs with Vision Language Models, The developers' own estimate for their own tool, based on February 2025 GPU rental rates and largely scaled up from a 1,288-page test. Covers plain text output only. arXiv preprint with no peer-review venue shown. · Allen Institute for AI (Ai2), data from 2025
  4. Software Developers, Quality Assurance Analysts, and Testers : Occupational Outlook Handbook: : U.S. Bureau of Labor Statistics, Occupational Employment and Wage Statistics employer survey, built from a sample of about 1.1 million establishments pooled over three years. US national median for May 2025, excluding self-employed workers. · U.S. Bureau of Labor Statistics, data from 2025
  5. Bookkeeping, Accounting, and Auditing Clerks : Occupational Outlook Handbook: : U.S. Bureau of Labor Statistics, Occupational Employment and Wage Statistics employer survey, built from a sample of about 1.1 million establishments pooled over three years. US national median for May 2025. · U.S. Bureau of Labor Statistics, data from 2025
  6. 2025: The State of Generative AI in the Enterprise | Menlo Ventures, Survey of 495 US enterprise AI decision-makers, run with an independent research firm from November 7 to 25, 2025. Menlo is a venture investor whose report covers some of its own portfolio companies. · Menlo Ventures, data from 2025

Want someone to look at your workflow?

Thirty minutes, and we will tell you whether there is anything here worth building. Roughly half of these end with us saying not yet.

Book a 30 minute call