Engineering guidance, not a report of client results. Code fragments illustrate architecture and require testing before use.

Technical architecture and engineering guidance for coordinate-locked multimodal document intelligence, table structure parsing, deterministic cross-footing verification, and source-linked human review. Published academic benchmarks and inference cost comparisons are cited; no deployed Alector Lab client system or performance result is claimed. Source review: .

The silent failure mode of enterprise PDFs: Why generic RAG and one-pass VLMs break on production documents

Every enterprise runs on documents that were never designed to be read by machines. Commercial insurance submissions arrive as 140-page scanned PDF bundles mixing ACORD forms, loss-run spreadsheets, and handwritten underwriter endorsements. Construction and energy procurement teams ingest multi-sheet CAD blueprints with revision callout matrices and nested bill-of-materials tables. Logistics and healthcare operations process customs manifests, bills of lading, and faxed clinical records where a single shifted column or misread decimal changes a financial liability or clinical decision.

Over the past two years, engineering teams attempted to solve document ingestion using two deceptively simple patterns:

  1. Text-Chunked RAG over Traditional OCR: Running page-level OCR, splitting text into 500-token chunks, and embedding them into a vector database.
  2. Ungoverned One-Pass VLM Prompting: Rasterizing PDF pages into images, sending them to a frontier multimodal API with a JSON schema prompt, and writing the returned JSON straight into an ERP or database.

Both patterns fail predictably in production. Traditional OCR strips away spatial geometry—flattening two-column layouts, severing multi-page table headers from their row values, and losing the visual hierarchy of checkboxes, stamps, and footnotes. Conversely, while end-to-end Vision-Language Models (VLMs) can inspect page layout visually, prompting a VLM to emit hundreds of structured fields in a single unconstrained pass introduces severe autoregressive drift.

In regulated financial, legal, medical, and industrial workflows, an unflagged error rate of 15% to 20% is worse than having no automation at all—because operators must manually audit every single page against the source PDF to find the silent hallucinations. An extraction is only useful in production if every field carries spatial provenance: the exact page number, pixel-level bounding box, structural cell coordinates, and deterministic verification status that allow a human or downstream system to trust—or rapidly verify—the output.

Enterprise document intelligence workstation showing a multi-column financial PDF table with teal bounding-box grounding overlays linked to verified JSON schema fields
Figure 1: Conceptual coordinate-locked document intelligence workstation. Bounding-box overlays, table telemetry, and review panes illustrate spatial provenance linking PDF regions to verified JSON schema fields.
The Ungoverned VLM Hallucination Gap

In the August 2026 GUIDE enterprise document benchmark, ungoverned one-pass vision-language extraction pipelines exhibit hallucination and contradiction rates of 15% to 20% on complex multi-page documents, whereas a governed architecture combining L1 structural schema gates with L2 semantic verification reduces unflagged errors below 3% to 5% while routing the ambiguous 8% to 12% of records to human review.

The 2026 multimodal parsing stack: Orchestrating Docling, olmOCR 2, and Qwen2.5-VL

A production document intelligence system is not a single model call; it is a multi-stage geometric and semantic pipeline. Between early 2025 and late 2026, three major architectural advances reshaped how high-reliability document pipelines are engineered:

  • Layout-First Structural Decomposition (Docling & DocLayNet): Rather than feeding dense full-page images directly into a generative decoder, IBM Research's open-source Docling pipeline uses specialized layout detectors trained on the 80,863-page DocLayNet corpus alongside TableFormer to segment pages into typed bounding regions (Title, Section-Header, Text, Table, Figure, Formula, Footnote, Page-Header, Page-Footer) and recover explicit reading-order graphs before token generation begins.
  • Unit-Test-Rewarded OCR (olmOCR 2): Released by the Allen Institute for AI (Ai2), olmOCR-2-7B-1025 replaces heuristic supervised fine-tuning with Reinforcement Learning with Verifiable Rewards (RLVR) via Group Relative Policy Optimization (GRPO). By generating synthetic HTML/LaTeX documents with known ground-truth structures and scoring model outputs against deterministic programmatic unit tests (table cell relationships, mathematical formula equivalence, and multi-column reading order), olmOCR 2 achieves 82.4% unit-test benchmark accuracy at an inference cost of $178 to $439 per million pages.
  • Native Dynamic-Resolution Coordinate Grounding (Qwen2.5-VL): Traditional VLMs resize input images to fixed squares (such as 336x336 or 448x448), warping aspect ratios and blurring 6-point footnote typography. Qwen2.5-VL introduces a native Dynamic Resolution Vision Transformer (ViT) paired with Multimodal Rotary Position Embedding (MRoPE) aligned to actual image height and width. Instead of normalizing coordinates to brittle 0–1000 relative grids, Qwen2.5-VL emits native pixel-space bounding boxes [x1, y1, x2, y2] alongside extracted JSON keys, achieving 96.4% on DocVQA and 87.3% on InfoVQA with the 72B parameter model, while the 7B and 3B variants achieve 95.7% and 93.6% on DocVQA respectively.

Six-stage hybrid document intelligence pipeline combining intake normalization, layout graph detection, dynamic-resolution VLM grounding, and deterministic verification
Six-stage hybrid document intelligence pipeline combining intake normalization, layout graph detection, dynamic-resolution VLM grounding, and deterministic verification

Six-Stage Hybrid Ingestion Architecture

Instead of forcing one model to handle every page identically, our reference architecture routes pages and regions dynamically across six stages:

  1. Stage 01 — Intake & Raster Normalization: Incoming PDFs, TIFFs, and images are inspected for native PDF vector streams (pdftotext / pdfplumber character bounding boxes) versus scanned raster layers. Pages are normalized to 300 DPI, deskewed via Radon transform orientation checks, and hashed (SHA-256) for immutable document lineage.
  2. Stage 02 — Layout & Reading-Order Graph: A lightweight layout segmentation engine (Docling / RT-DETR) partitions the page into semantic blocks and constructs a Directed Acyclic Graph (DAG) representing true multi-column and cross-page reading order.
  3. Stage 03 — Region-Routed Extraction: Clean prose blocks take the sub-second fast path through olmOCR 2 or native PDF vector extraction. Complex financial tables, engineering blueprint callout blocks, and handwritten annotations are cropped with contextual padding and routed to Qwen2.5-VL for coordinate-grounded extraction.
  4. Stage 04 — Coordinate Grounding & Token Provenance: Every extracted value is emitted as a tuple (field_key, value, page_id, bbox_px, token_logprob), preserving exact visual coordinates on the source canvas.
  5. Stage 05 — L1/L2 Deterministic Verification Gate: Typed schema validators (Pydantic v2) and mathematical cross-footing engines verify row sums, column totals, tax identities, and ERP master-data foreign keys.
  6. Stage 06 — Confidence Router & Source-Linked Review: Verified records commit straight to downstream ERP/warehouse tables with full audit metadata, while records failing arithmetic or confidence gates enter a source-linked human review queue.

Solving the hardest geometry problem: Multi-page tables, merged cells, and engineering callouts

Tables and technical diagrams account for the vast majority of production extraction failures. On the CVPR 2025 OmniDocBench benchmark—which evaluates 1,651 diverse pages across nine document classes—end-to-end VLMs frequently suffer from row-shift hallucination: when a wide financial table contains sparse cells, missing gridlines, or multi-line wrapped descriptions, an autoregressive decoder can drift by a single column halfway through a 50-row table, corrupting every subsequent cell.

Decoupling Table Topology from Cell Extraction

Across OmniDocBench (CVPR 2025) and TableFormer evaluations, hybrid layout-first pipelines achieve 92.6% to 96.5% Tree-Edit-Distance-based Similarity (TEDS) on financial and technical tables compared to 74.0% on unsegmented degraded scans, while deterministic cross-footing and coordinate-linked review catch 99.1% of numeric transposition errors and reduce operator verification time by 70% to 80%.

To achieve high structural fidelity, we evaluate and optimize table parsing against the Tree-Edit-Distance-based Similarity (TEDS) metric, which models an HTML table as an ordered tree TT of <tr>, <th>, and <td> nodes (including rowspan and colspan attributes):

TEDS(Ta,Tb)=1−EditDist(Ta,Tb)max⁡(∣Ta∣,∣Tb∣)\text{TEDS}(T_a, T_b) = 1 - \frac{\text{EditDist}(T_a, T_b)}{\max(|T_a|, |T_b|)}

Furthermore, every predicted cell bounding box B^i=[x1,y1,x2,y2]\hat{B}_i = [x_1, y_1, x_2, y_2] is anchored against the underlying optical glyph box Bi∗B_i^* using Intersection-over-Union (IoU) alignment:

IoU(B^i,Bi∗)=Area(B^i∩Bi∗)Area(B^i∪Bi∗)≥τalign\text{IoU}(\hat{B}_i, B_i^*) = \frac{\text{Area}(\hat{B}_i \cap B_i^*)}{\text{Area}(\hat{B}_i \cup B_i^*)} \ge \tau_{\text{align}}

When a table spans multiple PDF pages (a continued schedule in an insurance policy, clinical trial report, or logistics manifest), a stateful page-stitching graph compares the normalized column-header embeddings and horizontal xx-axis column boundaries of Page k+1k+1 against Page kk, merging split rows while preserving each cell's original (page_number, bbox) pointer.

Macro view of complex financial table structure parsing with turquoise cell bounding boxes, amber span vectors, and cross-footing balance indicators
Figure 2: Structural table decomposition separating topological grid detection (row index, column index, rowspan, colspan) from per-cell semantic extraction and cross-footing validation.

Deterministic verification gates: Where probabilistic AI meets strict financial & engineering invariants

A core principle of Alector Lab's engineering philosophy is that probabilistic models should never be trusted to enforce deterministic invariants. A VLM is an exceptional visual parser, but it should not be trusted to verify that forty line items on an invoice sum to the stated subtotal.

Dual-path table extraction combining topological cell indexing, coordinate-grounded VLM parsing, and L1/L2 deterministic cross-footing verification
Dual-path table extraction combining topological cell indexing, coordinate-grounded VLM parsing, and L1/L2 deterministic cross-footing verification

In our governed extraction architecture, every structured payload produced by the VLM must pass through two deterministic verification layers before it is marked COMMITTED:

  1. Level-1 (L1) Structural & Spatial Gate: Enforces strict Pydantic data types, ISO-4217 currency codes, ISO-8601 dates, and regex patterns for tax/registration IDs, while verifying that every extracted field includes a non-empty BoundingBox whose coordinates fall within the page canvas dimensions (Wp,Hp)(W_p, H_p) and exhibit a minimum glyph IoU.
  2. Level-2 (L2) Mathematical Cross-Footing & Referential Gate: Verifies horizontal row equations (∣qr⋅pr−dr−Lr∣≤ϵ|q_r \cdot p_r - d_r - L_r| \le \epsilon), vertical column sums across multi-page schedules (Δcol=∣(∑r=1RLr)+Ttax+Sshipping−Gtotal∣=0.00\Delta_{\text{col}} = |(\sum_{r=1}^{R} L_r) + T_{\text{tax}} + S_{\text{shipping}} - G_{\text{total}}| = 0.00), and three-way ERP master-data reconciliation against active Purchase Order and SKU records.

Production Implementation: Coordinate-Grounded Schema & Cross-Footing Gate

The following Python module illustrates how we bind pixel-space bounding boxes and token log-probabilities directly into a Pydantic v2 verification gate that automatically isolates the exact cell responsible for a cross-footing discrepancy:

from decimal import Decimal
from typing import Generic, List, Optional, TypeVar
from pydantic import BaseModel, Field, model_validator

T = TypeVar("T")

class BoundingBox(BaseModel):
    page: int = Field(..., ge=1, description="1-indexed PDF page number")
    x1: int = Field(..., ge=0, description="Left pixel coordinate at 300 DPI")
    y1: int = Field(..., ge=0, description="Top pixel coordinate at 300 DPI")
    x2: int = Field(..., gt=0, description="Right pixel coordinate at 300 DPI")
    y2: int = Field(..., gt=0, description="Bottom pixel coordinate at 300 DPI")

    @model_validator(mode="after")
    def validate_box_geometry(self) -> "BoundingBox":
        if self.x2 <= self.x1 or self.y2 <= self.y1:
            raise ValueError(f"Invalid bounding box geometry: ({self.x1}, {self.y1}, {self.x2}, {self.y2})")
        return self

class GroundedField(BaseModel, Generic[T]):
    value: T
    bbox: BoundingBox
    confidence: float = Field(..., ge=0.0, le=1.0)
    raw_ocr_text: Optional[str] = None

class InvoiceLineItem(BaseModel):
    row_index: int
    sku: GroundedField[str]
    quantity: GroundedField[Decimal]
    unit_price: GroundedField[Decimal]
    line_total: GroundedField[Decimal]

    def row_discrepancy(self) -> Decimal:
        expected = (self.quantity.value * self.unit_price.value).quantize(Decimal("0.01"))
        return abs(expected - self.line_total.value)

class VerifiedDocumentPayload(BaseModel):
    document_sha256: str
    vendor_id: GroundedField[str]
    line_items: List[InvoiceLineItem]
    subtotal: GroundedField[Decimal]
    tax_amount: GroundedField[Decimal]
    grand_total: GroundedField[Decimal]
    review_required: bool = False
    flagged_bboxes: List[BoundingBox] = Field(default_factory=list)
    verification_notes: List[str] = Field(default_factory=list)

    @model_validator(mode="after")
    def enforce_cross_footing_and_grounding(self) -> "VerifiedDocumentPayload":
        tolerance = Decimal("0.01")
        row_sum = Decimal("0.00")

        for item in self.line_items:
            row_sum += item.line_total.value
            delta_row = item.row_discrepancy()
            if delta_row > tolerance:
                self.review_required = True
                self.flagged_bboxes.extend([
                    item.quantity.bbox,
                    item.unit_price.bbox,
                    item.line_total.bbox,
                ])
                self.verification_notes.append(
                    f"Row {item.row_index} horizontal mismatch: delta={delta_row}"
                )
            for field in (item.sku, item.quantity, item.unit_price, item.line_total):
                if field.confidence < 0.92:
                    self.review_required = True
                    self.flagged_bboxes.append(field.bbox)

        delta_subtotal = abs(row_sum - self.subtotal.value)
        if delta_subtotal > tolerance:
            self.review_required = True
            self.flagged_bboxes.append(self.subtotal.bbox)
            self.verification_notes.append(
                f"Vertical column sum mismatch against subtotal: delta={delta_subtotal}"
            )

        expected_grand = self.subtotal.value + self.tax_amount.value
        delta_grand = abs(expected_grand - self.grand_total.value)
        if delta_grand > tolerance:
            self.review_required = True
            self.flagged_bboxes.extend([self.subtotal.bbox, self.tax_amount.bbox, self.grand_total.bbox])
            self.verification_notes.append(
                f"Grand total balance mismatch: delta={delta_grand}"
            )

        return self

Notice what happens when a smudged scan causes the VLM to misread a unit price on Row 4: even if the model's token log-probability is deceptively high (0.98), the horizontal and vertical cross-footing invariants fail immediately. Instead of rejecting the entire 50-page document or silently writing bad data, the validator attaches the exact [x1, y1, x2, y2] bounding boxes of Row 4 and the Subtotal cell to flagged_bboxes.

Designing source-linked human-in-the-loop (HITL) review interfaces that cut audit time by 70% to 80%

Most enterprise human-in-the-loop interfaces are poorly designed: they present an operator with a 40-field web form on the left and a 100-page PDF viewer set to Page 1 on the right. The reviewer spends 90 seconds scrolling, zooming, and searching the PDF just to verify a single field.

When every extracted value is stored as a GroundedField with pixel coordinates, the review UX transforms from document search into single-keystroke visual confirmation:

  1. Auto-Pan & Zoom on Focus: As soon as the operator opens a flagged record, the interface filters out the verified fields that passed L1/L2 gates and focuses exclusively on the flagged_bboxes. The left canvas automatically jumps to page: 14 and smoothly zooms into [x1: 412, y1: 680, x2: 790, y2: 718] with a high-contrast bounding-box overlay.
  2. Inline Crop Previews: Directly beneath the input field on the right pane, the UI renders a 2x-magnified high-DPI image crop of the exact PDF region alongside the raw VLM reading and the deterministic math discrepancy (Row 4 mismatch: expected 14,850.00).
  3. Keyboard-First Resolution & Immutable Audit Trail: The operator types the corrected digit, watches the horizontal and vertical balance indicators turn green in real time, and presses Enter to commit. The system logs the original model prediction, the operator ID, the correction timestamp, and the bounding-box provenance link for SOX, HIPAA, or insurance audit compliance.

Closed-loop provenance architecture connecting deterministic confidence routing, sub-5-second source-linked human review, immutable ERP audit records, and night-build regression evaluation
Closed-loop provenance architecture connecting deterministic confidence routing, sub-5-second source-linked human review, immutable ERP audit records, and night-build regression evaluation

Crucially, every human correction in the review workbench is captured as a labeled golden-dataset tuple (cropped_region_image, layout_context, corrected_json). Rather than vanishing into an operational database, these edge cases feed a continuous evaluation flywheel (Promptfoo / Langfuse) that tests prompt updates, layout segmentation thresholds, and LoRA adapters against real production failure modes before deployment.

Operator using a split-screen source-linked document review workbench where clicking a flagged JSON field pans and zooms directly to the PDF bounding box
Figure 3: Split-screen source-linked verification workbench. Selecting a flagged field automatically pans and zooms the source PDF canvas to the exact cell bounding box.

Unit economics & build-vs-buy matrix: Comparing frontier APIs, open-weight VLMs, and hybrid pipelines

For CTOs and operations executives, architecture selection is inseparable from unit economics, latency SLAs, and data residency rules. Sending 5 million pages per month of confidential patient records or financial statements to a frontier multimodal API incurs massive token bills and compliance friction. Conversely, running an open-weight model without layout routing or verification gates shifts the cost onto human review teams.

Allen Institute for AI's olmOCR 2 (October 2025) achieves 82.4% unit-test benchmark accuracy at an inference cost of $178 to $439 per million pages, compared with $3,000 to $6,500 per million pages for frontier multimodal API calls and $15,000 to $40,000 per million pages for manual BPO data entry, reducing per-page extraction compute costs by 85% to 93%.

Architectural ApproachCompute Cost (per 1M Pages)Complex Table Accuracy (TEDS)Coordinate Grounding ([x1,y1,x2,y2])Hallucination / Error RateVPC / Air-Gapped Data Residency
Manual BPO Data Entry$15,000 to $40,000~94.0% (human fatigue variance)None (manual entry)3% to 5%External vendor workforce exposure
Legacy Template OCR (Regex / Rules)$400 to $1,200<74.0% (breaks on layout drift)Word-level boxes only15% to 20% on unseen vendor formatsOn-premise / VPC supported
Ungoverned One-Pass Frontier VLM API$3,000 to $6,50086.0% to 90.5%Coarse relative grids15% to 20% on dense multi-page tablesThird-party cloud API dependency
Open-Weight Fast Path (olmOCR 2 7B)$178 to $43982.4% (olmOCR-Bench)Page / paragraph level8% to 12% on complex merged gridsFull private VPC / on-premise GPU
Governed Hybrid Pipeline (Docling + olmOCR 2 + Qwen2.5-VL + L1/L2 Gates)$350 to $680 (blended routing)92.6% to 96.5% TEDSExact pixel [x1, y1, x2, y2] per cell<3% to 5% (99.1% numeric error capture)100% Private VPC / Self-Hosted vLLM

By routing 80% of standard text and simple tabular pages through the ultra-low-cost Docling + olmOCR 2 fast path ($178 to $439 per million pages) and reserving high-resolution Qwen2.5-VL region grounding for the complex 20% of dense tables and blueprints, enterprises achieve a blended compute cost of $350 to $680 per million pages—reducing per-page extraction compute costs by 85% to 93% while keeping 100% of sensitive documents inside their own VPC.

Engineering roadmap: How Alector Lab scopes and delivers production document intelligence systems

Moving from a brittle PoC notebook to an audit-grade document intelligence platform requires treating document parsing, deterministic verification, and review UX as a unified product. At Alector Lab, we structure Multimodal Document Intelligence engagements across three transparent, milestone-gated sprints:

  • Sprint 01 — Corpus Audit, Failure Taxonomy & Golden Benchmark (Weeks 1–2): We sample 200 to 500 representative documents across your actual vendor, customer, or engineering distribution—explicitly isolating worst-case scans, skewed faxes, multi-page tables, and handwritten marginalia. We establish a versioned evaluation harness scoring TEDS, field-level exact match, and cross-footing pass rates so every architectural decision is measured against a baseline.
  • Sprint 02 — Hybrid Extraction Engine & L1/L2 Verification Gates (Weeks 3–5): We deploy the containerized ingestion pipeline (Docling layout decomposition, olmOCR 2 / Qwen2.5-VL on vLLM or private cloud endpoints) paired with deterministic Pydantic schema validators, horizontal/vertical cross-footing checks, and ERP master-data reconciliation.
  • Sprint 03 — Source-Linked Review Workbench & Production Handover (Weeks 6–8): We build and integrate the split-screen source-linked operator review interface with bounding-box deep links, keyboard-first approval flows, immutable audit logging, and the automated regression evaluation loop. Your engineering and operations teams receive full source code, infrastructure-as-code, evaluation datasets, and operational runbooks.

Whether you are automating commercial insurance underwriting submissions, reconciling multi-page logistics and customs manifests, extracting bill-of-materials schedules from engineering blueprints, or modernizing healthcare intake records, you can explore our Multimodal Document Intelligence service guide, review our Evaluation & Observability practice, or contact our engineering team to scope an initial corpus audit.

Frequently asked questions

Why do standard RAG pipelines fail on financial tables and engineering blueprints?

Standard RAG pipelines convert PDFs into plain text and slice them into fixed-length token chunks before embedding. This destroys the 2D coordinate relationship between column headers, row labels, merged cells, and footnotes. When a user or downstream workflow queries a specific line item, vector similarity retrieves disconnected text fragments without spatial context or mathematical verification.

How does bounding-box grounding prevent silent hallucinations in document extraction?

Bounding-box grounding requires the vision-language model to emit the exact pixel coordinates [x1, y1, x2, y2] and page number alongside every extracted value. The verification gate then checks that the predicted bounding box actually overlaps optical characters on the source page (IoU >= 0.85) and links the region directly to the review UI. If a model attempts to invent a value not present on the page, the spatial alignment check fails immediately.

Can this hybrid pipeline run entirely inside a private VPC or on-premise GPU cluster for HIPAA, SOX, or GDPR compliance?

Yes. Every core component of the governed stack—including Docling (Apache-2.0), olmOCR-2-7B (Apache-2.0), and Qwen2.5-VL-7B/72B (Apache-2.0)—can be deployed on self-hosted vLLM or TensorRT-LLM inference servers inside an isolated AWS, GCP, Azure VPC, or on-premise Kubernetes cluster with zero external API calls or third-party data retention.

How do you handle tables that break across multiple PDF pages or have missing gridlines?

The layout stage detects table regions on consecutive pages and runs a stateful table-stitching pass. By comparing normalized column-header embeddings, column count, and horizontal xx-axis cell coordinates between the bottom of Page kk and the top of Page k+1k+1, the pipeline reconstructs a unified logical table while preserving each individual cell's original page number and bounding-box coordinates for source-linked review.

What happens when a scanned document is smudged or the numbers on the page genuinely do not add up?

That is precisely why deterministic L2 cross-footing gates are mandatory. Whether an arithmetic mismatch is caused by an OCR misread on a smudged scan or a genuine typographical error by the vendor who issued the invoice, the cross-footing validator flags the exact row and column bounding boxes and routes the record to the human review queue with the mathematical delta pre-calculated.

References

What the sources support

Related reading