Grounded document extraction SDK โ schema-valid JSON, evidence boxes, confidence scores. Runs locally on free models. No API key.
Field F1 0.870 on held-out SROIE receipts vs 0.376 for PP-OCR + heuristics and 0.227 for Tesseract + regex โ measured on the same 100 documents.
Each extracted value ships with the OCR span and bounding box it came from โ human-verifiable provenance, coverage 79.8%.
JSON Schema validation + sanitization on every result (validity 1.000 on eval), plus a calibrated confidence score per field.
Free ollama:qwen2.5vl:3b by default, quality tiers up to 7B, ONNX and OCR-fallback engines behind one interface.
pip install tinydoc โ Python SDK with Pydantic-typed results, CLI, and a local Gradio demo.
Apache 2.0 license โ free for commercial use. Local-first: no API key, no cloud, no telemetry.
Receipt / invoice image
โ
Engine (ollama:qwen2.5vl:3b โ free & local, or 7B / ONNX / OCR-fallback)
โ
Raw model output โ JSON extraction โ collapse repetition โ sanitize
โ
JSON Schema validation โโ schema_valid: true/false
โ
Evidence anchoring (PP-OCR word boxes โ best span + bbox per field)
โ
Confidence (evidence quality ร schema ร field rules)
โ
DocumentResult โ fields + per-field {quote, bbox, score} + confidence
| Benchmark | Metric | Score | Status |
|---|---|---|---|
| SROIE receipts โ TinyDoc pipeline (qwen2.5vl:3b) | Field F1 | 0.870 | โ n=100, committed artifacts |
| SROIE receipts โ PP-OCR + heuristics baseline | Field F1 | 0.376 | โ same 100 docs, same scorer |
| SROIE receipts โ Tesseract + regex baseline | Field F1 | 0.227 | โ same 100 docs, same scorer |
| Schema validity (pipeline, SROIE eval) | Rate | 1.000 | โ n=100 |
| Evidence coverage (RapidOCR, post A/B) | Rate | 0.798 | โ n=100 ร 4 fields |
| FUNSD transfer probe (form โ receipt-shaped keys) | Field F1 | 0.352 | โ n=50, nonstandard gold mapping |
| OCRBench โ TinyDoc-VLM 256M research checkpoint | Accuracy | 0.0% | โ ๏ธ n=1000 โ model retired from claims |
| DocVQA / CORD / PubTabNet | โ | โ | Not measured |
Every number above recomputes from committed artifacts in
evaluation/phase0/results/. The 256M checkpoint's earlier
benchmark figures were never measured and have been withdrawn โ see
docs/BENCHMARKS.md.
pip install tinydoc โ pypi.org/project/tinydoc
Research checkpoints (archived โ see benchmarks) โ eulogik/TinyDoc-VLM-256M
Try it live โ eulogik/TinyDoc-VLM Space
Full docs โ GitHub README
Technical report โ coming soon
Follow โ @eulogik