How AI reads source documents: invoices, contracts, and registers
Four engineering stages from a photo or scan to a record in your accounting system: vision, table structure, register checks, and arithmetic.
Most AI demos show ideal conditions: a clean digital PDF that converts to text easily. Real life in Ukrainian business looks different: crumpled warehouse invoices, blurry scans with glare, stamps pressed over the totals, and handwritten corrections.
Turning this kind of input into error-free data for an accounting system requires a chain of validations. Let us break it into four stages — and at each one we will see the same rule: the model is responsible for understanding, while guarantees live in the code.
Stage 1. Computer vision and geometry
Before any text reaches the language model, computer vision algorithms correct page skew, remove lens distortion, even out contrast, and separate background noise from useful text.
It sounds boring, but without this stage nothing further works: recognition on a “tilted” page produces errors exactly in numbers — prices, sums, and codes. And a single wrong digit in an invoice costs more than an hour of manual proofreading.
A everyday illustration: photograph a receipt at an angle in evening light. Your eye still reads it, because your brain knows the context. An algorithm has no “expectations” — it reads what it sees. That is why the first stage is called normalization: bringing the image to a state where you can then measure confidence instead of guessing.
Stage 2. Structure and table relationships
The main trap of standard OCR is losing structure. If a fifty-line waybill is read as one continuous stream of words, article numbers get mixed with the prices of neighboring rows. Downstream this turns into wrong totals in accounting that are only discovered during a stocktake.
Multimodal models detect cell coordinates and bind each price, quantity, and amount to the correct product name. A table row stays a table row.
A typical error without this stage: in a fifty-line invoice the system reads “Sunflower oil 20L” from a neighboring row and assigns it the price “96.30” instead of “1,240.00”. Accounting receives correct text with a wrong amount — the worst kind of error, because it looks plausible and slips past the controller.
- 01
Scan or photo
Blurry image, skew, stamps, corrections
- 02
Vision and structure
Geometry fixes, table cell relationships
- 03
Register checks
EDRPOU, nomenclature, dates and currencies
- 04
Arithmetic and a human
Exact calculation, operator verification
Stage 3. Semantic normalization and cross-checks
Extracted strings are not yet data. Are “LLC Mriya” and “Limited Liability Company ‘Mriya-Trade’” the same company or two different ones? At this stage the system matches the text against official directories and state registers:
- counterparty check: the extracted EDRPOU code is checked against the official register for a match with the company name and current VAT status;
- nomenclature mapping: the supplier’s name (“Bearing 205-A”) is matched to the item in your own accounting system;
- date and currency normalization: any recording format is converted to a single standard.
Register cross-checking is what separates a working system from “text on a screen.” Without it, some documents sit waiting for manual review exactly where AI was supposed to save time. With it, the accountant sees not “something like a name” but a concrete directory entry with a verified code — and confirms it with a click instead of typing it by hand.
Here, incidentally, lies one more argument for Ukrainian systems: global models do not know what an EDRPOU code, a tax invoice, or a software cash register (PRRO) is. They confidently recognize “invoice number” and “VAT,” but an “EDRPOU code” is just a string of digits to them. A domain layer with state registers is not an “extra feature” — it is the difference between a system that works and a system that pretends.
Stage 4. Deterministic arithmetic and a human
The final check is always done by code, not by the model:
- quantity multiplied by price must exactly equal the line total;
- the sum of the lines plus accrued VAT must match the document’s grand total.
If the discrepancy is even one cent, or field recognition confidence falls below the threshold (we use 95%), the document is not posted automatically. It goes to an operator with the problem spot highlighted on the original image. The operator verifies the value in seconds — and accounting accuracy stays at one hundred percent.
Note the distribution of roles. The model does not “decide whether it read things correctly.” It produces a result along with a confidence measure, and the decision to post is made by a deterministic rule. This construction works in any weather: if the model is updated, degrades, or gets replaced, the thresholds and rules stay the same, and accounting is never left to chance.
What this gives the business
Together, the four stages yield a predictable process: a document scan turns into a posting within minutes, and disputed cases are collected into a short list for a human. Errors that used to be found by a stocktake a month later are now caught at the entrance.
Count how many hours a month your team spends typing in invoices. For a company processing a hundred documents a day, that is a full-time position — and the least interesting part of it. Automation does not require cutting people; it requires shifting their attention from typing digits to reviewing exceptions, where the human eye is truly irreplaceable.
More important still, the process is transparent: at every step you can see why the system made this particular decision. The history of any posting can be unfolded all the way back to the original scan. And this is no longer about “trusting AI” — it is ordinary control, the kind any chief accountant values.