OCR or AI for invoices and acts: choosing a data extraction approach
Data extraction from an invoice or act starts with an approved document set and a field list, not a fashionable model. OCR helps turn a scan into text and coordinates. AI can handle varied formats and explain uncertain passages, but its output still needs a source, a confidence rule and human review. The controlled teaching run below is not a commercial accuracy benchmark.
Define the outcome and boundary first
Invoices and acts can contain personal data, payment details and contract terms. Before uploading anything, choose approved samples, an owner and the route for uncertain results.
- Outcome
- For example, extract document number, date, supplier tax ID, line items, total and tax for employee review. A JSON object alone does not prove field correctness.
- Approved material
- Use fictional documents or material with explicit permission for the first run. Do not send customer databases, contracts, tokens or bank files to an unverified service.
- Human owner
- Assign a person who compares the original with extracted fields, fixes exceptions and decides whether a record can move forward.
If you cannot name who accepts an uncertain field and what happens after a failure, choosing a technology is premature.
Compare OCR, templates and AI by behavior
Compare the same documents, fields and acceptance rules, rather than product names.
- OCR
- An image or scan becomes text, sometimes with coordinates and character confidence. A number-reading error is not fixed because the output looks tidy.
- Template parser
- Anchors, regular expressions and format rules fit stable layouts. They are explainable and predictable, but break when the layout changes.
- AI extraction
- A model can map varied wording to a field and flag uncertainty. Use a restricted schema, source references, refusal on missing data and protection from invented values.
- Combination
- A sensible route can recognize text first, apply rules and send only exceptions to AI. This is easier to test and bound by cost.
No approach has universal accuracy. Results depend on language, scan quality, tables, stamps, layout and field rules.
A teaching run on 12 synthetic documents
The archive for this article contains 12 fictional invoices and acts. They contain no real credentials. Each document has an expected field set, type and reason for human review.
- Set
- All 12 files are plain text: 4 invoices, 4 invoices with declared character substitutions, 2 acts and 2 documents missing a fictional tax ID. The archive contains no scans or OCR.
- Fields
- Number, date, tax ID, subtotal, tax, total and currency. Missing fields are not guessed.
- Two passes
- Two identical runs read files, normalize declared substitutions and validate dates, tax ID presence and arithmetic. Results and exact expected decision IDs are reconciled.
- Result
- Expected set: 7 documents ready for human handoff, 3 requiring a total or date check, and 2 excluded from automated handoff because a required field is missing.
The archive script runs locally on Python 3 with no network or external calls. It checks the arithmetic of the teaching set and rule stability. It does not run OCR, call a model or measure a real service.
Download synthetic documents and the local check, ZIP · Download the acceptance checklist, TXT
Accept extracted fields with explicit checks
Acceptance should catch errors that matter to your workflow. A count of extracted rows is not a result criterion without validation rules.
- Format checks
- Date, currency, tax ID and number pass syntax checks. A format failure becomes an exception instead of a guessed value.
- Arithmetic checks
- Line totals, tax and grand total are reconciled with an agreed rounding rule. A mismatch goes to a human.
- Source reference
- Each field keeps the document and passage used to extract it. Manual changes are recorded separately.
- Refusal
- A required field is missing, rows conflict or the document cannot be read. The system returns a clear status and does not silently pass it onward.
Test positive and negative examples. Measure human review time and the share of documents that cannot move without a person.
Estimate the process, not one API call
Cost depends on formats, volume, integrations, human review and retention. A model call price does not describe the whole workflow.
- Preparation
- Clean and label an approved set, define the schema, list exceptions and agree the owner.
- Extraction
- OCR, rules, a model or a combination, including retries and document-size limits.
- Control
- An exception queue, review interface, decision log, retry path and responsible-person notification.
- Operations
- Storage of originals and results, rule updates, monitoring, spending limit, manual fallback and support.
Start with one document type and a few required fields. Full audit, pilot, development and support have a separately agreed scope and price.
Start a controlled pilot
The initial discussion is free. A synthetic example and a description of the current operation are enough to begin.
- One process
- Who receives the document, which fields are needed and where the record goes after review.
- Example set
- Prepare approved or fictional invoices and acts, including a poor scan, a table and a document with a missing field.
- Stop rule
- Decide which errors require review, what spending limit is acceptable and who decides whether to continue.
If the pilot has no source reference, explainable status or clear exception route, automating the entire stream is premature.
Official sources
Checked 12 November 2026. Official sources explain OCR, document text extraction and the need to test a specific service. They do not validate the teaching run or promise a BYstudio result.