Case 03 / 08 · Private AI model
Bastion
An AI model trained on the client's own documents, running on their own server. Nothing leaves the building.
The problem
Sending every invoice, contract and customer file to an outside AI company is a risk many businesses will not take. General models also get industry paperwork wrong, and the API bill grows with every document.
How it works
Six steps,one system.
- 01Collect and clean
- 02Label
- 03Train
- 04Test against GPT
- 05Deploy on site
- 06Run and improve
Dataset · client archive
"Call [NAME] at [PHONE]"
40,057 past documents, cleaned. The model learns the format, not the people.
Thousands of the client's past documents are collected, cleaned, and stripped of personal data.
Inside
What I built,layer by layer.
01
Trained on their own work
An open model (Qwen, Llama) is fine-tuned with LoRA on the client's real documents, so it learns their brokers, formats and abbreviations.
02
Tested before it ships
Every new version is scored on documents it has never seen. It only replaces the old one if it is better on every field.
03
Runs where the data lives
One GPU server or Mac Studio in the client's office. A cloud model is only a backup, and only for documents the client allows.
Engineering decisions
01
Small and specialised beats big and general
A 7B model trained on one job outperforms a frontier model that has never seen a rate confirmation, at a hundredth of the cost.
02
Personal data removed first
Names, phone numbers and account numbers are masked before training, so the model learns the format, not the people.
03
Every answer has a confidence
Low-confidence fields go to a person instead of guessing, and each correction becomes training data for the next version.
Scale of the codebase
98.6%
fields read correctly, GPT 91%
$0.0004
per document, API was $0.02
1
machine on site, no internet needed
0
documents sent outside
Designed, trained, evaluated and deployed end to end: the data pipeline, the training runs, the test set, the on-site server and the fallback to a cloud model.
Next case
LaunchPilot →