Practice 03 · AI Blog

Document extraction with LLMs: average accuracy hides the costly error

Document extraction with LLMs is no longer an integration project; it is a line of SQL. In Snowflake, the AI_EXTRACT function has been generally available since October 2025 and received an update on November 2, 2026 that, according to the vendor, improves average accuracy by 12.8% in relative terms and raises the limit from 125 to 1,000 pages per document. In Databricks, ai_extract gained a precision mode in August that reaches 94.7% average accuracy across roughly 9,000 test documents, seven points above the best alternative compared.

Those are good numbers. That is exactly why they mislead. The question is no longer "can we extract data from this contract?" but "how many errors do we accept, in which fields, and who catches each one before it reaches the ERP?". Whoever decides the project on the benchmark's average accuracy finds the answer in production, at month-end close.

Why average accuracy misleads in document extraction

Average accuracy is the share of fields extracted correctly, summed across all fields and all documents in the test. It is a useful metric for comparing models. It is a poor metric for predicting what happens in operations, for three reasons.

Errors compound per document. A typical operational document, such as a contract, insurance policy or lab report, has 15 to 30 fields of interest. With 94.7% per-field accuracy and 20 fields, the chance of a document coming out entirely correct is close to 34%, in a simple calculation that assumes independent errors. In practice errors cluster in some documents, which helps a little, but the order of magnitude does not change: most documents still have something for someone to look at.

Errors do not land on random fields. They concentrate where things are hard: dense tables, handwritten fields, crooked scans, an 80-page document with the information in an annex. Those are almost always the fields that matter, such as the total amount, the effective date, the penalty clause. The company name in the header rarely fails and rarely costs anything.

Errors look like correct answers. Traditional OCR fails by leaving the field empty or with visible garbage. A language model fails by filling in a plausible value: a date in the right format, a tax ID with the right number of digits, a total that looks reasonable. Without validation, nobody notices until the data causes damage in another system.

In LLM extraction, the dangerous error is not the empty field. It is the plausible value nobody checks.

What has really changed, and what stays the same

The change is real and large. Older capture systems required training a model per layout: every new supplier, every form revision, more rework. Now the schema is described in natural language ("invoice total, due date, list of items with quantity and price") and the same request works on documents the model has never seen. That cuts the entry cost from months to days.

The second gain is that extraction runs inside the warehouse, next to the data that will receive it. The PDF does not need to leave for a third-party API, and the result is born in a governed table, with access control and lineage. For anyone handling personal data under privacy law such as Brazil's LGPD, one fewer path for the document to travel is a concrete advantage.

What has not changed is production discipline. You still need a set of documents with known answers to measure against. You still need to validate the output before writing it to the target system. And a rule many companies forget still applies: if the data already exists in structured form, do not use an LLM to read it from an image. Brazil's electronic invoice (NF-e) comes as XML. Bank slips carry a machine-readable code line. Bank statements have return files. Using a language model to read the PDF of something that has a structured version is paying for inference to introduce errors.

When document extraction with LLMs pays off

The technology is worth most where the alternative is human typing of documents that have no structured version. Signs the use case is a good one:

  1. Varied layouts outside your control. Customer contracts, policies from different insurers, reports from different labs, receipts sent by third parties. Where there are dozens of formats, the LLM replaces per-template training.
  2. Volume that justifies the queue. Hundreds to thousands of documents per month. Below that, direct manual review is usually cheaper than building a golden set and validation.
  3. Verifiable critical fields. Values that can be checked against another source (customer master, purchase order, sum of line items). The more verifiable, the more safe automation.
  4. Error cost that review can absorb. Where an error caught in the queue costs an analyst a few minutes, not a regulatory fine with no chance of correction.

And the signs it is not: a structured version of the document is available, volume is in the dozens per month, a critical field has no way to be checked, or 100% accuracy is required without human review. In those scenarios, no precision mode solves the problem.

How to put document extraction into production without surprises

The sequence we apply on projects is short and almost always the same:

  1. Classify fields by cost of error. Separate critical (amount, date, tax ID), important (address, contact) and cosmetic. The accuracy target is per class, not a single one for the document.
  2. Build a golden set from real documents. 200 to 300 documents with human-verified answers, covering the layouts and scan quality that actually arrive. That is our own estimate of a minimum useful size, not a vendor rule. A public benchmark is no substitute: your bad document is different from the test's bad document.
  3. Measure per field and per document type. An overall 95% accuracy can hide 70% on a critical field from one specific supplier. If you use another model to compare free-text answers, remember that a consistent evaluator is not necessarily a valid one: calibrate the judge against human answers before trusting its score.
  4. Validate with deterministic rules. Check digits on tax IDs, line items summing to the total, due date after issue date, amount within the supplier's historical range, cross-check against the master data. Cheap rules catch a good share of the plausible errors the model produces.
  5. Use a confidence threshold and an exception queue. Snowflake's AI_EXTRACT can return a confidence score per field; where the platform does not offer one, the rules from the previous step play that role. Documents that pass the rules and sit above the threshold go straight through; the rest go to review. The queue design follows the same logic as a human in the loop who reviews exceptions, not everything: if the reviewer approves 98% of what they see, the threshold is wrong.
  6. Treat the model version as a dependency. Snowflake's November update applies automatically, with no SQL change, for accounts with cross-region inference enabled. It improved the average, but it may have changed behavior on one of your fields. Re-run the golden set at every switch, as with any LLM model retirement or swap in production.
  7. Compute the cost per accepted document. Add inference, storage and minutes of human review, and divide by the documents that reached the target correctly. That number, not the price per page, is what you compare against manual typing.

The metric that matters is the human touch rate

The indicator that sums up the project is the straight-through processing rate: the share of documents that reach the target system with no human intervention and no error detected later. It combines accuracy, validation quality and threshold calibration into a number the CFO understands.

A practical reference, our own estimate and not a benchmark: on varied-layout documents with good deterministic validation, mature projects usually run at 60% to 80% straight-through processing, with the rest in a review that takes a fraction of the time of typing. That is a big gain. But it is very different from the "95% automated" that average accuracy suggests, and the project budget needs to reflect that difference from day one.

The goal is not to eliminate human review. It is to make every review count.

Questions that keep coming back

Common questions from teams evaluating AI to extract data from documents.

Can you use an LLM to extract data from PDFs safely?

Yes, as long as the output goes through validation before being written to the target system. In practice that means measuring per-field accuracy on a set of real documents, checking critical fields with deterministic rules and sending everything below a confidence threshold to human review. Running extraction inside the warehouse, as in Snowflake and Databricks, also keeps the document from traveling to external APIs.

How accurate is AI document extraction?

Vendors publish average accuracy between 90% and 95% on complex-document benchmarks, such as the 94.7% of Databricks' precision mode. That average is per field: on documents with 20 fields, most still come out with at least one error, concentrated in tables, handwriting and poor scans. The accuracy that counts is the one measured on your own document set, per critical field.

Is it worth using an LLM to read invoices?

For Brazilian electronic invoices, no: the NF-e already exists as structured XML, and reading the PDF with a language model only adds cost and error risk. LLM extraction pays off on documents with no structured version and varied layouts, such as contracts, insurance policies, lab reports and receipts sent by third parties.

Keep the conversation going

Want to discuss this topic with a partner?

Initial diagnostic with no commitment. We assess your scenario in a week and send back a report.

Talk to a partner