Skip to content

Article · 10 min read · Updated Oct 22, 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 and CTO

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.

This guide is for finance, operations and IT leaders at companies of roughly 20 to 200 people. 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.

OCR vs layout models vs LLM extraction: which should you use for invoices and forms?

OCR, layout models and language model extraction read documents in different ways, and most production workflows use all three. Choose by document type and by how much the layout varies between senders.

TechniqueWhat it doesBest document typeWhere it is strongWhere it strugglesCost basis (list price)
OCR (optical character recognition)Converts an image of text into machine readable charactersPrinted text and clean scansPrinted text, clean scans, high volume at very low cost per pageHandwriting, poor scans, and understanding what any value meansPer page, for example $0.0015 for Amazon Textract text detection (AWS)
Layout modelsRecognize page structure: tables, key value pairs, selection marks, signatures, reading orderForms and invoices with repeating structureForms and invoices with repeating structure, multi column pages, tablesDocuments whose structure varies widely between sendersPer page, for example $0.020 for Textract tables and queries and $0.05 for forms (AWS)
Language model extractionReads a document as text and returns named fields, summaries or answersContracts, free text and varied layoutsVaried wording and layout, judgment about which value is whichCost and latency at very high page volumes, and anything needing exact character fidelityPer token, with published prices per million input and output tokens (Anthropic)

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.020 per page for tables and queries and $0.05 per page for form extraction, at the first million pages a month in the US West (Oregon) region, checked on 22 October 2026 (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 automate accounts payable invoice processing with AI, step by step?

Automating accounts payable invoice processing with AI follows six steps, and the validation and exception steps matter more than the extraction itself.

  1. Receive. Capture invoices from the shared mailbox, supplier portal or scanner, and mark each one as received so it is never processed twice.
  2. Read. Run OCR and a layout or language model to extract the supplier, invoice number, dates, line items, tax and total.
  3. Validate. Check totals add up, the supplier exists in your records, and the invoice number is not a duplicate.
  4. Match. Compare the invoice to the purchase order, and to the receipt where you use three way matching, within the tolerance finance has agreed.
  5. Route exceptions. Send mismatches, unknown suppliers and low confidence fields to a named reviewer with the discrepancy highlighted.
  6. Post and file. Write the approved invoice to the accounting system and store the original with a link back to the record.

How do you keep the output trustworthy?

AI document processing stays trustworthy through validation, which does more of the work than extraction accuracy.

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?

Validation rules catch many errors that a better extraction model would still miss.

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 out of 20 times, and that for scenarios where accuracy is critical, confidence can be used to determine whether to automatically accept the prediction 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 more critical automation workflows (Microsoft Learn).

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?

AI document processing connects to your ERP, CRM and document systems by writing its output where the process continues, because extraction that ends in a spreadsheet has moved the work rather than removed it.

  • 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 for AI document processing 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.

Automation priority scorer

List up to five processes and see them ranked for automation, with a score, the hours each takes today and the reason for its place.

Open the tool

Questions

How accurate is AI document processing?

No single accuracy figure applies, so measure field-level accuracy and the share of documents that pass without a human touch on your own documents. As a reference point, Microsoft suggests targeting an estimated accuracy of 80 percent or higher for custom extraction models and close to 100 percent for sensitive cases such as financial or medical records. A printed invoice total on a clean PDF is far easier than a handwritten note on a scanned delivery receipt, so ask any supplier for accuracy per field.

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 many document sets it is a real 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

Guide · 16 min read

AI workflow automation: a practical guide for operations teamsAI workflow automation puts AI models inside a defined business process to read, classify and prepare work, while fixed rules, integrations and named people handle the steps that must be predictable. It suits repetitive, document-heavy or request-heavy work such as intake, routing, document checks and approvals. This guide is for operations leaders at companies of roughly 20 to 200 people, mainly in the US and Canada: start with one measurable workflow, keep consequential approvals with an accountable person, and expand only once the numbers show it works.Read

Article · 10 min read

How to test AI before deployment: test set, acceptance criteria and shadow modeTesting AI before deployment means scoring it against real past cases, with the business owner agreeing in advance what counts as correct and what target must be met. Run it in shadow mode or a limited pilot before it can change anything, keep human review on consequential decisions, and rerun the same test set every time a prompt or model changes.Read

Article · 9 min read

How to connect AI to your ERP, CRM and data warehouseConnect AI to your ERP, CRM and data warehouse through the vendor's supported APIs, webhooks, event streams or an integration platform, not by writing straight to the database. Start with read access, send every write through a named approver until the workflow has proven itself, and check API limits, licenses, permissions and data quality before you commit to a design.Read

One useful email a month.

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

See how an idea becomes a working solution.

Explore how we scope, build and hand over AI projects, with clear decisions at each stage.