These run in order, and each one can fail on its own terms. Most projects that disappoint have skipped the last two, because the first three are the ones that demonstrate well.
01Reading the characters, then reading the layout
OCR, layout-aware extraction, bounding boxes, key-value pairing
OCR — optical character recognition — turns the marks on a page into characters. It answers one question only: what does this say? It hands back text, usually in reading order, and it has no idea that the number in the bottom right is a total rather than a page count. Layout-aware extraction is the second, harder step: it looks at where each piece of text sits on the page and what it sits near. Every fragment carries a bounding box — the four coordinates of the rectangle it occupies — so the system can say that this string is directly to the right of the words Invoice Number, that these figures form a column, and that this block is inside the header rather than the body. That spatial reading is what turns loose text into key-value pairs a system can post. OCR alone gives you a transcript. Layout-aware extraction gives you fields.
You get a wall of correct characters in roughly the wrong order, and someone downstream writes a hundred fragile string rules to guess which number was the total — rules that break the first time a supplier moves their address block.
02Tables, which are the hardest common case
Row and column detection, merged and spanning cells, multi-page continuation, line-item extraction
A header field appears once and sits in a predictable region. A table is a structure, and the structure is often implied rather than drawn. Rows may be separated by white space instead of rules. One description wraps onto three lines while the quantity beside it does not, so the naive reading produces three rows where there is one. Cells merge and span. A table continues across a page break, and the second page repeats the column headers — or does not. Sub-totals sit inside the body and look exactly like line items. Getting tables right means detecting the grid, assigning every fragment to a cell, deciding what is a continuation and what is a new row, and then knowing which rows are data and which are arithmetic. This is where most of the engineering time in a document project goes, and it is almost never what the demonstration shows.
Header fields are right, the document looks processed, and the line items are quietly wrong — a quantity attached to the wrong description, a wrapped row counted twice. It reconciles at the total and fails at the detail, which is the expensive way round.
03Handwriting, stamps and bad photographs
Handwriting recognition, deskew and dewarp, occlusion, glare and low-contrast capture
Printed text on a flat scan is the easy case, and it is not the case most operations actually have. A delivery note is photographed on a phone at an angle, in a yard, in the rain. The page curves, so straight lines are not straight — dewarping flattens that, deskewing rotates it back to square, and both are guesses that can be wrong. A rubber stamp lands across a figure: that is occlusion, and no amount of model quality recovers characters that are physically not visible. Handwriting is a separate problem from print, and a legitimately harder one. Block capitals in a boxed form are close to reliable. Cursive in a free-text field, written quickly by someone holding a clipboard, is not, and any supplier who tells you otherwise has not tried it on your documents. The honest engineering answer to bad capture is usually upstream: better capture beats better models, every time.
The system reads what it can and silently invents the rest, because a model asked to produce a number will produce a number. A partially obscured figure comes back plausible and wrong, and nothing in the output distinguishes it from a figure that was read cleanly.
04Confidence scores, and where the human threshold sits
Per-field confidence, thresholding, human-in-the-loop review queues, straight-through processing rate
A confidence score is the extraction system's own estimate, per field, of how likely it is to be right — not a guarantee, and not a probability you should treat as exact. What makes it useful is that it can be thresholded. Above the line, the field passes straight through. Below it, the document goes to a review queue where a person sees the page, the extracted value and the box it came from, and corrects or confirms in a few seconds. That is human-in-the-loop: not a person checking everything, and not a person checking nothing, but a person seeing exactly the cases the machine is unsure about. Where you set the threshold is a business decision, not a technical one. Set it high and more work reaches a human, which costs time but catches more. Set it low and more passes untouched, which is cheaper until the day it is not. The threshold also belongs per field: a supplier name read imperfectly is an annoyance, a bank account number read imperfectly is a fraud incident, and they should not share a line.
Everything is treated as equally trustworthy, so either a person re-keys work the machine did perfectly well or errors post straight into the ledger with nothing marking them as doubtful. Both outcomes destroy trust in the system, and the second one does it quietly.
05Reconciliation against the system of record
Matching to the ERP or finance system, purchase-order and goods-receipt matching, tolerance rules, exception codes
Extraction produces a claim about what a document says. Reconciliation asks whether that claim agrees with what you already know. The supplier name is matched to a real account, not accepted as typed. The purchase order number is looked up, and the quantities and prices are compared against what was ordered and what was received, within whatever tolerance the business allows. The line items are summed and checked against the stated total. Dates are checked for being possible. This step is where most genuine errors are caught, because your own records are a far stronger check on a document than the document is on itself — and it is the step that turns an extraction tool into something the finance team will actually let near the ledger. Where a match fails, the right output is not a correction but a named exception: this invoice references a purchase order that does not exist, and here is the page it came from.
A well-read document is posted against the wrong account, or a duplicate invoice is processed twice because nothing looked. The extraction was accurate and the outcome was still wrong, which is the failure mode nobody budgets for.