bidulelabs
Back to Bidule Labs
Benchmark

deterministic-doc-pipeline

Offline local-AI document extraction benchmark comparing a raw local LLM against a hybrid Docling + Python Decimal validation pipeline across industrial RFQs, BOMs, and official semiconductor datasheets.

  • Python
  • Docling
  • Ollama
  • Decimal
  • Pytest (61/61)
0.0%
Silent RFQ pass-through
89.0%
Digital-only datasheet F1
76–77 tok/s
Local M4 Pro throughput
0 KB
External network egress
3-stage local pipeline
Local runtime · 127.0.0.1 loopback0 KB egress
Stage 01 · 0 KB EgressMulti-page RFQs, vendor datasheets & BOM tables
Stage 02 · Decimal + SI15 × 124.50 = 1867.50 ≠ 1967.50 → caught & retry guarded
Stage 03 · Pytest 61/61Typed JSON or needs_human_review · deterministic leaf-field eval

Local Document Input

Multi-page RFQs, BOM tables, and semiconductor datasheets stay strictly on localhost with remote services disabled.

LOCAL FILESYSTEM · OLLAMA_NO_CLOUD=1 · 0 KB EGRESS

Constrained Inference + Deterministic Code

Local layout/OCR (Docling) and schema-constrained extraction paired with Python Decimal arithmetic, SI unit allowlists, and bounds ordering checks.

DOCLING + SCHEMA EXTRACTION · DECIMAL & SI UNIT GUARDRAILS

Verified JSON or Quarantine

Outputs verified typed JSON or explicit needs_human_review quarantine, benchmarked with 100% deterministic leaf-field ground-truth scoring.

TYPED JSON · QUARANTINE QUEUE · ZERO LLM-AS-A-JUDGE

Problem

Generic LLM wrappers routinely hallucinate numeric values, swap Min/Typ/Max table columns, or pass arithmetic discrepancies silently downstream when parsing multi-page RFQs, BOM tables, and semiconductor datasheets. This open-source experiment tests a strict architectural split: local multimodal layout parsing and constrained LLMs read document structure, while deterministic Python (Decimal, SI unit allowlists, bounds checks, and source grounding) owns all arithmetic and quarantine decisions.

Experimental Setup & Anti-Strawman Methodology

  • Hardware & Memory: MacBook Pro M4 Pro (48 GB Unified Memory) · ~25–26 GB combined RAM (~20 GB local Ollama inkling-2-mini daemon + 4.6–5.8 GB Docling / TableFormer / RapidOCR worker).
  • Deterministic Runtime: temperature=0.0, num_ctx=32768, OLLAMA_NO_CLOUD=1, enable_remote_services=False, hard 127.0.0.1 loopback guardrail, 61/61 automated pytest checks, and 100% deterministic leaf-field scoring (Decimal tolerance 0.0001, zero LLM-as-a-judge).
  • Anti-Strawman Split: Mode A (Raw Local LLM) reads pypdfium2 plain text with zero OCR. Digital-Only (zero OCR) and Scanned-Only (200 DPI tilted scans) splits are reported separately from Combined scores so OCR gains never mask native digital-PDF accuracy.

Denominator note: Silent numeric error denominators count numeric fields inside auto-accepted outputs; quarantined needs_human_review documents are excluded from silent pass-through, and the baseline occasionally hallucinates extra or duplicate rows.

Benchmark 01 — Industrial RFQs, BOMs & Supplier Quotes (rfq_bom)

Corpus provenance: 8 multi-page PDFs (16 pages, 53 line items; EUR, CHF, GBP, USD) — 1 external public industrial invoice (Hugging Face drew-ipp, 24 lines, USD) + 7 multi-currency EU/CH/UK test quotes including Swiss apostrophes (6'810.00), French/German comma-decimals, 3 tilted 200 DPI scans, and 1 digital quote with an injected 100 EUR arithmetic error.

Metric Mode A · Raw LLM Mode B · Hybrid Delta
Digital-Only Field F1 (5 PDFs, zero OCR) 96.6% 100.0% +3.4 pp
Digital-Only Silent Numeric Errors 7.3% (11/150) 0.0% (0/146) -7.3 pp
Digital-Only Human-Review Escalation 0.0% (0/5) 20.0% (1/5) 100 EUR typo quarantined
Scanned-Only Field F1 (3 tilted 200 DPI scans) 3.3% 99.2% +95.9 pp
Combined Field F1 (all 8 PDFs) 81.6% 99.8% +18.2 pp
Combined Silent Numeric & Unit Errors 31.5% 0.0% -31.5 pp across test suite
Median Speed / Latency 60.6 tok/s · 11.2 s/p 76.0 tok/s · 8.0 s/p 1.4× faster
Combined RAM (Ollama + Python Worker) ~20.1 GB ~24.6 GB +4.5 GB Docling/OCR
External Network Egress 0 KB 0 KB Air-gapped

Flagship safety verification — 100 EUR overcharge quarantined despite LLM retry: On a digital multi-page EUR quote containing an injected 100 EUR line-total error (15 × 124.50 printed as 1967.50 instead of 1867.50, printed subtotal 3149.50 EUR), the raw baseline passed the overcharge downstream. The hybrid pipeline caught the line-math mismatch on attempt 1, blocked the LLM on retry from silently fabricating an unprinted subtotal (3049.50), and quarantined the document as needs_human_review.

Benchmark 02 — Semiconductor & Hardware Datasheets (tech_spec)

Corpus provenance: 8 official vendor PDFs (8 pages, 67 visually audited parameters) — 5 digital + 3 tilted 200 DPI scanned spec-table pages sliced directly from official STMicroelectronics (LPS22HH), Bosch Sensortec (BME280, BMP390), Analog Devices (ADXL345), Texas Instruments (ISO1042), and onsemi (2N7002/NDS7002A) datasheets.

Metric Mode A · Raw LLM Mode B · Hybrid Delta
Digital-Only Field F1 (5 PDFs, zero OCR) 41.8% 89.0% +47.2 pp
Digital-Only Silent Numeric Errors 81.7% (76/93) 11.1% (6/54) -70.6 pp
Scanned-Only Field F1 (3 tilted 200 DPI scans) 0.0% 88.6% +88.6 pp
Combined Field F1 (all 8 PDFs) 33.8% 88.9% +55.1 pp
Combined Silent Numeric & Unit Errors 78.8% 13.1% -65.8 pp
Median Speed / Latency 52.4 tok/s · 60.5 s/p 77.3 tok/s · 18.7 s/p 3.2× faster
Combined RAM (Ollama + Python Worker) ~20.1 GB ~25.8 GB +5.7 GB Docling/OCR
External Network Egress 0 KB 0 KB Air-gapped

Per-Datasheet Highlights

  • STMicroelectronics LPS22HH (Digital): 60.9% → 100.0% F1 — 18/18 Min/Typ/Max column swaps resolved via layout parsing and bounds ordering checks.
  • Analog Devices ADXL345 (Borderless Digital): 2.4% → 88.2% F1 — recovered borderless parameter rows via bounded 1-retry self-correction.
  • Texas Instruments ISO1042 (Digital): 6.7% → 93.3% F1 — resolved multi-column electrical ratings with strict SI unit normalization.
  • Bosch Sensortec BMP390 (200 DPI Scan): 0.0% → 100.0% F1 — full recovery on a tilted 200 DPI scan where plain-text extraction scored zero.

Known Limitation & Trade-offs

Open edge case — stacked multi-condition cells in two Bosch I²C tables: Residual datasheet numeric errors (11.1% digital / 15.5% combined) stem from two Bosch I²C tables stacking four sub-conditions inside a single unruled visual cell. Generic table parsers hit a structural ceiling on unruled multi-condition layouts without custom table rules and dedicated regression fixtures.