Extracting data from documents with AI
Before connecting document extraction to a system, define which fields matter, how to verify them, and what happens when a value is missing or conflicting.
Define an output you can check
Pick one document type, such as an order form. The sample requires an order number, a date, and a quantity. Store the source page with each value so someone can verify it in the original document.
Specify how dates and quantities are represented in the destination. Leave a missing field empty and flag it for review. If two values conflict, show both to the reviewer with their source locations.
Compare extraction with the expected result
In fictional order PO-104, the first page shows an order number, the date 2026-11-02, and a quantity of 12. The expected output contains the three values with their source page. A second document with no quantity should have an empty quantity and a review flag.
The evaluation examples file contains the fictional text and expected outputs. Use it to check the output format and how exceptions move to review.
Review the fields before updating a system
Test different layouts, a low-quality scan, and a document with a required field missing. Check fields against the source and record whether each was accepted, corrected, or sent for review.
During a pilot, keep extraction results as drafts. An authorized person can approve an update after checking the original. Verify that a document submitted twice produces one draft or goes to review, according to the rule you set.
Which documents suit extraction?
| Area | Easier | Harder |
|---|---|---|
| Structure | A fixed form that repeats | Invoices from many suppliers, each laid out differently |
| Quality | A digital PDF | A phone photo, a skewed scan or handwriting |
| Language | One language | Mixed Hebrew and English, with numbers inside right-to-left text |
| Tables | A table on one page | Rows that break across pages |
Start with the easiest type that repeats most often, and add types once it works.
How do you know extraction is good enough?
Measure by field, not by document. A document with nine of ten fields right still needs fixing. For each field, decide what a mistake costs: amounts, dates and account numbers need high accuracy and a person’s check, while a notes field can pass with sample checks. Once the critical fields come out right consistently on new documents, not only on the examples the system was tuned on, you can reduce checking.
A document extraction brief
- Document type
- Choose one format and prepare authorized test examples.
- Output format
- Specify field names, types, required fields, and source page references.
- Exception rules
- Decide how to flag missing values, conflicting values, and unreadable documents.
- Approval
- Name who can approve a system update and how to identify a repeated document.