CyberFreezeDev Loading
  1. Home
  2. CyberFreeze Labs
  3. Document AI and OCR

Document AI and OCR: extracting fields a finance team can trust

Testing which mix of OCR, layout and language models gives document fields a finance team can trust.

3D render of a paper stack and a scanner bed whose light bar reads fields into a record card

Fields a finance team can trust

The question: which OCR, layout and model combination gives fields that can go straight into accounts, and how doubtful ones reach a person.

Read more about Fields a finance team can trust

For the paperwork Indian businesses actually receive, which combination of OCR, layout understanding and language models produces fields that can go straight into accounts, and how do we send the doubtful ones to a person?

The documents are messy: GST invoices from hundreds of suppliers in hundreds of layouts, phone photos of bills, scanned bank statements, PAN and Aadhaar cards, application forms with handwriting, and PDFs that look like text but are really images. We have already built an OCR pipeline for invoices, IDs and forms with human review for a client, and expenses from bills are part of Fint. This track turns that experience into a repeatable test so we can choose components on evidence.

Results feed our OCR and document intelligence service and our GST and accounting automation work.

Why one wrong digit matters

One wrong digit is worse than a blank

A confidently wrong GSTIN flows into returns and ledgers and may surface months later.

Read more about One wrong digit is worse than a blank

A missing field gets noticed and filled in. A confidently wrong GSTIN or taxable value flows into GSTR-1, input tax credit claims and ledgers, and is found months later, if at all.

Data entry is the hidden cost

Automation saves keying time only if staff trust the output enough to stop re-checking.

Read more about Data entry is the hidden cost

CA firms and finance teams spend hours keying invoices and statements. Automation only saves that time if staff trust the output enough to stop re-checking every field.

Identity documents carry legal duties

Aadhaar and other IDs carry storage rules and DPDP duties, so pipelines must mask and keep less.

Read more about Identity documents carry legal duties

Aadhaar numbers have specific rules on storage and display under the Aadhaar Act and UIDAI regulations, and all of it is personal data under the DPDP Act 2023. A pipeline must mask and limit what it keeps.

Pipeline stages

The pipeline is built from swappable stages so each one can be tested on its own.

Document AI test pipelineLabs track 04
Input types
PDF with text layer, scanned PDF, JPEG and PNG phone photos
Stage 1
Text layer extraction when the PDF has one; OCR only when it does not
OCR engines under test
Tesseract, PaddleOCR, docTR
Field extraction
Language and vision-language models returning JSON against a fixed schema
Validation
Rule checks on every field before a person sees it
Review
Doubtful fields routed to a person with the source image beside them
Local GPU
NVIDIA GeForce RTX 3070 Ti Laptop GPU, 8 GB
Stage
Test pipeline defined; no scores published yet

Rule checks on every invoice

Rules catch errors that no model confidence score will. These come straight from how GST invoices are structured.

Fig. 01 Overhead: fields read off the page fill rows on the record card
  1. 01 GSTIN shape and check digit

    A GSTIN that fails its 15-character pattern or check digit is wrong, whatever the model says.

    Read more about GSTIN shape and check digit

    A GSTIN is 15 characters: a two digit state code, the holder's 10 character PAN, an entity number, the letter Z by default, and a final check character. A value that fails the check digit is wrong, whatever the model says.

  2. 02 State code against tax type

    Same state means equal CGST and SGST; different states mean IGST. A mismatch flags a misread.

    Read more about State code against tax type

    If supplier and buyer are in the same state, the invoice should carry CGST and SGST in equal amounts. If they are in different states, it should carry IGST. A mismatch means a misread field or a wrong invoice.

  3. 03 Arithmetic

    Lines must add up to the taxable value, and tax and total must match.

    Read more about Arithmetic

    Line amounts must add up to the taxable value, tax must match the stated rates, and the grand total must equal taxable value plus tax, allowing for rounding.

  4. 04 Dates and duplicates

    Dates must be sensible and the same supplier invoice number must not already exist.

    Read more about Dates and duplicates

    The invoice date must fall in a sensible period, and the same supplier GSTIN with the same invoice number must not already exist in the books.

  5. 05 Route or accept

    Fields passing every rule and both passes are accepted; the rest go to a person.

    Read more about Route or accept

    Fields that pass every rule and agree across two extraction passes are accepted. Anything else goes to a person, with the reason shown.

Scoring extraction

MetricHow we measure itWhat counts as success
Field accuracyEach extracted field compared to an answer key a person prepared, exact match after normalising spaces and caseMatches on every field that the rules accept
Confident errorsFields that were wrong but passed every check and were not sent for reviewNone. This is the number we care about most
Straight-through rateDocuments that needed no human edit at allRises as rules and prompts improve, without confident errors rising
Review timeSeconds a reviewer spends per routed documentLower than keying the document by hand
Character error rateRaw OCR text against a typed transcript, for comparing enginesUsed to choose engines, not as the end goal
Cost and speed per pageRun time and any API cost per pageAffordable at the client's monthly volume

Test documents are created by us or come from public samples, with personal details replaced. No client documents are used in published results.

What is documented, and what we expect to find

Public knowledge and our working hypotheses. No benchmark numbers are published yet.

Check for a text layer first

Many billing PDFs already hold exact text, so OCR should be the fallback.

Read more about Check for a text layer first

Many PDFs from billing software already contain the exact text. Reading that layer avoids OCR errors entirely, so OCR should be the fallback, not the first step.

Model confidence is not correctness

Fluent output can be wrong; rules and a second pass give a better signal.

Read more about Model confidence is not correctness

Language models can produce fluent, well-formatted values that are wrong. Validation rules and a second independent pass give a better signal than the model's own certainty.

Hypothesis: rules catch most dangerous errors

Hypothesis: GSTIN, tax type and arithmetic rules catch most confident errors. We measure what slips through.

Read more about Hypothesis: rules catch most dangerous errors

We expect GSTIN check digits, tax type checks and arithmetic to catch most confident errors on invoices. We are measuring what slips through anyway.

Hypothesis: phone photos are the hard case

Hypothesis: for phone photos, image clean-up before OCR matters more than the engine chosen.

Read more about Hypothesis: phone photos are the hard case

Skew, shadows and folded paper should hurt every engine. We expect image clean-up before OCR to matter more than the choice of engine.

What we publish, and when

Notes will be published in the R&D / Labs notes section of our blog. Only documents we created or public samples are used, with personal details replaced.

NotePublished whenWhat it contains
Method noteBefore any scoresDocument types in the test set, the answer-key format, the validation rules above and how confident errors are counted
OCR engine comparisonWhen Tesseract, PaddleOCR and docTR have run on the full image setCharacter error rate per document type, phone photos and scans reported apart, with engine versions and settings
Extraction and routingAfter the engine comparisonField accuracy, confident errors, straight-through rate and review time for each extraction setup
Local extractionWhen the LLM track has baseline resultsThe same scores with the extraction step on a local model, so the cost of keeping documents in-house is visible

Questions

Can OCR read handwritten forms?

Printed text is reliable with modern engines. Handwriting varies a lot by writer and form design, which is why handwritten fields in our pipeline go to a person by default until the test data shows otherwise.

Will document AI replace our accounts staff?

No. It removes typing and moves staff to checking the cases the system flags. In our designs, as in Fint, nothing reaches the books without a person confirming it.

Can this run without sending documents to a cloud API?

The OCR engines above run locally. Whether the extraction step can run locally is what our local LLM track is testing.

Which documents do you test?

GST invoices, bills, bank statements, PAN and Aadhaar cards, and application forms, in PDF and image formats, using documents we create or public samples.

Last updated