LAB/014 · Running · Self-directed, not client work

Invoice Extraction in Four Languages, with Plain-Code Checks

A local vision model read invoices in Lithuanian, German, Polish and English, and plain-code checks decided which ones a person must see. Five checks let 1.8–4.8% of wrong invoices through; two more, tested on 800 fresh invoices, let none through.

The question
Can a local model enter our supplier invoices in four languages, and can simple checks make sure the wrong ones reach a person instead of the ledger?
What it showed
95.5% of invoices were extracted fully correctly and passed every check. 1.8% were wrong but passed every check; most of these were German invoices where the model read the thousands dot (1.601,08) as a decimal point, shrinking every amount about 1,000 times.
What it means in practice
Automated entry works, but checks that only test whether the numbers add up cannot catch a mistake that is made consistently. A line check (quantity × price) and a comparison with the supplier's earlier invoices closed the gap on fresh test sets.

Supplier invoices are one of the most common automation requests, and in Lithuania they arrive in several languages. The useful question is not only “how accurate is the model” but “how often does a wrong invoice get into the books without anyone noticing?” This Lab measures exactly that.

Try it: wrong invoices that look right

A model’s output always looks plausible. What matters is whether something checks it. Below are recorded results from the final run (fresh set C, described in the update further down): pick an invoice and see what the model read, the right answer, and which checks sent it to a person. The first group is the dangerous one: invoices that were wrong but passed the five checks most systems would use.

Invoice replay: what the model read, and what the checks didFresh set C (wide prices), 400 invoices · Qwen3-VL-8B (Q4_K_M), llama.cpp, one RTX 4070 · recorded 2026-10-10

Pick an invoice. The image is what the model saw. Beside it: what the model read, the right answer, and seven plain-code checks that decide whether a person looks at it. Start with the first group: invoices that were wrong but looked fine.

Original five checksAccepted, but wrong

All seven checksSent to a person: it was wrong

Invoice de-0000, German, from Ckeweiß KG to Lerwald GmbH (synthetic)

Seven checks, in plain code

  1. passLine amounts add up to the net totallines add to 402.16; net total read as 402.16
  2. passVAT per line adds up to the VAT totalVAT from the lines 40.03; VAT total read as 40.03
  3. passNet plus VAT equals the total402.16 + 40.03 = 442.19; total read as 442.19
  4. passIBAN check digits are validread DE98207295833455058760
  5. passVAT IDs have the right national formatseller DE477102424, buyer DE899773419
  6. failQuantity × unit price equals each line amountadded after the first run25 × 2.12 = 53.00, line amount read as 53.12
  7. failTotal is within 1/10 to 10× of this supplier's usual totaladded after the first runusual total about 188,552.88 (12 earlier invoices); total read as 442.19
Header fields
FieldModel readRight answer
Invoice numberFV-2026-1540FV-2026-1540
Issue date2026-05-292026-05-29
Due date2026-06-052026-06-05
Seller VAT IDDE477102424DE477102424
Buyer VAT IDDE899773419DE899773419
IBANDE98207295833455058760DE98207295833455058760
Net total402.16wrong402,162.50
VAT total40.03wrong40,036.24
Total442.19wrong442,198.74
Lines as read (item text not scored)
ItemQtyUnit priceAmountVAT %
Schulung Mitarbeiterwrong502.50125.007
right answer502,500.00125,000.007
Lebensmittelwrong502.50125.007
right answer502,500.00125,000.007
Reinigungsdienstwrong252.1253.127
right answer252,124.8853,122.007
Reinigungsdienstwrong252.1253.1219
right answer252,124.8853,122.0019
Wartung Serverwrong251.8445.9219
right answer251,836.7445,918.5019

Over all 400 invoices in this set: with the original five checks, 19 wrong invoices (4.8%) were accepted without warning. With all seven, 0 were, and 39 went to a person, 5 of them needlessly. The two added checks were fixed in code before this run. Invoices and companies are synthetic; the shown invoices were picked by a fixed rule: every wrong or rejected one, and the first three correct ones per language.

The test

  • Invoices: 400 synthetic B2B invoices, 100 each in Lithuanian, German, Polish and English (Irish VAT), with each country’s VAT rates, number format, VAT ID format and valid IBANs. Three layouts; half rendered clean, half like a scan. All companies are fictional, so the exact correct answer for every field is known. The generator is published with the Lab.
  • Extraction: Qwen3-VL-8B, a vision language model, running locally on one RTX 4070. Its output is forced into a fixed JSON format. The prompt was written before the run and not changed afterwards.
  • Five plain-code checks: the lines add up to the net total; VAT per line adds up to the VAT total; net plus VAT equals the total; the IBAN check digits are valid; the VAT IDs have the right national format.

Every invoice ends in one of four outcomes: straight-through (all checks pass and everything is right), caught (a check fails and something is wrong), silent error (all checks pass but something is wrong) and false reject (a check fails although everything is right). “Everything” means the nine header fields and the quantity, price, net amount and VAT rate of every line; item descriptions were not scored.

Results

What happens to each invoice: processed with no human touch, sent to a person, or wrong without anyone knowing.
Straight-throughCaughtSilent errorFalse reject
All95.5%2.8%1.8%0.0%
Lithuanian99.0%1.0%0.0%0.0%
German87.0%7.0%6.0%0.0%
Polish99.0%0.0%1.0%0.0%
English (Irish VAT)97.0%3.0%0.0%0.0%
Clean images95.0%2.5%2.5%0.0%
Scan-like images96.0%3.0%1.0%0.0%
LAB/014 · measured 2026-10-09 · RTX 4070 12 GB
Outcome per languageShare of invoices · silent errors are the ones to drive to zero

Lithuanian

  1. straight-through99.0%
  2. caught1.0%
  3. silent error0.0%
  4. false reject0.0%

German

  1. straight-through87.0%
  2. caught7.0%
  3. silent error6.0%
  4. false reject0.0%

Polish

  1. straight-through99.0%
  2. caught0.0%
  3. silent error1.0%
  4. false reject0.0%

English (Irish VAT)

  1. straight-through97.0%
  2. caught3.0%
  3. silent error0.0%
  4. false reject0.0%

Lithuanian, Polish and English invoices were close to perfect. German invoices were the exception, and the reason is one specific failure.

The failure: a dot that means “thousand”

German writes 1.601,08 where English writes 1,601.08. On 12 of the 92 German invoices with four-digit prices, the model read the dot as a decimal point and every amount on the invoice came out about 1,000 times too small. Because the mistake was made consistently, the totals still added up. Six of these were caught only because the shortened amounts no longer added up to the cent; the other six passed every check:

German thousands dot read as a decimal point: every check passedWrong
Printed on the invoice
line 1: 25 × 1.601,08 = 40.027,00 €; total 69.395,44 €
Qwen3-VL-8B extracted
line 1: quantity 25, unit_price 1.60, net 40.02; total 69.39
Checks
all five passed

Synthetic invoice de-0066 (fictional, generated for this Lab).

No other language had this problem: Lithuanian and Polish use a space for thousands, and Irish invoices use a comma for thousands and a dot for decimals, the decimal format the prompt asked for.

The one remaining silent error is a different kind: a digit dropped from a unit price while the line total was read correctly. A sixth check, that quantity times unit price equals the line amount, would have caught it:

One digit dropped from a unit price: every check passedWrong
Printed on the invoice
line 1: 10 × 2 226,93 = 22 269,30 zł; total 37 140,35 zł
Qwen3-VL-8B extracted
line 1: quantity 10, unit_price 226.93, net 22269.30; total 37140.35
Checks
all five passed

Synthetic invoice pl-0070 (fictional, generated for this Lab).

Update, 10 October: two more checks, tested on fresh invoices

The first run suggested two checks. Both were then fixed in code before a new run on invoices the model had not seen, with the same model, prompt and settings:

  • Check 6, line arithmetic: on every line, quantity × unit price must equal the line amount.
  • Check 7, supplier history: the total must be within one tenth to ten times the median of the supplier’s 12 earlier invoices. An accounts-payable system already has this history; the check needs nothing from the model.
wrong invoices that passed every check, fresh set of 400, five checks → seven
4.8% → 0%
went straight through, every checked field correct
90.3%
per invoice on one GPU, nothing leaves the machine
6.5 s
The same 400 fresh invoices, routed by five checks and by sevenOne mark per invoice · circles are wrong invoices that passed every check

Checks 1–5

Straight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkWrong, passed every checkSent to a person, correctSent to a person, correctSent to a person, correctSent to a person, correctSent to a person, correct
  • Straight through, correct36190.3%
  • Sent to a person, wrong153.8%
  • Wrong, passed every check194.8%
  • Sent to a person, correct51.3%

Checks 1–7

Straight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctStraight through, correctSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, wrongSent to a person, correctSent to a person, correctSent to a person, correctSent to a person, correctSent to a person, correct
  • Straight through, correct36190.3%
  • Sent to a person, wrong348.5%
  • Wrong, passed every check00%
  • Sent to a person, correct51.3%
Three real invoices from the fresh set, through all seven checks✓ passed · ✕ failed: the invoice goes to a person
  1. 1Lines add up
  2. 2VAT by rate
  3. 3Net + VAT = total
  4. 4IBAN checksum
  5. 5VAT ID format
  6. 6Qty × price = line
  7. 7Supplier history

German invoice de-0002total 60.634,00 € · read correctly

  1. Step 1, Lines add up: passed
  2. Step 2, VAT by rate: passed
  3. Step 3, Net + VAT = total: passed
  4. Step 4, IBAN checksum: passed
  5. Step 5, VAT ID format: passed
  6. Step 6, Qty × price = line: passed
  7. Step 7, Supplier history: passed

Every check passed and every field was right: booked with no human touch.

German invoice de-0000printed total 442.198,74 € · read as 442.19

  1. Step 1, Lines add up: passed
  2. Step 2, VAT by rate: passed
  3. Step 3, Net + VAT = total: passed
  4. Step 4, IBAN checksum: passed
  5. Step 5, VAT ID format: passed
  6. Step 6, Qty × price = line: stopped here
  7. Step 7, Supplier history: stopped here

Thousands dot read as a decimal point. The first five checks passed; checks 6 and 7 sent it to a person.

German invoice de-0015printed total 70.637,39 € · read as 70.63

  1. Step 1, Lines add up: passed
  2. Step 2, VAT by rate: passed
  3. Step 3, Net + VAT = total: passed
  4. Step 4, IBAN checksum: passed
  5. Step 5, VAT ID format: passed
  6. Step 6, Qty × price = line: passed
  7. Step 7, Supplier history: stopped here

Same misread, and the line arithmetic still held: only the supplier's history caught it.

Measured 2026-10-10. Two more checks: quantity × unit price = line amount (6), and the total within 1/10 to 10× of the supplier's earlier invoices (7).
Straight-throughCaughtSilent errorFalse reject
First set (400), checks 1–595.5%2.8%1.8%0.0%
First set, + line arithmetic (chosen after seeing its errors)95.5%4.0%0.5%0.0%
Fresh set B (400), checks 1–598.0%2.0%0.0%0.0%
Fresh set B, checks 1–798.0%2.0%0.0%0.0%
Fresh set C, wide prices (400), checks 1–590.3%3.8%4.8%1.3%
Fresh set C, wide prices, checks 1–790.3%8.5%0.0%1.3%
LAB/014 · measured 2026-10-09 · RTX 4070 12 GB
  • On the first set, line arithmetic alone would have cut silent errors from 7 to 2. That row is after the fact: the check was chosen after seeing those errors.
  • Fresh set B had no silent errors to catch. Its suppliers had smaller prices than the first set, so few German invoices had four-digit amounts, the case where the model misreads the thousands dot. This was a mistake in how the set was generated, so a third set was made.
  • Fresh set C restored the original price spread. With the five original checks, 19 of 400 invoices (4.8%) were wrong without warning: 15 German thousands-dot misreads and 4 Polish errors. With all seven checks, none were: every one went to a person. Supplier history caught all 15 German misreads; line arithmetic caught three Polish line errors; the fourth, a misread seller VAT ID, failed supplier history because no supplier had that ID.
  • The 5 false rejects in set C came from the VAT check, not from the new checks: it rounds half-cents differently from the invoices, and on invoices with repeated lines the difference passed its 2-cent tolerance. The model had read all five correctly. A real check should use the invoicing country’s rounding rule.

Field by field, and what the checks caught

Field accuracy, all 400 invoices (exact match after removing spaces).
Correct
invoice number100.0%
issue date100.0%
due date100.0%
seller vat id99.8%
buyer vat id100.0%
iban99.0%
net total97.0%
vat total97.0%
total97.0%
line items (recall)96.1%
LAB/014 · measured 2026-10-09 · RTX 4070 12 GB
Which plain-code check caught the wrong invoices (one invoice can fail several).
Wrong invoices caught
lines sum6
vat by rate3
net plus vat0
iban checksum4
vat id format1
LAB/014 · measured 2026-10-09 · RTX 4070 12 GB

The IBAN checksum caught every misread IBAN, usually a dropped digit. There were no false rejects: the checks never sent a correct invoice to a person.

What this means in practice

  • Silent errors are the number to manage, not accuracy. Here, 95.5% straight-through with no human touch, 2.8% correctly sent to a person, and 1.8% wrong without warning.
  • Consistency checks miss consistent mistakes. A number-format misread keeps the arithmetic intact. Add checks that compare with something outside the invoice: the purchase order, the expected price range for that supplier, or the payment amount.
  • Test every language and format you actually receive. The model was near-perfect in three languages and had a systematic weakness in the fourth. An average over all invoices would have hidden it.
  • Each failure found is a check added. Both silent-error patterns here had a simple, plain-code fix, and the fixes held on fresh invoices.

On one GPU, extraction took about 6.5 seconds per invoice, roughly 550 invoices an hour, with no data leaving the machine.

Method and environment
data
400 synthetic B2B invoices, 100 each in Lithuanian, German, Polish and English (Irish VAT), half rendered clean and half scan-like; fictional companies; exact ground truth; generator in the repository
model
Qwen3-VL-8B Q4_K_M (llama.cpp), output constrained to a JSON schema, greedy
prompt
Extract this invoice as JSON. Copy text values exactly as printed. Write amounts as plain decimals with a dot and no thousands separators (for example 1234.56), dates as YYYY-MM-DD, the VAT rate of each line as a number (for example 21), and the IBAN and VAT IDs without spaces. Include every line item.
validators
line nets sum to net total; VAT per line and rate sums to VAT total (±0.02); net + VAT = total; IBAN mod-97; VAT ID format per country
outcomes
straight-through = all checks pass and every field right; caught = a check fails and something is wrong; silent error = all checks pass but something is wrong; false reject = a check fails but everything is right
environment
gpu: RTX 4070 12 GB
measured
2026-10-09

Limits

Synthetic invoices: clean, consistent layouts with no stamps, handwriting, multi-page documents or supplier-specific quirks, so real invoices will produce more errors, and different ones. One model, one prompt and one run. The JSON format requires amounts with at most two decimals; whether this contributed to the German misreads (by cutting “1.601” to “1.60”) was not tested separately. The first five checks were designed before the first run; checks 6 and 7 were fixed before the fresh runs. The supplier histories are synthetic and consistent; real suppliers vary more, so the 10× band would need setting per supplier. The code and the invoice generator are in labs/invoice-extraction in this site’s repository.

Data: invoices-2026-10-09.json (JSON), free to reuse under CC BY 4.0 with credit to Saulius Beconis.

New Lab results by email

A short email when a new measurement is published, a few times a year. No newsletter fluff, reply to unsubscribe.