Why bother
The bar was to match the accuracy we already have. Not beat it, match it. Our model has 8 billion
parameters and runs on one rented GPU. The model it's up against runs in Google's data centres,
estimated to be in the trillion-parameter class.
Cost. Using our models versus paying for an API endpoint will yield 90% to 99% cost savings as
processing scales. Replacing this one step doesn't delete the whole bill today: in testing it takes
roughly ten percent off, since some other steps dominate the process in size. Ten percent is already a
few thousands of dollars a month.
Time. Our reader takes 3.6 seconds at the median to read a document; the endpoint takes 18.4
seconds for the same task. Which is a 5x speed increase, from a model a fraction of the size, sitting
next to the pipeline instead of across the internet.
Independence. Today, every invoice Light reads is a call to another company. That company decides
when the model changes, when the old one is switched off, what it costs, and how fast we're allowed to
call it. None of those are hostile acts; they're just decisions made by people whose priorities aren't
ours. A model whose weights sit on our own disk doesn't change unless we change it.
Privacy. Having full control of the data in our own environment is a strategic priority for us at
Light.
Optionality. With a fine-tuning pipeline we retain much more optionality. Open models improve every
few months, and we're now positioned to take that improvement.
The labels were already in the database
The usual first obstacle to fine-tuning is that you have no training data. We didn't have that problem:
the product has been generating it for years. The pipeline proposes an extraction. A finance person
reviews and corrects it. The approved result is stored. That leaves every processed invoice as a PDF
with a human-checked JSON object beside it: tens of thousands of documents from the last month,
after filtering to customers whose agreements permit training.
Pixels, not text
An invoice PDF comes in two flavours. Most are digital, generated by someone's billing software, and
carry an embedded text layer you can extract exactly. About 9% are scans: a photograph of a piece of
paper, with no text in it at all.
The obvious architecture is to branch: extract text where you can, OCR where you can't, feed text to a
language model. We didn't do that. We send the whole document, every page, as images, to a
vision-language model, and we do no OCR at all.
The reasoning is that the information you need is often positional, not textual. Which of the four
numbers on the page is the total? Usually the bold one in the box at the bottom right, while
"Subtotal," "VAT," "Total," and "Amount Due" all sit within a few lines of each other. Which date is
the due date? Frequently nothing but position tells you. The vendor's name is very often a logo, which
is to say an image containing no text whatsoever.