Lessons from automating 50,000 documents a month
What broke, what worked, and the architectural decisions behind a production OCR + LLM pipeline that cleared a four-month backlog.
There is a particular kind of project where the demo works on the first five documents and then breaks on document six in a way that nobody can explain for two days. Document AI is mostly that project, every day, forever. What follows is a short list of things I wish I had known earlier — written from inside a pipeline that processes about 50,000 documents a month.
OCR is not the bottleneck people think it is
Modern OCR is good. PaddleOCR, Tesseract 5, Google Document AI — they all hit 95%+ character accuracy on clean inputs. The thing that breaks your pipeline isn't OCR character accuracy; it's layout drift: a column that's slightly skewed, a stamp that overlaps a field, a scan where the bottom 5% is cropped because someone misaligned the feeder.
Two consequences:
- Spend your effort on preprocessing, not on switching OCR engines. Deskew, denoise, and layout normalization buy more accuracy than any model swap.
- Treat OCR confidence as load-bearing. If you don't pipe per-token confidence into the downstream LLM prompt, you're throwing away the most useful signal you have.
The LLM is doing interpretation, not seeing
A common mistake: hand the LLM the raw OCR text and ask for fields. It works on the easy cases and fails silently on the hard ones, because the model has no idea which characters are uncertain.
What works better: hand the LLM the OCR text plus a structured layout hint plus the per-region confidence. Now the model knows that "Account No: 12345I7" probably has an uncertain "I" that should be a "1", because the OCR confidence flagged it. This pattern alone moved our field-extraction error rate down by ~30% in our pipeline.
Verification beats accuracy
Spending another week tuning the model to go from 94% to 95% accurate costs you a week. Spending an afternoon adding a verification step against an authoritative external source costs you an afternoon and gives you 100% accuracy on whatever is verifiable.
For us, the verification step is a government API. For other domains it's a CRM, an ERP, an internal source-of-truth database. Whatever it is, find it and call it. The model proposes; the source of truth disposes.
Build the eval harness on day one
Three pipelines I have seen fail:
- "We'll add evals once it's working" — never gets added.
- "We track accuracy in a spreadsheet" — degrades into nobody updating it.
- "We have an eval set but no per-field breakdown" — average accuracy is fine while one critical field is at 60%.
A real eval harness is a flat file of (input, expected output) pairs, a script that runs the pipeline over them, and a dashboard that breaks down accuracy by field, document type, and OCR-confidence bucket. It is twenty lines of code. Build it before you build the pipeline.
Cache OCR keyed by content hash
Retries are the rule, not the exception. Re-running OCR on the same bytes is pure waste. Hash the input bytes, store the OCR output, look it up before re-running. We left ~10% of our compute on the floor for the first month because we skipped this.
If I had to compress all of this into one sentence: OCR + LLM pipelines fail at the seams between stages, not inside any one stage. Spend your design budget on the seams.