Back to experience

INFRRD

Document AI

OCR-Coordinate Extraction Pipeline

A rework of INFRRD’s in-house extraction product, replacing full-document LLM calls with an OCR-coordinate pipeline and a validation layer.

97%
field extraction accuracy, up from 86%
~98%
true-positive accuracy on critical tables

Problem

The existing table extraction approach fed full documents to an LLM in one shot, which caused cell shifting and misalignment on dense, multi-page closing disclosure tables.

Solution

Reworked the pipeline to use OCR coordinates to crop each table individually and feed only the relevant page-level context to the model, then added a post-processing validation and correction layer to catch residual model errors.

Architecture

A Python-based product wrapper consumes and publishes extraction tasks over RabbitMQ, coordinating OCR coordinate detection, per-table LLM extraction, and validation before results are returned to the extraction product.

Engineering decisions

  • Cropped, coordinate-driven inputs instead of full-document prompts to cut hallucination and misalignment
  • A dedicated validation/correction pass rather than trusting raw model output on critical fields
  • RabbitMQ-backed request/response flow to keep the service decoupled and resilient

Technology

Python · FastAPI · RabbitMQ · Docker · AWS · OCR

Results

  • 86% → 97% field extraction accuracy
  • ~98% true-positive accuracy on critical closing-disclosure tables

What Daniel learned

Production LLM extraction needed engineering around the model, not just a better prompt. Validation layers and constrained inputs mattered as much as the model itself.