Sections
Document Extraction
Extraction is five layers. Each layer is engineered against your document taxonomy, accuracy requirements, and downstream integration surface. Substitution decisions are explicit and documented.

Reference deployment
Metric | Target | Reference Hardware |
Field-level accuracy (structured docs) | > 93% F1 on held-out test set | CPU sufficient for most pipelines; GPU accelerates high-volume OCR |
Processing throughput | 200–400 pages/min per worker | On-premise GPU server or 4-core CPU worker |
End-to-end latency (single doc, p99) | < 8 seconds | Synchronous API; async batch pipeline decoupled |
Human review queue rate | < 15% of documents | Confidence scoring drives selective escalation |
Bandwidth to cloud | 0 KB/s (optional event egress) | Air-gapped or VPC-isolated |
The five layers
1. Document ingestion and normalization
Default stack: Apache Tika for format detection and conversion; Ghostscript for PDF rendering at configurable DPI; OpenCV for image pre-processing (deskew, despeckling, contrast normalization, orientation correction).
When we substitute: PDFium for high-fidelity PDF rendering where layout precision matters; custom pre-processing pipelines for specific scan degradation patterns (thermal fax artifacts, photocopied handwriting, watermarked templates).
Tradeoffs: DPI vs throughput (200 DPI is faster; 300 DPI recovers more handwriting and small fonts). Whether to normalize all inputs to a single raster format or preserve vector PDFs for layout-aware downstream processing.
2. OCR and text extraction
Default stack: Tesseract 5 (LSTM engine) for general-purpose OCR; PaddleOCR for multilingual and rotated-text scenarios; native PDF text extraction (pdfminer / pdfplumber) for machine-generated PDFs where available — always prefer native text over OCR when the PDF has an embedded text layer.
When we substitute: EasyOCR for handwriting-heavy pipelines; TrOCR (transformer-based OCR) for degraded historical documents; Google Document AI or AWS Textract in hybrid deployments where data governance permits cloud inference for specific document types.
Cost surface: OCR is the most compute-intensive step for scanned documents. For machine-generated PDFs, native text extraction is an order of magnitude cheaper and more accurate.
3. Layout analysis and document understanding
Default stack: LayoutLMv3 for document classification and layout-aware field extraction; DiT (Document Image Transformer) for layout segmentation; rule-based table reconstruction for structured forms with consistent grid geometry.
When we substitute: Donut (end-to-end document understanding without explicit OCR) for controlled document types; LLM-based extraction (GPT-4V, Claude) for long-tail document types where training a dedicated model is not cost-effective.
The failure mode: layout models trained on public benchmarks (DocBank, PubLayNet, FUNSD) perform well on academic papers and standardized forms. Real enterprise documents have layout patterns not present in any public benchmark. The gap between benchmark accuracy and field accuracy is the gap between a demo that wins a pilot and a deployment that gets cancelled.
4. Field extraction and normalization
Default stack: Named entity recognition (fine-tuned BERT/RoBERTa) for entity-level extraction; regex-anchored extraction for high-confidence structured fields (dates, currencies, account numbers); LLM-based extraction for semantically complex fields (obligation text, clause summaries, contextual date resolution).
When we substitute: Pure LLM extraction with structured output via function calling for document types where the field schema is ambiguous or highly variable. Template-based extraction for document populations where layout variance is low and training data is scarce.
Normalization layer: extracted values pass through date standardization (ISO 8601), currency normalization, entity resolution, and address normalization. This layer is where extraction output becomes data-warehouse-ready.
5. Validation, confidence scoring, and human review routing
Default stack: Per-field confidence scores; cross-field validation rules (invoice total = sum of line items; date ranges are coherent; required fields are present); business-rule validation (invoice amount within expected range for supplier).
Human review routing: Documents below configurable confidence thresholds, documents that fail validation rules, and documents flagged as novel layout types route to a human review queue. Reviewer corrections feed back into the training loop. Every document that exits the pipeline has either a confidence record or a human sign-off record.

The hard problems we plan for
Layout variance at scale
A production AP automation pipeline might process invoices from 3,000 distinct suppliers over a year. We address this through layout-agnostic architectures (LayoutLMv3, Donut) rather than template-matching approaches that require per-supplier configuration.
Handwriting and degraded scans
OCR accuracy on printed text and handwriting are different numbers. We benchmark them separately and report them separately.
Low-data document types
For a new document type with 50 training examples, a few-shot LLM outperforms a fine-tuned model. For a mature type with 10,000 labeled examples, the fine-tuned model outperforms the LLM at lower cost and higher throughput. We choose based on data availability.
Schema evolution
We architect extraction schemas as versioned contracts, not hardcoded field lists — schema changes don't require pipeline rebuilds.
Concept drift
Drift detection — comparing confidence score distributions and validation failure rates against a baseline — fires before your downstream data quality metrics catch the problem.
One architecture, five operational profiles
The underlying extraction pipeline is one system, not five. What changes across verticals is the document taxonomy, the validation rules, and the downstream integration surface.
Vertical | Daily Volume | Latency Budget | Accuracy Priority | Typical Downstream |
Finance & AP | High | < 10 s | Field accuracy, PO matching | ERP / EAP systems |
Legal & Contracts | Low–Med | Minutes–hours | Clause precision, entity resolution | CLM, data warehouse |
Healthcare | Med | < 30 s | Coding accuracy, PII compliance | EHR / claims systems |
Insurance | High | < 60 s | Straight-through rate, audit trail | Core insurance platforms |
Logistics | High | < 15 s | Field accuracy, multi-language | TMS / WMS / customs |
Deployment topology
On-premise GPU server (T4 / A10 / L4, or AMD MI-series). Standard for enterprise document pipelines where document sensitivity precludes cloud processing. 200–400 pages/min per GPU worker.
CPU-only worker cluster. Viable for pipelines dominated by machine-generated PDFs. 40–80 pages/min per 4-core worker. Cost-effective at moderate volume.
Hybrid. CPU cluster handles ingestion and native text extraction; GPU workers handle OCR and layout models for scanned documents only.
Air-gapped. Full pipeline with no outbound network. Right for regulated environments — legal, government, defense.
Deployment via Docker / Kubernetes with GPU operator, or systemd units for bare-metal environments. We don't lock you into our orchestration layer.

.png%3F2026-04-10T15%253A24%253A23.357Z&w=3840&q=100)




