mmbert-small-invoice-extraction

Marks the words of an invoice's fields in its text (as pdf.js reads a digital PDF): seller and buyer, their VAT numbers, invoice number, issue and due dates, net, VAT and total, and the IBAN, in English, Polish, German, French, Spanish and Lithuanian. The first 12 of mmBERT-small's 22 layers, fine-tuned with BIO tags over words; ONNX weight-only int8 for transformers.js, 32.7 MB plus a 1.0 MB tokenizer.

It runs with a rule layer that checks VAT numbers and IBANs by their check digits, as the widget on balticml.eu does. The model labels words, not tokens, each tokenized with the whitespace before it; use the code in the repo (github.com/balticml/invoice-extraction, web/model.js and web/pdftext.js) rather than the generic pipeline.

Results

A field counts as right when its value equals the invoice's after normalising; the widget leaves a field empty ("not sure") below a confidence threshold of 0.65 or when a check fails.

PDFs from invoicing tools (int8, what the widget runs) right wrong, shown not sure
Dolibarr and Odoo layouts, other companies than in training (411 fields) 92% 0% 8%
ZUGFeRD samples, a layout it never saw (199 fields) 32% 35% 33%

The model learns layouts. Left out of training and then added with five examples (PyTorch, the same recipe), a layout goes from 36% right and 30% wrong to 85% right and 5% wrong (ZUGFeRD samples), Odoo from 13 wrong values to none, Dolibarr from 52 to 9. Train it on a few invoices of each supplier before trusting it on theirs.

On 60 invoices written by a local LLM (gpt-oss-20b) for other kinds of business, checked by hand: 98.5% of fields right with the check digits (Qwen 2.5 7B instruct, asked for JSON: 92.2%), 66 ms per invoice on four CPU threads. Per field and the full tables: the repo's README.

Training data

No real invoices. 9,000 invoices from a generator (six layout families, six languages), 566 written whole by gpt-oss-20b for 30 kinds of business (each also filled again five times with other names and numbers), and 480 exported from local Dolibarr and Odoo installations to made-up companies. Every invoice was read with pdf.js, block by block; each word's label comes from where its value is printed.

Limits

Digital PDFs with a text layer only (no scans). One-page invoices of small businesses tested. A layout it never saw is read poorly and confidence does not catch it: test it on your own suppliers' invoices first. Company names are the weakest fields.

Downloads last month
57
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for balticml/mmbert-small-invoice-extraction

Quantized
(307)
this model