PIX2DB: Reconstructing Executable Relational Databases from Document Images with a 2B Vision-Language Model
Much operational data reaches organizations in the form of images, including scanned invoices, photographed receipts, spreadsheet screenshots, and rendered charts. Existing table extraction tools typically produce grids or HTML that preserve the visual layout but leave relational decisions unresolved. Consequently, merged cells, document headers and their associated line items, and formatted numerical values often require manual interpretation before the extracted data can be queried. This study introduces image-to-database reconstruction, in which a model transforms a single image into a SQLite dump containing tables, column types, primary and foreign keys, and records that can be directly loaded and queried. Training data with exact ground-truth databases are generated by rendering samples from Spider databases at six layout levels and converting PubTabNet, FinTabNet, and CORD annotations using consistent normalization rules. Qwen3-VL-2B, adapted using LoRA on 36,589 image–dump pairs and followed by a deterministic verify-and-repair layer, is evaluated against Qwen3-VL models with 2B, 4B, and 8B parameters, an 8B HTML-to-SQLite pipeline, Docling, and the same 2B model fine-tuned to generate HTML. On rendered documents from unseen databases, the proposed model achieves a table exact match of 0.86 and recovers 0.99 of the gold foreign keys with a precision of 0.99 on the synthetic test set. The Qwen3-VL-8B model prompted to generate SQL achieves an exact match of 0.75 (lower than the proposed model, p < 0.001), with a foreign-key recall of 0.75 and a foreign-key precision of 0.80. On held-out tables from the training sources, the proposed model achieves a cell F1 score of 0.81 on PubTabNet, where its performance does not differ significantly from that of the 8B HTML pipeline (p = 0.059), and 0.96 on FinTabNet (p < 0.001). Evaluation on two independent sources reveals important limitations: the 8B HTML pipeline performs better on photographed TabRecSet tables (0.58 versus 0.52), while, on full-page invoices, the proposed model transcribes line items but fails to recover the invoice header and its associated key (cell recall of 0.54 versus 0.87). The 2B model fine-tuned to generate HTML achieves cell accuracy comparable to that of the SQL model across all evaluation sets but cannot represent relational keys. Furthermore, results across three training seeds vary by no more than 0.011 in standard deviation. These findings indicate that relational conventions can be learned reliably from exact training data, whereas interpreting unfamiliar images and transferring document structures to previously unseen templates remain open challenges.
Authors
- Musa Peker (ORCID: https://orcid.org/0000-0002-6495-9187)
Publication Details
- Journal
- Journal of Future Artificial Intelligence and Technologies
- Published
- 2026-11-30
- DOI
- https://doi.org/10.62411/faith.3048-3719-482
- Primary Topic
- Handwritten Text Recognition Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00