# Reading documents with vision models instead of OCR > A vision model reads an invoice or form and returns fields as JSON. Where that beats classic OCR, where it fails silently, and a pipeline that checks every number. Source: https://rfriedmann.de/blog/reading-documents-with-vision-models/ Published: 2026-11-27 · Track: learn · Level: Ops Every IT department has a pile of documents that people still type into systems by hand: invoices, delivery notes, forms, the occasional handwritten sheet. For years the tool for that was OCR. Now there is a second option: give the page image to a model that can see, and ask it for the fields you want. Both are in use, and they fail in very different ways. That difference decides how you build the pipeline around them. ## Two ways to read a page **Classic OCR** works bottom up. It finds characters in the pixels, groups them into words and lines, and outputs text, usually with the position of every word. If you want the invoice number, you write rules on top: "the text to the right of 'Invoice no.'", or a template per supplier. The text is mechanical and the layout logic is yours. **A vision-language model (VLM)** works top down. The page image is cut into patches and turned into tokens the model reads alongside your question, the same way [a model sees any picture](/blog/how-models-see-images/). You do not ask for text, you ask for meaning: "extract supplier, invoice number, date, net, VAT and total as JSON". The model handles the layout itself, because it has seen millions of documents during training. ## Where vision models win - **Tables.** OCR gives you words with coordinates, and rebuilding rows and columns from those is fragile. A VLM returns the table as rows directly, including merged cells and headers that span two lines, most of the time. - **Forms and mixed layouts.** Checkboxes, stamps, a field label above the value in one form and next to it in another. Template rules break on every new layout, a VLM mostly does not care. - **Handwriting, to a degree.** Clear block letters often work. Hurried cursive, numbers squeezed into small boxes and faint carbon copies still go wrong. - **"Extract these fields as JSON".** This is the real gain. Instead of text you then have to parse, you get the target structure in one step. One prompt can cover many document types that would each need their own OCR template. ## Where they fail, and how The failure mode is what makes VLMs dangerous for documents. OCR fails visibly: a smudged digit becomes a wrong or odd character, and a broken line of text looks broken. A VLM fails plausibly. It produces a clean, well-formatted value that is simply not on the page, or it skips a row of a table and the result still looks complete. That is the same mechanism as [any made-up answer](/blog/why-models-make-things-up/): the model produces the most likely continuation, and a likely-looking invoice total is not the same thing as the total printed on this invoice. Concretely: - **Invented or skipped values.** A field that is missing or unreadable gets filled with something reasonable instead of being left empty. A line item disappears from a long table. - **Confidently misread digits.** 8 and 3, 1 and 7, a comma read as a decimal point. The output carries no hint that the model was unsure. Anthropic's own [vision documentation](https://platform.claude.com/docs/en/build-with-claude/vision#limitations) says that Claude "might hallucinate or make mistakes when interpreting low-quality, rotated, or very small images", and recommends human review for high-stakes use. - **Layout and fine detail are still weak spots.** In the [OCRBench v2 paper](https://arxiv.org/abs/2501.00321), most of the large multimodal models tested scored below 50 out of 100, with fine-grained perception, layout perception and complex element parsing among the named limitations. Newer models are better, but these are still the categories that fail. - **Long documents.** Every page costs context. Anthropic's [PDF documentation](https://platform.claude.com/docs/en/build-with-claude/pdf-support) says each PDF page is converted into an image and its text extracted, typically 1,500 to 3,000 text tokens per page plus the image tokens, and that dense PDFs can fill the context window before the page limit is reached. For a 200-page contract, split by section and extract per section. - **Cost per page.** OCR on your own server costs CPU time. A VLM API costs tokens per page, every time. What a page costs on an API can be calculated from the vendor's own numbers. As of November 2026, Anthropic's [vision page](https://platform.claude.com/docs/en/build-with-claude/vision#resolution-and-token-cost) gives the image cost as ⌈width / 28⌉ × ⌈height / 28⌉ visual tokens, with a limit of 2,576 px on the long edge for Claude 4.7 and later, and quotes Claude Opus 5.5 at $4 per million input tokens. An A4 page scanned at 150 dpi is 1240 × 1754 px, so 45 × 63 = 2,835 visual tokens. That is 2,835 × $4 / 1,000,000 = about $0.011 per page, or about $11 per thousand pages, before the prompt, the output tokens and any retries. Cheap per page, not cheap per year if you run the whole archive through it twice. ## A pipeline that checks every number Because the errors look correct, the model's answer is never the end of the pipeline. A pipeline that holds up looks like this:
Extraction is one step of five
[diagram omitted — see the page for the chart]
The model only proposes values. Validation in code decides which of them a person has to look at.
1. **Keep the original.** The scan or PDF is the record, the extracted data is a derivative. Store both, linked, and never overwrite the original with "cleaned" output. An e-invoice (XRechnung, ZUGFeRD), which German businesses must be able to receive since 2025, already carries its data as XML: read the XML, keep it as the original, and use the VLM only for paper and plain PDFs. 2. **Extract.** One request per page or per logical section, with a fixed list of fields and an explicit "not found" value for each, so the model has a legal way to say a field is missing instead of inventing one. 3. **Validate in code.** This is where most errors surface. Do the line items add up to the net amount? Is net plus VAT equal to the total? Is the VAT rate one that exists? Is the IBAN checksum valid, the date a real date, the supplier in your master data? Each check is a few lines of code and catches exactly the confident misreads the model will not admit to. 4. **Flag for a human.** Anything that fails a check, or is marked "not found", goes to a person with the page image next to the field. They correct only that field, not the whole document. Over time, the flagged fields tell you which document types the model handles badly. 5. **Archive.** For full-text search across the archive, classic OCR is still the better tool: it is cheap, it runs locally, and it outputs every word, not a selection. [OCRmyPDF](https://github.com/ocrmypdf/OCRmyPDF), for example, adds a searchable text layer to scanned PDFs. The VLM is for the fields you need in a system, OCR is for finding the document again in five years. If you later want to ask questions across those documents, that is a retrieval problem with its own setup, covered in [pointing an LLM at your own documents](/blog/your-own-documents/). ## Data protection Invoices, contracts, HR forms and medical letters are full of personal data. Sending them to a cloud API is processing under GDPR, with everything that comes with it: a legal basis, a processor agreement, and possibly a third-country transfer. I went through that in [AI and the law](/blog/ai-and-the-law-gdpr-ai-act/). For some document types the honest answer is that they should not leave the building at all. That is one of the cases where [running the model locally](/blog/why-run-ai-locally/) is the straightforward answer. Open vision models exist, and imp, the inference engine I build for a single RTX 5090, supports vision models such as the Gemma-4 and Qwen VL families. Whether a local model is good enough for your documents is something you have to measure on your own pages, with the same validation step in front of the archive. The pipeline does not change, only where the extraction runs. ## Bottom line Vision models read tables, forms and messy layouts far better than template-based OCR, and asking for fields as JSON removes a whole layer of parsing code. Their errors look like correct data, so treat every extracted value as a proposal: keep the original, check sums, formats and totals in code, and send only the failing fields to a person. Keep classic OCR for the searchable archive, and keep documents with personal data local where you can.