Design a document-extraction system. When do you use an OCR pipeline versus sending pages to a VLM?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Start with the decision axes: cost per page, accuracy on your specific fields, auditability, and document heterogeneity.
Full worked answer with diagram
Start with the decision axes: cost per page, accuracy on your specific fields, auditability, and document heterogeneity.
OCR pipeline: layout analysis + text recognition (open-source Tesseract/PaddleOCR, or managed Textract / Google Document AI / Azure Document Intelligence) produces text with bounding boxes; an LLM (or templates, for fixed forms) extracts fields from that text. Strengths: cheap at scale - managed OCR runs on the order of ~$1.50 per 1,000 pages for plain text (~10× more with table/form analysis), roughly an order of magnitude cheaper than frontier-VLM page reads - self-hosted OCR widens that to 100×+; character-level coordinates enable click-to-verify audit UIs and redaction; behaviour is stable and debuggable. Weaknesses: multi-column reading order, complex layouts, handwriting, stamps, checkboxes, and tables that span pages - and OCR errors poison the downstream LLM silently.
OCR-free VLM: send the page image with an extraction prompt, get structured JSON back. Strengths: handles layout, handwriting, and visual context jointly; one stage to build and maintain; dramatically better on messy heterogeneous documents. Weaknesses: cost; plausible-value hallucination on fields it can't read (worst possible failure for invoices and medical records); coordinates only if you explicitly ask for grounding, and those boxes are coarser than OCR word boxes, weakening auditability; resolution limits on dense pages.
Document-specialised small VLMs blur the line since 2025: open models such as olmOCR, PaddleOCR-VL, DeepSeek-OCR and dots.ocr, plus managed services such as Mistral OCR, turn page images into markdown with reading order and tables, some with layout boxes, at a cost much closer to OCR than to a frontier VLM when self-hosted. Treat them as a middle tier: they fix most reading-order and table problems of classic OCR, but they still hallucinate on illegible regions, so the validation layer below does not go away.
The production answer is a cascade: classify documents first; run cheap OCR on everything; handle clean, templated docs with the cheap path; escalate hard or high-value pages to a VLM - and when you do, give the VLM both the page image and the OCR text, since they fail differently and the combination beats either. Independently of path: validate against a schema (types, ranges, checksums like line-items-sum-to-total), compute per-field confidence, and route low-confidence extractions to human review. Measure per-field accuracy on a labelled set from your own traffic - public benchmark scores won't predict your invoice layout.
Worth sketching. Drawing the cascade shows you are choosing per page rather than picking one architecture for the whole corpus.
flowchart TD
A["Incoming page"] --> B["Classify document type"]
B --> C["Cheap OCR on everything"]
C --> D{"Clean and templated?"}
D -->|"yes"| E["OCR text plus small LLM"]
D -->|"no, or high value"| F["VLM on the page image<br/>plus the OCR text"]
E --> G["Schema, type and<br/>arithmetic validation"]
F --> G
G -->|"low confidence"| H["Human review queue"]
What a good answer covers
- Start with the decision axes
- OCR pipeline: layout analysis + text recognition (open-source Tesseract/PaddleOCR, or managed Textract /…
- Strengths: cheap at scale - managed OCR runs on the order of ~$1.50 per 1,000 pages for plain text (~10×…
- Weaknesses: multi-column reading order, complex layouts, handwriting, stamps, checkboxes, and tables…
- OCR-free VLM: send the page image with an extraction prompt, get structured JSON back
Key terms: OCR pipeline · OCR-free VLM · plausible-value hallucination · Document-specialised small VLMs · cascade
In the glossary: Accuracy · VLM · Hallucination · Grounding
Interviewer follow-ups to expect
How do you catch a VLM confidently misreading a dollar amount?
Where does human-in-the-loop go, and how do you decide the confidence threshold?
How does the calculus change at 10M pages/month?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep