Cloud Computing · OCR & AI

OCR vs AI: why classic OCR gets invoices wrong and what an AI application changes

Remote Admin SysOps Team·November 23, 2026·22 min read

Classic OCR reads clean, repeatable documents well, but on everyday invoices it goes wrong in predictable places: poor scans, stamps, tables, new layouts and characters with similar shapes. AI models read a document in context and cope where templates fail, but they bring a risk of their own: a wrong value that looks credible. The quality of accounting data therefore depends on the verification built around the reading, not on the reading alone.

Invoice OCR is the first step in automation for many finance departments, and often the first disappointment. The system works on documents from regular suppliers, while for the rest someone still retypes the data or corrects what the software read. This article explains how classic optical character recognition (OCR) works, where its errors come from, what AI models change, and why reading is only half the job in the applications we design and build to order.

Legal status as of November 2026. This article is for information only and is not legal or tax advice.

How does classic invoice OCR work?

Classic invoice OCR works in two steps: first it turns the image of a page into text, and then a separate mechanism searches that text for specific fields such as the tax identification number, the invoice number or the gross amount. The two steps fail for different reasons, so it helps to keep them apart.

From image to text

The OCR engine receives an image: a scan from a multifunction device, a phone photo or a PDF page saved as a picture. It first prepares the image by straightening it, removing noise and converting it to black and white. It then splits the page into blocks, lines and characters and compares each fragment with learned patterns of letters and digits. Modern engines use neural networks for this and recognise whole lines instead of single characters, which has clearly improved their quality. The output is text with its position on the page and usually a confidence score for each word.

One caveat keeps the rest of the discussion tidy. A PDF generated directly by invoicing software contains a text layer and needs no character recognition at all. The text can simply be extracted, with no risk of confusing a zero with the letter O. In the same way, a structured e-invoice is a set of data from the start. In Poland such invoices travel through KSeF, the National e-Invoicing System (Krajowy System e-Faktur), which we come back to later in this article. OCR is needed where the document is an image: a scan, a photo or a fax.

From text to fields: templates and rules

The text of a page does not post anything to the ledger. The software has to know that the string of ten digits in the left column is the seller’s tax identification number (in Poland this number is called the NIP) and not the buyer’s, and that one of the three dates on the document is the issue date. Classic systems do this in two ways. The first is templates: for each supplier, someone marks the areas of the page where each field sits. The second is rules and regular expressions, for example “take the number that follows the word Total” or “look for a string in the format of a bank account number”. Both approaches are predictable and easy to check. Both also share the same weakness: they assume the document looks the way it looked yesterday.

When is classic OCR entirely sufficient?

Classic OCR is sufficient when the documents are clean, repeatable and come from a limited number of issuers, and when only a few fields have to be read. It is a mature technology, developed over decades, and in favourable conditions it performs very well. In practice, favourable conditions mean that:

  • documents are created digitally or scanned on good equipment, always with the same settings,
  • the layout is fixed: the same forms, the same suppliers, the same fields in the same places,
  • you read a few header fields, not every line item in the table,
  • the text is printed, in one language, with no handwritten additions,
  • the goal is, for example, searching an archive by content, where a single typo has no financial consequences.

In such uses OCR has real advantages. It is fast, it runs on an ordinary server without a graphics card, it can work entirely inside the company network and it is deterministic, which means the same image always gives the same result. If your current system works in these conditions and your accounting team reports no corrections, replacing the reading engine is not an urgent investment. Trouble starts when the real inflow of documents stops resembling the conditions the system was configured for.

Where do OCR errors on invoices come from?

OCR errors on invoices arise in five recurring situations: poor image quality, marks that overlap the print, tables and multi-page documents, new layouts and foreign languages, and characters with similar shapes. Each has a different technical cause and different consequences for accounting.

Poor scans, phone photos and skewed pages

A document rarely reaches the system in perfect form. A driver photographs it with a phone in the cab, at an angle and with the shadow of a hand across it. A thermal printout fades after a few months. The sheet may have been folded in four, hole-punched, scanned at low resolution or copied from a copy. The OCR engine tries to straighten and clean such an image, but skew and perspective distortion make it harder to split the page into lines, and small print merges into blotches. Typical results are a lost decimal separator, two numbers joined into one, or a table row assigned to its neighbour.

Stamps, signatures and handwriting

A paper invoice that has passed through the front office and the warehouse usually has something added to it. A date-received stamp, a “paid” note, the signature of the person who accepted the goods or a handwritten cost description often overlaps the printed text. For an engine trained on print this is interference: both the addition and whatever lies beneath it become unreadable. Handwriting recognition is a separate, harder task, and classic invoice systems usually do not cover it. A correction made in pen on an amount or a date therefore goes unnoticed, although for the person posting the invoice it may be the most important information on the page.

Tables and multi-page documents

Line items are the hardest part of an invoice to read. OCR reads lines of text, not table cells, so when there are no grid lines the columns can merge: the quantity sticks to the unit price, and a product name written over two lines shifts all the numbers by one row. Multi-page documents add further traps. The table continues on the next page, a “carried forward” row is read as a line item, the summary appears only at the end, and a single PDF may hold several invoices together with a specification and an acceptance report. A system built on a template of the first page has no good answer to this.

New layouts and foreign languages

A new supplier means there is no template, which means configuration work or manual data entry. The more dangerous case is a regular supplier who changes invoicing software. The template still returns something, only from a different place on the page: the sale date instead of the issue date, or the net amount instead of the gross. An error like this does not look like an error until someone compares the data with the document.

Foreign invoices add differences of format. Field labels are in another language. Some countries write the decimal separator as a point and the thousands separator as a comma, others the other way round, so “1,234.56” and “1.234,56” mean the same amount. The date “03/04/2026” can mean 3 April or 4 March, depending on the issuer’s country. A foreign tax identifier has a different length and structure from the domestic one, and characters outside the alphabet the engine was trained on are replaced with similar ones.

Similar characters: 0 and O, 1 and l, 5 and S, 8 and B

In many typefaces a zero and the letter O, a one and a lower-case l, a five and an S, an eight and a B differ by only a few pixels. In ordinary words the language dictionary helps the engine. Identifiers have no dictionary: to the software, the number “INV/O1/2026” is just as likely as “INV/01/2026”. The effect shows up only later, when a payment cannot be matched to the invoice, or when the same invoice, loaded a second time, is not recognised as a duplicate.

Confusions between digits form a separate category, for example a three read as an eight or a one read as a seven. The result is still a valid number, so a format check will not stop it. The confidence score returned by the engine is a hint here, not proof: a wrongly read character can carry a high score if it really does resemble another one in the image.

What does AI invoice reading change?

AI invoice reading changes above all the second step, the one that turns the content of a page into fields: the model does not look for a value in a fixed place but interprets the whole page in context, much as a person does. The models in question are vision-language models, that is large language models (LLMs) that take the image of a document, its text or both, and return data in a defined structure. In practice this brings several concrete changes:

  • No templates. An invoice from a new supplier is read from the very first copy, because the model identifies fields by their meaning, not by their position.
  • Context. The model tells the seller from the buyer, the issue date from the due date and the amount payable from a subtotal, even when the labels are unusual.
  • Tables. A line item written over several lines stays one item, and a table that continues on the next page is treated as a whole.
  • Languages and formats. Labels in other languages and different conventions for dates and separators are interpreted in the context of the issuer’s country.
  • Additions. Stamps and handwriting get in the way less, and legible annotations can often be read.
  • Document type. The same model can tell whether it is looking at an invoice, a corrective invoice, a pro forma or a debit or credit note, which lets the application choose the rules that follow.

There are limits too. A model cannot read what is not visible in the image: a digit flooded with stamp ink stays unreadable for every method. Models need more computing power than classic OCR, so you have to decide whether they will run through an external provider’s API or as an open model on your own server. We describe the criteria for that decision in the article on where to process company documents: in the cloud or on your own server. In a well-designed application the technologies complement each other: the text layer of a PDF, classic OCR and an AI model can serve as independent readings of the same document.

A new risk: a wrong value that looks right

A language model generates the most probable answer. On a legible document the most probable answer is also the correct one. On a difficult document something appears that classic OCR does not produce in this form: the model returns a value that is clean, correctly formatted and wrong. Typical variants of this risk are:

  • an illegible part of a number or an amount filled in with a value that “fits”,
  • data quietly “corrected”, for example a supplier name reduced to a more typical form, or an unusual document number adjusted to a familiar pattern,
  • a line item skipped or repeated in a long table,
  • a field that is not on the document, for example an order number, filled with a value from elsewhere on the page,
  • two slightly different results from two readings of the same document,
  • a confidence level declared by the model that is not a reliable measure of whether the answer is correct.

The difference from classic OCR lies in what the error looks like. A garbled OCR reading is often visible at once, because random characters stand where the amount should be. A model’s mistake looks like a correct answer, and nobody will notice it without comparing it with the document. We discuss this phenomenon, known as hallucination, in more detail in the article on how to design an AI system that does not guess.

Security comes into it as well. To the model, the content of a document is input text, so a crafted file may contain commands addressed to the model, and the application must treat document content as data, not as instructions. We cover this in the article on AI application security and prompt injection attacks.

OCR vs AI in invoice recognition: a comparison

The table compares the two approaches to reading alone, before any verification layer is added. It describes the typical behaviour of the technologies, not specific products, and it deliberately contains no percentages: the accuracy of each method depends on the documents on which it is measured.

Criterion Classic OCR with templates and rules AI model reading the document
Clean, repeatable documents Very good results with modest hardware requirements Very good results with higher use of computing power
New document layout Needs a new template or new rules Usually read from the first copy
Line items, multiple pages Shifted columns and rows, trouble with tables that continue on the next page Better grasp of structure, risk of a skipped or repeated item
Poor scan or photo Clear drop in quality, garbled characters More tolerant, but illegible fragments may be “filled in”
Stamps and handwriting Usually out of scope Partly legible, need checking
Foreign languages and number formats Separate configuration for each language and format Interpreted in context, mistakes possible where the notation is ambiguous
What a typical error looks like A garbled character or a value from the wrong area of the page A value that looks correct but does not match the document
Repeatability of the result The same image gives the same result The result may differ slightly between runs
Maintenance Templates and rules for each new supplier Instructions for the model and tests after every change of model version
Condition for trusting the result Verification Verification

The table does not say that one technology replaces the other. Both make errors, only of different kinds, and neither should be connected directly to the accounting system. The choice of reading method is an engineering decision that depends on the documents, while the last row decides whether the data can be trusted.

Why is reading an invoice not enough?

Reading alone is not enough because no method is error-free on every document, and accounting needs data that has been checked, not data that is probably right. This applies to OCR, to an AI model and to a person retyping data after several hours of work. The answer is to treat the reading as a hypothesis that the application has to confirm before it saves anything.

An invoice helps a great deal here, because it contains redundant information. The tax identification number and the bank account number carry check digits. The net amount, the tax and the gross amount are linked arithmetically, as are the line items and the summary. The supplier is usually already in the supplier master data, together with its bank accounts. Many invoices have a purchase order behind them, and in Poland a domestic invoice covered by KSeF has a structured counterpart there. Each of these relationships is a ready-made test of the reading.

Type of error Effect in accounting How the application catches it
A wrong digit in the tax identification number Document assigned to the wrong supplier or not recognised, wrong data in the VAT registers Tax ID checksum (for a Polish NIP, its check digit), comparison of the name and tax ID with the supplier master data
An error in the bank account number Transfer rejected or sent to the wrong account IBAN checksum, comparison with the accounts stored for the supplier; an unknown account goes to a person
A swapped digit or a lost decimal separator in an amount Wrong liability and tax amounts, a wrong transfer, in the extreme case a difference of an order of magnitude Net, VAT and gross arithmetic, tax consistent with the rate, line items consistent with the summary, comparison with the purchase order
0 instead of O, or 1 instead of l, in the invoice number No match with the payment or the order, an undetected duplicate A second independent reading, numbering patterns known for the supplier, a search for near-identical numbers
A confused date: issue date, sale date or due date Document in the wrong period, payment made late or too early Date consistency rules, comparison with the supplier’s payment terms
A skipped or repeated line item Wrong cost allocation, mismatch with warehouse documents Sum of line items against the summary, comparison of the items with the order and the goods received note
Seller and buyer swapped Document assigned to your own company as the supplier Rule: the buyer’s tax ID must be your company’s number
The same document loaded twice, for example as a scan and as an e-mail attachment Double posting, risk of double payment Duplicate detection by supplier, number, date and amount, and by file hash
A value “filled in” by the model Data that is not on the document appears in the system A requirement to point to the place on the page the value comes from; no source means the field goes to a person

None of these checks is enough when used alone. A checksum confirms that a tax ID is correctly formed, but it does not say whether the number belongs to the right company; the supplier master data does that. Arithmetic will not catch an error in the invoice number, because the number takes part in no calculation. For such fields a second, independent reading by a different method is used and the results are compared. When the results differ or a check fails, an employee makes the decision. This approach is called human-in-the-loop.

Illustrative example. An invoice from a foreign carrier was photographed with a phone. The reading returns a gross amount of EUR 1,853.00, while the document shows EUR 1,358.00. The net amount and the tax were read correctly, so their sum does not match the gross amount. The application does not guess which of the three numbers is wrong. It marks the fields as uncertain and shows the employee a crop of the document with the place highlighted. The correction takes a moment, and the amount that reaches the accounting system matches the document. Without this check the mistake would have surfaced only when balances were reconciled with the carrier.

We describe the whole design, from document intake to export to the ERP system, stage by stage in the article on how an AI application for accounting documents works.

100% accuracy in our deployment: where the result comes from

In one of our deployments, an AI application processes very large volumes of accounting documents and indexes them with 100% accuracy, where classic OCR still makes mistakes. This is the result of one specific, completed deployment. It does not mean that the AI model is infallible, so it helps to understand where the result comes from.

  1. The application does not trust a single reading. The AI reading is set against control rules: tax ID and IBAN checksums (in the Polish case, the NIP check digit), net, VAT and gross arithmetic, the supplier master data, duplicate detection, and comparison with the purchase order and with KSeF data.
  2. Every uncertain field goes to a person. If a value failed a check or could not be confirmed, an employee sees it together with the relevant fragment of the document and decides.
  3. Nothing unverified enters the accounting system. Only fields confirmed by rules or by a person are saved in the index.

The result therefore describes what reaches the index and the accounting system, not the model’s first reading. Some documents pass through the application automatically, some need an employee’s decision, and the proportion between them depends on the quality of the documents and on how many relationships can be checked by rules.

One honest condition follows from this. Such a result depends on the documents and on the control rules, so we do not make a universal promise for every project. In every project we measure accuracy on the client’s own documents during a pilot, before the system goes into production, and only that measurement is the basis for the decision to go live.

Does Poland’s KSeF make invoice OCR unnecessary?

No. KSeF removes the need for reading only for the invoices that pass through it, and a finance department still handles many documents from outside the system. An invoice in KSeF is a structured invoice, that is an XML file in the logical structure known as FA(3), and it receives a unique identifying number. Data from such a file is loaded, not recognised, so character reading errors do not occur here. Receiving invoices through KSeF has been mandatory in Poland since 1 February 2026. The obligation to issue invoices in KSeF applied from 1 February 2026 to taxpayers whose sales including tax exceeded PLN 200 million in 2024, and from 1 April 2026 to the remaining taxpayers. Until the end of 2026, taxpayers whose monthly invoiced sales do not exceed PLN 10,000 gross may still issue invoices outside KSeF.

According to the Polish Ministry of Finance’s information on the scope of mandatory KSeF (in Polish), the documents that remain outside the system include invoices from foreign suppliers that have no seat or fixed establishment in Poland. Pro forma invoices, debit and credit notes and internal documents do not go to KSeF either. Besides invoices, a finance department handles contracts, purchase orders, goods issued and goods received notes (known in Poland as WZ and PZ documents), bank statements, customs documents, receipts for employee expenses and the paper archive from previous years.

For these documents, reading from an image or a PDF is still needed. What changes is the role of KSeF data: it becomes a reliable reference point against which the application can compare a purchase order, a delivery document or a scan sent additionally by e-mail. The reasoning is the same for any structured e-invoice: structured data replaces reading only for the documents that actually arrive that way. We describe how to combine both streams in one workflow in the article on documents outside KSeF and how to automate them.

How can you check whether your current invoice OCR is good enough?

The surest way is to test it on your own documents: take a representative sample, compare the system’s output field by field with the data approved by accounting, and see which errors the system flagged and which passed unnoticed. Claims in sales materials tell you little, because they were produced on documents other than yours. The test can be run in a few steps:

  1. Collect a sample that reflects the real inflow. Alongside legible files from regular suppliers it should include scans, photos, multi-page documents, corrective invoices, foreign invoices and documents from new suppliers.
  2. Establish the reference. For each document you need the correct field values, checked by someone from accounting.
  3. Compare fields, not documents. The message “document read” means nothing if one field in ten is wrong.
  4. Sort the discrepancies by type. A wrong character, a value from the wrong field, a missing value and errors in line items have different causes and different remedies.
  5. Separate flagged errors from silent ones. A field marked for review costs a moment of work. A wrong field that the system accepted as correct ends up in the books.
  6. Estimate the manual work. Count how many documents need corrections and how long it takes to check the ones that turn out to be correct.
  7. Choose a direction. Sometimes it is enough to improve scanning quality and add control rules to the existing system. Where documents vary a lot, changing the reading method and building full verification often makes more sense.

If you are talking to a solution provider, whether the solution is based on OCR or on AI, ask a few questions:

  • On which documents was accuracy measured, and can it be measured on ours?
  • What happens to a field the system is not sure about? Does it go to a person, or is it saved with a lower score?
  • Can we see, next to each value, the fragment of the document it comes from?
  • Which control rules run after the reading, and who can change them?
  • What happens to a document from a supplier the system has never seen?
  • Where are the documents physically processed, and who has access to them?

The last question carries particular weight, because accounting documents contain personal data and commercial information. AI models can run on GPU servers in Poland, so that the documents do not leave the country. We write about limiting the risk of using models in the article on local LLMs and avoiding data leaks. If you need financial arguments, the article on how to calculate the return on an AI deployment will also help.

FAQ: frequently asked questions

Is invoice OCR still needed now that Poland has KSeF?

Yes, but in a narrower scope. KSeF invoices are XML files and need no character recognition, whereas invoices from foreign suppliers, pro forma invoices, debit and credit notes, contracts, goods issued and goods received notes, bank statements and the paper archive still have to be read from an image or a PDF. In most companies both streams run in parallel.

Why does OCR confuse zero with the letter O, or one with the letter l?

In many typefaces these characters differ by a few pixels, and on a poor-quality scan the difference disappears. In ordinary words a dictionary helps the engine, but invoice, contract and order numbers have no dictionary. Such fields therefore need an additional check: a second reading, a numbering pattern or confirmation by a person.

Does AI read invoices better than OCR?

On varied and difficult documents it usually does, because the model understands context and needs no templates. On clean, repeatable documents classic OCR still works well and needs less computing power. In both cases the result has to be verified before it reaches accounting.

Can AI make a mistake when reading an invoice?

Yes. A language model can return a correctly formatted value that does not match the document, especially when a fragment is illegible. For that reason the application should check every field with control rules and send everything it could not confirm to a person.

What are the most common OCR errors on invoices?

The most common are confused characters with similar shapes, lost decimal separators, shifted columns in the line item table, a value taken from the wrong field after a layout change, and illegible fragments under a stamp or a signature. Some of them produce a formally valid result, so without additional checks they go unnoticed.

Is 100% accuracy in invoice recognition possible?

In one of our deployments, an AI application indexes accounting documents with 100% accuracy, because it combines reading with control rules and sends uncertain fields to a person. This is not a promise for every project: the result depends on the documents and the rules, which is why we measure it on the client’s own documents during a pilot. Reading alone, without verification, does not deliver such a result.

A free quote for a document reading and verification application

We build custom web and mobile applications, including AI applications that read, verify and index accounting documents and pass the data to an ERP system or accounting software. We choose the reading technology to fit the project, and we measure accuracy on your documents before anything goes into production. The quote is free and without obligation: we start with a conversation about the process and the documents, and then present an estimate of scope, schedule and budget. See how we work on the web and mobile app development page, or contact us and tell us which documents take up most of your company’s time today.