Document AI for billing
Document AI that cut a months-long billing backlog to about a week
Nothing could be billed until someone had read the delivery paperwork, and the ~20–25 people doing it were one to two months behind. I designed and built a multi-agent system that matches each document to its shipment and shows its evidence. It now matches ~70% with no person involved, the backlog is down to about a week, and the search I built on top became the company’s global search.
- Kind
- Production system, in daily use
- My role
- Owned it end to end and wrote the system myself
- Team
- Led one junior AI engineer on evaluation
- Scale
- 3,000+ documents a day
- Built for
- Billing, which waited months on paperwork read by hand
- Techniques
- multi-agent, evals, knowledge graph, graph database, RAG, entity resolution, shadow mode, human in the loop
Results
- of documents matched with no person involved
- → wrong matches
- of billing checking every auto-match before it ran alone
- → people on review, the rest moved to work that needed their judgment
- → billing backlog
- to the first live version
Delivered within a prior employer’s environment. Details are intentionally anonymized. I’m glad to discuss the operating problem, design principles, and production tradeoffs.
The problem
Paperwork arrived as one long scan stream, pages from different shipments mixed together, and every sender labelled the same numbers differently. I started by sitting with the reviewers to learn how they matched a page to a shipment.
Read every page as written.
A reader agent records what is on each page before anything is interpreted.
The call
Keep reading separate from deciding. My first version mixed them, and invented a shipment.
Techniques: multi-agent, document AI
Interpret it in the company’s language.
Specialist agents work out what each value means, under each customer’s own rules.
The call
Keep company records away from the agents that interpret. Shown the expected value, a model starts reading that instead of the page.
Techniques: parallel specialists, shared ontology
Match with evidence, then pass a gate.
A match agent proposes the shipment and its evidence. A gate in code decides if it goes through alone or to a person.
The call
Put the bar in code, where finance can read it, and lower it only as billing results proved it safe.
Techniques: entity resolution, confidence-gated autonomy, human in the loop
Test whole load packages, then prove it live.
The eval set was 50 real load packages, most 8 to 20 pages and a few over 80, each labelled by a billing reviewer. Code graded every step on every change: the fields read, the customer rules applied, the shipment matched.
The call
Fifty packages can’t prove it safe. So for a month billing checked every auto-match while they invoiced, and it ran alone only once about 70% held with no correction. Every miss since gets a reason tag and becomes a new test.
Techniques: evals, step-level grading, shadow mode, regression tests
It became the company’s search.
Every matched document joins our knowledge graph, so any entity can be searched along with its paperwork.
The call
Pair the graph with RAG. The graph finds the right records, and retrieval finds the right words inside them.
Techniques: knowledge graph, RAG, enterprise search
What broke first
What I tried
One model filling one form per shipment, tested one document at a time.
What broke
A bundle with two shipments became one record for a shipment that never existed. Later, the 80-page packages showed our upstream splitting was wrong too.
What changed
Split the work so the step that reads never decides, and test whole load packages instead of single pages.
In hindsight
Checkpoint every step, so a failed run resumes instead of starting over.
Ask me about
- The field everyone trusted that several shipments turned out to share
- What the 80-page packages broke, and how we fixed it
- What I’d score beyond the final match
