Engineering · Document AI

How an LLM reads a bank's statement of account, including the scanned ones

In Clausework, a language model reads figures out of statements of account that arrive as PDFs, photocopies and scans. What it extracts, how it is kept honest, and why the arithmetic is never left to it.

Pikabyte Engineering 4 min read

3

loan products whose statements are read by AI: mortgage, hire purchase, personal loan

Every recovery matter starts with a statement of account. It says what was lent, what is outstanding, at what rate, as of which date. Those figures go into the notice of demand, the summons and everything after it.

In a banking litigation practice, a clerk reads each statement and types the figures into the system. Hundreds of accounts arrive each month. The statements do not look alike. Some are clean PDFs exported from a banking system. Many are photocopies or scans: a picture of a page, with no text a computer can select.

This is the job we gave to a language model in Clausework, the litigation platform we built for a Malaysian law firm. It is a narrow job, and it is deliberately fenced.

Why this is a hard problem for ordinary software

Traditional extraction works by position or pattern: the outstanding balance is the number after this label, in this corner of the page. That breaks as soon as the layout changes, and it does not work at all on a scan.

Statements also vary in vocabulary. The same amount is labelled “Financing Amount” on one statement, “Loan Amount” on another and “Drawing Limit” on a third. An Islamic facility has a “Profit Rate” where a conventional one has an “Interest Rate”. A rule-based parser needs a rule for every variant, and a new one every time a bank changes a template.

A multimodal language model handles both problems. It reads the page as an image when there is no text layer, and it understands that different labels mean the same thing.

What the model is asked to do

A staff member opens a debtor’s record and uploads the statement. The system sends the PDF to the model with instructions specific to the product, because a mortgage statement and a hire purchase statement carry different information.

For a mortgage, the model returns a small set of fields: the instruction date, the balance outstanding, the principal outstanding, the financing or loan amount, and the rate. For hire purchase there are more, including the vehicle’s registration, chassis and engine numbers, the instalment amount, the term, and the breakdown of charges. Personal loans have their own set.

Four rules in the instructions do most of the work.

Read the page however it arrives. The model is told the PDF may contain selectable text or may be scanned images with none, and to interpret the page visually when needed.

Map the bank’s words to our fields. For each field, the instructions list the labels a statement might use. The output always uses the same field names, whatever the statement called them.

Return data, not prose. The response must be a single structured record: dates in one fixed format, amounts as plain numbers with two decimal places, no currency symbols, no commas, no commentary.

If unsure, say nothing. When a field cannot be determined with confidence, the model must return an empty value. A statement that says “Refer to Letter of Offer” where the rate should be yields an empty rate, not a guess.

That last rule matters most. A blank field is a prompt for a person to look. A plausible wrong number is a defect in a court document.

What the software around it does

The model’s answer is not trusted on arrival.

The response is parsed strictly. If it is not a valid record, the request fails with an error instead of saving something half-right. Values are stored in dedicated fields on the debtor’s record, alongside the uploaded statement itself, so anyone reviewing the matter can open the document and compare.

Staff can correct any extracted value. The fields are ordinary, editable fields, not a locked AI output.

And the model does not calculate anything. Interest, costs and statements of account for execution proceedings are produced by a separate calculation engine: ordinary, tested code that gives the same answer every time, to the cent, for conventional and Islamic facilities. The model reads. The engine computes. A person approves.

Why the split matters

A language model is very good at reading and unreliable at arithmetic. A law firm cannot file a figure that is approximately right. So the design uses each tool for what it can be held to:

Task Done by Why
Read figures from a statement Language model Copes with scans and varying layouts
Decide a value is unreadable Language model, by returning nothing A gap is safer than a guess
Confirm or correct the figures A person, with the statement beside them Accountability
Calculate interest and totals Deterministic code with automated tests Must be exact and repeatable
Assemble the letter Template engine Same input, same document

The firm cut filing and checking time by 95% after moving to the platform. Most of that came from document assembly. Reading statements with a model removed one more stretch of typing, without adding a new way for errors to enter.

If you want to do this with your own documents

The pattern transfers to any business that retypes figures from documents: supplier invoices, delivery orders, lab reports, insurance schedules.

  1. Pick a small, fixed set of fields. Ask for exactly those.
  2. List the synonyms. Collect twenty real documents and note every label used for each field.
  3. Demand structured output and reject anything else.
  4. Make “unknown” a valid answer, and treat it as a task for a person.
  5. Keep the source document next to the extracted values so checking takes seconds.
  6. Never let the model do the sums.
  7. Know where the document goes. A statement of account contains personal and financial data. Decide which provider processes it, in which region, and tell the client.

Written by

Pikabyte Engineering

Pikabyte builds custom business systems, applied AI and secure cloud infrastructure from Malaysia. Talk to us.

The work behind this article

Platform · Legal · Banking litigation

From a bank's spreadsheet to court-ready documents, with every step on the record.

A multi-tenant platform for law firms that run banking litigation at volume. Monthly debtor lists become typed case records, letters and court documents are generated from the firm's own templates, and post-judgment interest is calculated to the cent in the bank's statement format.

95%
less time spent filing and checking
12,700+
court and recovery documents generated
3,500
debtor accounts taken through civil process
6 weeks
from kickoff to production
Tour Clausework Kek Ooi & Lee Hong · Malaysia

Start a conversation

Want this applied to your business?

Tell us what is slowing the business down. You will talk to an engineer, not a salesperson, and get a straight answer on whether software is the right fix.