Skip to content
Hands-on4 min readPublished 2026-12-03Reviewed 2027-12-03

How much can field validation catch in OCR output? On 200 documents, order numbers 32/32 and totals 45/45, but dates 3/14 and unit prices 0/27 ​

The engineering problem in reading documents with a vision model is not whether the fields come out, but how you know which ones came out wrong. The official limitations page says this plainly: enlarge small text, expect weaker results on non-Latin alphabets, and expect incorrect descriptions in some cases (checked 2026-12-03, applies to vision models such as gpt-6-astra). This post is not about model capability. It measures one thing you can put a number on: how many field errors do format, check-digit and cross-field rules actually catch?

How the test was run ​

  • Sample: 200 synthetic documents on a 900 x 620 px canvas, downscaled to 62% and saved as JPEG q25, imitating a phone photo or a forwarded screenshot.
  • Environment: tesseract 4.1.1 (chi_sim+eng, --psm 6), Python 3.12.11, Pillow 10.4.0.
  • Fields: order number, date, unit price x2, subtotal x2, total. 7 per document, 1,400 in all.
  • Extraction: by value shape (order A+7 digits-4 digits, date 2026-xx-xx, amounts with two decimals), not by Chinese label, because the labels fail recognition just as often.
  • Three layers: (1) format, meaning regex shape, calendar-valid date, two-decimal amount; (2) check digit, where the first 10 digits of the order number are weighted 2 through 7 cyclically and summed mod 10, which must equal the last digit; (3) cross-field, where subtotal1 + subtotal2 = total within 0.01.

Results: three quarters of errors flagged, coverage wildly uneven ​

MetricValue
Field error rate152 / 1,400 = 10.9%
Documents with all seven fields correct115 / 200 = 57.5%
Wrong fields flagged by a rule114 / 152 = 75.0%
Correct fields flagged92 / 1,248 = 7.4%
Wrong fields no rule noticed38 / 1,400 = 2.7%
Documents sent to review74, every one of them actually wrong
Documents with errors that never reached review11

Splitting the 75% by field shows where the coverage comes from:

FieldWrongFlaggedWhy
Order number323227 were not extracted at all; 5 were misread and caught by the check digit
Total4545A wrong total always breaks the addition
Subtotal 1 / Subtotal 214 / 2014 / 20Same reason, they take part in the cross-check
Date143A misread date is still a valid date, so the format rule sees nothing
Unit price 1 / Unit price 28 / 190 / 27Unit prices take part in no equation at all

Why dates and unit prices cannot be rescued ​

A rule catches an error only when the field has a checkable relationship with something else. The order number carries a check digit, so it is self-consistent. Subtotals and total satisfy an addition, so they constrain each other. Dates and unit prices have no equation and no check digit on this document: if 2026-07-20 is read as 2026-07-28, the shape is legal, the calendar is legal, and no sum changes, so all three layers pass it through.

That is the structural fact behind OCR confidence: accuracy is not bought by reading more carefully, it is bought by redundancy in the document itself. The same model reading free-form contract text (no redundancy) and reading an invoice (totals, tax-ID check digit) has very different amounts of verifiable structure.

python
def order_valid(s):                      # order number: shape + check digit
    if not re.fullmatch(r"A\d{7}-\d{4}", s): return False
    d = s[1:8] + s[9:]
    return sum(int(d[i]) * [2,3,4,5,6,7][i % 6] for i in range(10)) % 10 == int(d[10])

def amounts_consistent(s1, s2, total):   # amounts: cross-check, one-cent tolerance
    return abs(s1 + s2 - total) <= 0.011

def date_plausible(s):                   # date: shape catches impossible values, not wrong-but-valid ones
    return bool(re.fullmatch(r"2026-\d{2}-\d{2}", s))

Read the comment on date_plausible: it stops 2026-13-45, nothing more. Of the 14 date errors, it flagged 3; the other 11 looked completely normal.

The character-confusion repair pass fixed exactly zero ​

The usual hygiene step is a confusion table (O to 0, I to 1, S to 5, B to 8) applied before validation. On this sample, applying it to the 90 wrong amount fields and re-parsing fixed 0. The reason is simple: these errors are digit-to-digit misreads (802.32 to 902.32, 1385.15 to 1385.45), not letter-digit swaps. A confusion table treats glyph similarity, not pixel-level misjudgement.

So the right role for that table is cleaning format noise, not correcting recognition errors. Treating it as a repair layer produces a dangerous kind of confidence: the belief that something has already been fixed.

In production: price the review work, do not chase auto-correction ​

Three conclusions this data supports:

  1. Use the three layers to surface uncertain fields, not to rewrite them. The correct action for the 114 flagged errors is review, not guessing a plausible value and writing it in.
  2. Review at field granularity, not by re-keying whole documents. 74 documents entered the queue and carried 92 flagged-but-correct fields (a 7.4% false-flag rate). Re-keying the whole document re-rolls the dice on those correct fields too.
  3. The 2.7% silent errors can only be caught downstream. 11 documents had errors that no rule could see. The only backstop is reconciling key fields (amounts, dates, order numbers) against the order system, or making the business process refuse to proceed when the amounts do not add up.

One line to close: the confidence ceiling of OCR is set by the redundancy of the document, not by the effort of the model. Fields with check digits and equations can be largely policed by rules; isolated fields should skip validation theatre and go straight to reconciliation.

OpenAIChat · Full-stack engineering for LLM-powered conversations and apps