Document Automation · LLM + ML Hybrid
Rules, ML, or LLMs — how do you choose for document automation?
May 4, 2026 · 6 min read
The right answer is usually 'all three, tiered by cost' — not picking one technology and forcing every document through it. Here's the framework.
Why not just use an LLM for every document?
Because most documents don't need one. On a project processing roughly 1.6 million faxed pharmacy forms a month across 700+ locations, running every page through an LLM would have been slow and needlessly expensive — and a large share of those forms are unambiguous enough that a keyword rule can classify them with total confidence in milliseconds.
The mistake is treating 'which technology' as a project-level decision. It's a per-document decision, and the right system makes it automatically, page by page.
What does a cost-tiered automation pipeline actually look like?
Cheapest checks first. Keyword search attempts classification; a 100%-confidence match passes immediately with no model call at all. Only pages the rules can't confidently resolve go to an LLM with few-shot examples drawn from a reference set for that category. The same logic applies to extraction: regex handles structured fields, an LLM handles the complex or free-form ones.
Underneath all of it sits a confidence gate: anything — classification or extraction — that scores below a threshold (we used 90%) routes to a human review queue instead of flowing through automatically. The system doesn't have to be right about everything; it has to know when it isn't sure.
How do you decide where the taxonomy or categories come from?
From real data, not assumptions. Before building the classifier for the pharmacy-forms project, we clustered a full month of actual production volume — about 1.6 million forms — and let the categories emerge from that (50+ distinct types surfaced this way). Guessing the taxonomy from a handful of samples is one of the most common ways these systems under-perform in production: the categories you didn't anticipate are exactly the ones that show up at 2am with no rule to catch them.
See it in practice
Automating document intake for 700+ pharmacies
A hybrid LLM + machine-learning system that classifies and extracts data from roughly 1.6 million faxed pharmacy forms a month at 94% accuracy, feeding clean structured data straight into order creation.
Read the case study →Related articles
Generative AI · Document Intelligence
How do you stop LLM hallucinations in document extraction?
The fix isn't a smarter model — it's refusing to trust any model's output until it's proven against the source document. Here's the validation pattern we use in production.
Data Engineering · Apache Airflow
Why shouldn't your data pipelines run on a timer?
Polling every minute for new files feels safe. It's actually the single easiest way to overload an orchestration platform for no benefit. Here's what to do instead.
Work with us
