Parsers first, models as rescue
A deterministic parser should read stable layouts; a language model is for the long tail no parser has seen. Route by layout, not by brand, and make parser-only mean exactly that.
ON THIS PAGE
Building Taxadoo, part 2 of 7. Lessons from building the statement engine behind Taxadoo, a UK bookkeeping product — the decisions and the failures, not the internals. The whole series.
For stable, repeated document layouts, a deterministic parser should read the document; a language model earns its place only on the long tail no parser has seen. The split is about what the layout lets you know in advance, and what your routing can still reason about when something goes wrong.
Route by layout, not by brand#
One bank issues several layouts: printed statement, app export, online export, loan statement. They may run in opposite directions and use different sign conventions. A per-bank setting has no correct value; it stores whatever the last layout to arrive implied. Keyed per bank, promoting one proven layout drags along its unproven siblings. Detection also needs the full document. Branding often appears only in a final-page footer, and a score of zero looks the same whether no parser exists or a parser was blocked. Search structural markers early, accept brand evidence anywhere except on transaction rows, and never let a brand claim a document on its own.
Trust the parser against itself, not the model#
Parsers promoted on agreement with a model prove little. A correct parser for a liability account can score near zero because the model was the one getting the signs wrong. The gate that works is whether the parser's own balance chain closes in its declared convention: every signed amount follows the same direction, and opening plus movements equals closing. Score readers against a corpus of real statements with proven answers, comparing date, signed amount and balance. Never compare descriptions; readers legitimately word them differently.
Keep facts apart from policy. A fact is observed: asset or liability, oldest-first or newest-first. A policy is how you read this layout. Give facts one order of precedence: what the parser's code declares, then what a person confirmed and cannot be overwritten automatically, then a learned default. Show which source each value came from.
Parser only means parser only#
A mode called parser only has to mean that. A safety net that quietly handed a chunk to the model when a chunk balance check failed made failures impossible to debug. The check failed because a matching transfer pair straddled a chunk boundary; the model emitted rows in reverse and produced a phantom divergence. Keep running the detection, but record "misfire observed" separately from "model rescued".
The long tail is a queue, not a ladder#
Unknown layouts arrive in bursts; statements of the same layout are often uploaded seconds apart. Raise a missing parser once. Let the database's insert-if-absent decide which sighting came first, and have only that writer send the alert. Key the request by what a person would say aloud: bank plus account type. Keep the reader contract pure: page text in, rows out, no database or I/O. That lets every parser run offline against the whole statement corpus.
Graduated trust modes and promotion ladders are scaffolding. Once a corpus can prove readers directly, replace them with a plain cascade: parsers first, then OCR, then model rescue, then one balance check over the whole file. The ladder's real job was to find out which layouts deserved parsers.
