Blog

AI Document Processing: a production pipeline from file to ERP data

An IDP architecture for invoices, contracts and scans: ingestion, OCR, classification, field extraction, validation, confidence, human review and CRM or ERP export.

2026-07-25

IDP is a workflow, not one model

Intelligent Document Processing turns an unstructured file into verified data and a business action. The pipeline includes document intake, file and security checks, OCR, classification, field extraction, validation rules, human review and writing to a CRM, ERP or document workflow system.

An LLM can help with diverse layouts and descriptive fields, but it does not replace OCR or accounting rules. Tax IDs, gross totals, currency and line-item consistency require deterministic checks. The system must be able to stop a document instead of inventing a missing value.

Ingestion and document preparation

Sources include upload, email, scanner, API or an exchange folder. Every file receives a document ID, checksum, tenant, source and timestamp. Malware scanning, size limits, MIME detection and deduplication happen before processing.

Preprocessing improves quality through rotation, deskew, denoising, package splitting and blank-page detection. The original remains unchanged in storage while derived artifacts are versioned. This makes a result reproducible after a model or rule change.

OCR, classification and extraction

OCR returns text with page coordinates and confidence. A classifier identifies the document type, then an extractor applies its schema: an invoice has supplier, dates, amounts and line items; a contract has parties, term, obligations and clauses. One universal prompt for every document is difficult to test and usually reduces quality.

Extraction output should include the value, confidence, page and source region. A reviewer must be able to see where a field came from. For tables, preserve row relationships and control totals rather than treating every number as an independent text fragment.

Validation and human in the loop

Validation combines syntax and business rules: tax ID format, net plus tax equals gross, approved currencies, known vendor, purchase order in the ERP and duplicate invoice detection. Model confidence is only one signal; a confident reading can still be impossible in the business process.

Send documents to human review when confidence is low, rules conflict or financial risk is high. The UI shows the image, highlighted source and proposed value. Corrections become evaluation data, but should not train a model automatically without quality control.

Export, audit and metrics

After approval, an adapter writes data to the target system with an idempotency key. States such as received, processing, review, approved, exported and failed allow the pipeline to resume after failure. The audit log connects the document, model versions, rules, reviewer corrections and target ERP record.

Measure field accuracy by field type, straight-through processing rate, review share, handling time, cost per document and export failures. OCR accuracy alone does not describe business value: the outcome is a correct ERP record and a fast explanation of every extracted value.

FAQ

Can an LLM replace OCR?
Not in every pipeline. Multimodal models help with difficult layouts, but production IDP still needs coordinates, confidence, validation and repeatable extraction.
When should a document go to human review?
When confidence is low, rules conflict, the document type is unknown or financial risk is high. Thresholds should vary by field and process.
How do you prevent duplicate posting?
Use checksums, business keys, duplicate checks in the ERP and an idempotency key during export.

Name and contact are enough for the first step. A task description is optional.