Skip to content

Article · 9 min read · Sep 18, 2026

AI document processing for invoices, contracts and forms

AI document processing combines three techniques: OCR to turn images into text, layout models to understand where values sit on a page, and language models to extract and interpret fields that vary between documents. The technique matters less than what surrounds it: validation rules that check extracted values against your own records, confidence thresholds that decide what a person sees, and a review queue somebody owns. Measure field level accuracy and the share of documents that pass without a human touch, not a single headline accuracy number.

Farzan AnsariCofounder, AI engineering lead

Key takeaways

  • OCR reads characters, layout models understand page structure, and language models handle documents whose wording and format vary; most production workflows use all three.
  • Validation against your own master data catches more errors than any accuracy improvement in the extraction step.
  • Confidence scores decide what a person reviews, so set the threshold per field and per consequence rather than one number for the whole document.
  • Measure field level accuracy and straight through processing rate, because a single document level accuracy figure hides where the problems are.
  • A packaged tool wins when your documents are standard and your systems are mainstream; a custom workflow earns its cost when validation, routing or approvals are specific to your business.

Every business runs on documents somebody has to read. An accounts payable clerk checks an invoice against a purchase order. A paralegal confirms a contract has every signature and the right renewal date. A leasing administrator reads an application pack and notes what is missing. The work is slow, it is repetitive, and it is where errors get made because attention drifts on the four hundredth page of the week.

What is AI document processing?

AI document processing is the automated reading of a document, the extraction of specific values from it, the checking of those values against rules or other systems, and the routing of anything uncertain to a person. Three techniques do the reading, and they are frequently confused with each other.

TechniqueWhat it doesWhere it is strongWhere it struggles
OCR (optical character recognition)Converts an image of text into machine readable charactersPrinted text, clean scans, high volume at very low cost per pageHandwriting, poor scans, and understanding what any value means
Layout modelsRecognize page structure: tables, key value pairs, selection marks, signatures, reading orderForms and invoices with repeating structure, multi column pages, tablesDocuments whose structure varies widely between senders
Language model extractionReads a document as text and returns named fields, summaries or answersVaried wording and layout, contracts, free text, judgment about which value is whichCost and latency at very high page volumes, and anything needing exact character fidelity

Production workflows normally use all three. OCR or a read model turns the page into text, a layout model supplies structure, and a language model resolves the fields that vary. Azure Document Intelligence, for example, offers a read model, a layout model, prebuilt models for invoices, receipts, identity documents, contracts, bank statements, pay stubs and tax forms, and custom models trained on your own labeled documents (Microsoft Learn).

The unit costs are low enough that they are rarely the deciding factor. Amazon Textract publishes $0.0015 per page for text detection, $0.015 per page for tables or queries and $0.05 per page for form extraction, at the first million pages a month (AWS). The expensive part is everything around the extraction.

Which documents are worth processing, by industry?

IndustryDocuments with the clearest caseWhat the workflow checks
LogisticsBills of lading, delivery notes, customs paperwork, carrier invoicesShipment references, quantities, charges against agreed rates
Professional servicesClient onboarding packs, engagement letters, supplier invoicesCompleteness, signatures, identity details, dates
Real estateLeasing applications, tenancy agreements, maintenance quotesMissing documents, income evidence, renewal and break dates
RetailSupplier invoices, purchase orders, product specification sheetsLine items against purchase orders, price and quantity mismatches
Fast moving consumer goodsDistributor orders, trade promotion claims, proof of performanceOrder lines against price lists and trade terms
TelecommunicationsService agreements, site access forms, field job sheetsRequired fields, authorizations, completion evidence

A useful filter: the strongest candidates are documents that arrive often, follow a recognizable pattern, and already get checked against something you hold in another system. Documents that arrive rarely, or that need professional interpretation rather than checking, belong lower on the list.

How do you keep the output trustworthy?

Extraction accuracy gets the attention. Validation does more of the work.

Validation rules

Every extracted field should be checked against something, not simply accepted.

  1. Internal consistency. Do the line items add up to the subtotal, and does the subtotal plus tax equal the total?
  2. Cross reference to your own records. Does this supplier exist, is this product code current, does the purchase order number match an open order?
  3. Format and range. Is the date plausible, is the currency expected, does the amount fall within normal bounds for this supplier?
  4. Business policy. Is the value within the approval limit, are the required signatures present, does the payment term match the agreement?
  5. Duplicate detection. Has this invoice number already been processed?

Most of the errors worth catching are caught here rather than by improving the model.

Confidence thresholds

A confidence score is the model's estimate, between 0 and 1, that a particular extracted value is correct. Microsoft explains that a confidence value of 0.95 indicates the prediction is likely correct 19 times out of 20, and that for scenarios where accuracy is critical, confidence can be used to determine whether to accept a prediction automatically or flag it for human review (Microsoft Learn).

Set thresholds per field rather than per document. A misread reference number on an internal note is an inconvenience. A misread bank account on a payment instruction is a loss. Microsoft's guidance for custom models is to target an estimated accuracy score of 80 percent or higher, and close to 100 percent for sensitive cases such as financial or medical records, with a human review stage added for critical workflows.

What does a good human review queue look like?

The review queue is where document workflows succeed or quietly fail. Four things make it work.

  • Everything the reviewer needs on one screen. The source page, the extracted values, what each value was checked against and why the item was flagged. A reviewer who has to open three systems will either approve everything or stop using the queue.
  • Correction that feeds back. When a reviewer fixes a value, that correction should be captured as a labeled example, so the pattern of errors is visible and fixable.
  • A named owner and a fallback. One person responsible, one backup, and a time limit before an item escalates.
  • Routing for uncertainty, not just failure. Send an item to a person when confidence is low, when a check contradicts another system or when a value falls outside expected bounds, not only when a step errors.

Design the queue to shrink. If the same three fields generate most of the exceptions, that is a fixable problem, whether through a better prompt, a custom model, a cleaner supplier record or a change to what you ask the sender for.

How does it connect to your ERP, CRM and document systems?

Extraction that ends in a spreadsheet has moved the work rather than removed it. The output has to land where the process continues.

  • Where documents arrive. A shared mailbox, a supplier portal, a scanner, SharePoint or Google Drive. Each needs its own permission scoping and a way to mark an item as processed.
  • Where the record is created. An ERP such as NetSuite, a CRM such as Salesforce or HubSpot, a practice management system or a ticketing tool. Check the API, the license tier that exposes it, and whether the write can be reversed.
  • Where the document is filed. The original should be stored with the extracted data attached and a link back from the record, so any value can be traced to the page it came from.
  • Where approvals happen. Keep people in the tool they already use. A workflow that forces staff into a new interface for one approval tends to lose them.

For the wider integration questions, connecting AI to your ERP, CRM and data warehouse covers access patterns and service accounts in more detail.

How do you measure accuracy and cost?

A single headline accuracy figure hides where the problems are. Track five measures instead.

MeasureWhat it tells you
Field level accuracyWhich specific fields are reliable and which are not, measured against a verified set
Straight through processing rateThe share of documents completed with no human touch
Exception rate by reasonWhy items get flagged, which shows what to fix next
Reviewer correction rateHow often a person changes a value the system was confident about
Cost per documentExtraction, model usage, platform license and the review time actually spent

Illustrative example: Consider a third party logistics provider processing carrier invoices. Around 4,000 invoices arrive monthly from roughly 60 carriers, in layouts that differ by carrier and change without notice. A workflow reads each invoice, extracts the shipment references, line charges and totals, matches them against the rates agreed with that carrier, and checks the shipments were actually delivered. Invoices that reconcile within a small tolerance go to a one click approval. Rate mismatches, unknown shipment references and totals above a set value route to a named auditor with the discrepancy highlighted. The team measures field level accuracy on the reference number and the total separately, tracks what share of invoices clear without a touch, and reviews the top three exception reasons every month.

Set the measurement plan before launch, and test against real historical documents with known correct outcomes, including the difficult ones. How to test AI before it touches your operations explains how to build that test set.

What are the data privacy questions to settle first?

Documents carry some of the most sensitive data a business holds: bank details, identity documents, salary information, commercial terms. Settle five questions before anything is built.

  1. Where is the document processed, and where is it stored? Enterprise cloud AI services publish commitments on this. Microsoft states that prompts, completions, embeddings and training data sent to models sold by Azure are not available to other customers, are not available to OpenAI or other model providers, and are not used to improve those models (Microsoft Learn). Check the terms of the specific service and deployment type you use.
  2. Who can see the extracted data? Extraction output inherits the sensitivity of the source. It should respect the same access rules as the document.
  3. What gets retained, and for how long? Agree a retention period for source documents, extracted values and logs, and who can delete them.
  4. What is logged? Keep a record of inputs, outputs, checks and approvals so any figure on a record can be traced back to a page.
  5. What could a document make the system do? The OWASP Top 10 for LLM Applications 2025 lists prompt injection and excessive agency among the leading risks (OWASP). A workflow that reads documents from outside your business should never act on instructions found inside them.

When is a packaged tool better than a custom workflow?

Buying is often the right answer, and a supplier who never says so is selling rather than advising.

SituationUsually the better fit
Standard invoices into a mainstream accounting systemAn accounts payable product with built in capture
Identity or expense documents in moderate volumeA prebuilt cloud model called from an existing workflow tool
One document type, one destination system, low consequenceA packaged tool or a no code flow configured in house
Many senders and layouts, with validation specific to your businessA custom workflow
Output must drive approvals, routing and records across several systemsA custom workflow
Strict residency, retention or audit requirements, or systems without APIsA custom workflow, often in your own AWS or Azure account

Three signals suggest a packaged tool has run out: the validation you need cannot be expressed in its rules, the exceptions it creates cost more than the extraction saves, or its per document price climbs faster than your volume.

How Kastling approaches document processing

Document intelligence is part of our AI Integration & Automation service: extracting and organizing information from documents, checking required fields, and routing incomplete or uncertain items for review. An engagement starts with a free discovery call about the documents, the checks they go through today and where they end up. For this kind of work a separately scoped paid audit is common, though not required for every project.

Before development we agree which steps run automatically, which need approval and who owns the exception queue. We test against real historical documents rather than tidy samples, connect the systems you already run instead of replacing them, and agree data access, retention and ownership up front. The team is founder led, with an AI engineering lead and AWS or Azure specialists brought in as the work requires.

Questions

How accurate is AI document processing?

There is no single answer, because accuracy depends on the field, the document quality and the document type. A printed invoice total on a clean PDF is close to solved; a handwritten note in the margin of a scanned delivery receipt is not. Ask any supplier for accuracy per field, measured on your own documents rather than theirs.

Do we need to train a model on our documents?

Often no. Prebuilt models already cover common types such as invoices, receipts, identity documents and contracts, and general language models handle varied layouts without training. Training a custom model is worth it for a proprietary form you process in volume where prebuilt extraction misses fields specific to your business.

What happens to documents that arrive as poor quality scans?

They should be detected and routed, not guessed at. A low confidence read on the source text is a signal to send the document to a person, or back to the sender with a request for a better copy. Build that path deliberately, because in most document sets it accounts for a meaningful share of the volume.

Can AI document processing handle contracts as well as invoices?

Yes, but the task is different. Invoices are about extracting a known set of fields and checking them against a purchase order or a supplier record. Contracts are about locating clauses, dates and obligations in varied language, where the useful output is a summary with a link to the exact clause so a person can verify it. Legal interpretation stays with qualified people.

How long does it take to get a document workflow into production?

It depends on how many document variants you have, how many systems the output must reach and how much review the process needs. The variable that moves the timeline most is not the extraction step, it is integration and the number of exception paths. A credible schedule comes out of scoping, so treat a fixed promise made before anyone has seen your documents with caution.

Sources

  1. Microsoft Learn: What is Azure Document Intelligence
  2. Microsoft Learn: Interpret and improve model accuracy and confidence scores
  3. AWS: Amazon Textract pricing
  4. Microsoft Learn: Data, privacy, and security for Foundry Models sold by Azure
  5. OWASP: Top 10 for LLM Applications 2025

One useful email a month.

New guides, tools and practical notes on putting AI to work. No sales sequences.

Bring us a workflow.

Tell us where the work slows down. We will help you see where to start.

Book a discovery call