Choosing a Local Model for Invoice OCR and Line-Item Extraction
A small team that wants to pull supplier names, invoice numbers, totals, and line items out of invoices — without sending scanned documents to a third-party server — has to decide between a handful of different tools. Some of these tools are built specifically to parse business documents; others are general vision-language models that can look at an image and answer a question about it.
Choosing wrong means either overpaying for capability you don't need, or ending up with a model that can describe an invoice in general terms but can't reliably hand you a clean set of fields and rows. This article walks through which of our models does which job, and what actually changes your choice of deployment path.
What a small team actually needs from invoice extraction
Most invoices break down into three kinds of content, and each one asks something different of a model:
Header fields — supplier name, invoice number, invoice date, and similar single values that appear once per document. These are short text strings in a roughly fixed location, and getting them right is mostly a matter of accurate text recognition plus knowing which text belongs to which field.
Monetary totals — subtotal, tax, discounts, and the grand total. These are also short text values, but what makes them harder is that they need to add up: a model that reads the numbers correctly but doesn't preserve their relationship to each other isn't actually useful for bookkeeping.
Line items — the itemized table of descriptions, quantities, unit prices, and line totals. This is structurally the hardest part, because the model has to keep every row's cells aligned to the right row, not just recognize the text inside each cell.
A model aimed at general image understanding can read the text on an invoice and answer a question about a specific field, not just describe the document in general terms; both a general vision-language model and MiniCPM-OCR can be prompted to return structured fields. What should drive the model choice below is how well each path handles the task at hand: whether it follows the exact field names and format a team requests, whether individual field values come back correct, and — for the line-item table — whether every row's cells stay aligned to the right row.
Document extraction vs. general vision models
Illustrative mapping of invoice-related tasks to the OpenBMB model built for each role.
We build MiniCPM-OCR, a family of models aimed specifically at document parsing and text recognition. MiniCPM-OCR 1.0 parses a document image or PDF into text, tables, formulas, charts, and seals, producing structured output — Markdown or JSON — that preserves the document's own structure rather than turning every region into a table: a block of header text stays as text, and only the line-item table is returned as a table.
Pulling out one or more named fields, such as a supplier name or an invoice number, is a separate, more targeted use of the same model: key information extraction (KIE) sends the service an image together with a prompt naming the specific fields you want — the official KIE example requests a store name and an amount together in one prompt — rather than asking it to parse the whole page. The service returns those fields' values in the response, and a team still needs to parse the returned JSON and check that the keys and values match what was asked for before passing it downstream. Full-page parsing and field-specific KIE prompts cover different parts of the invoice-to-structured-data work: full-page parsing for the line-item table and the document's overall structure, KIE prompts for named values like the header fields above.
A separate model in the same family, MiniCPM-OCR Jev, does not do recognition itself. Given an original image region, its OCR candidate text, and a rendered image of that candidate text — which the service can render for you by default — MiniCPM-OCR Jev returns a quality score between 0 and 1 that reflects how closely the candidate matches the image, not whether the result is correct for a given business purpose: it does not validate business-field assignments or arithmetic. A team can use this score to flag regions that are more likely to be wrong and route them to a person for a quick check, using a review threshold validated on representative invoices from its own documents. Used this way, it works across the outputs of different parsing models; it doesn't improve accuracy on its own, but it can help reduce how much of the output a reviewer has to look at line by line, by pointing them toward the riskier regions first while the rest gets spot-checked.
For comparison, our general-purpose vision-language model, MiniCPM-V 4.7, is built to answer open-ended questions about an image or carry on a conversation about it — for example, "what does the handwritten note in the corner say." It runs locally on phones and tablets, with day-0 support for several non-PC chip platforms, which is useful when the task is a one-off visual question.
But answering a question in natural language is not the same output as a reliable, repeatable set of structured fields: MiniCPM-V 4.7 also has its own documented OCR and PDF-parsing usage guides and can be considered for extraction as part of broader visual tasks, while MiniCPM-OCR 1.0's dedicated document-parsing and key-information-extraction workflow makes it the sensible starting engine for a recurring, structured invoice-extraction task; MiniCPM-OCR, in turn, isn't built for an open-ended question that has nothing to do with document layout.
The table below summarizes which model handles which invoice-related task:
Invoice task
Model
What it does
Header and totals extraction
MiniCPM-OCR 1.0
Returns one or more named fields' values for a field-specific KIE prompt
Line-item table extraction
MiniCPM-OCR 1.0
Keeps table structure and row alignment
Flagging regions for review
MiniCPM-OCR Jev
Scores an existing OCR result's text-to-image match, doesn't extract
Open-ended questions about the document
MiniCPM-V 4.7
Answers in natural language from the image
How the invoice task maps onto the two-stage pipeline
For full-document parsing, MiniCPM-OCR 1.0 doesn't parse a page in a single pass. Run through the SDK, it works in two stages: first, a layout-detection step finds the distinct regions on the page — a block of header text, a table, a stamp or seal — and determines the order they should be read in; then each region is cropped and sent, individually, to the recognition model with a prompt that matches what kind of content it is (plain text, a table, a formula, and so on). The results are reassembled in reading order into a single structured output. A direct KIE call for one or more named fields doesn't go through this pipeline at all: it sends the image and a field-specific prompt straight to the recognition service, without a layout-detection pass.
That two-stage structure is directly useful for invoices: the header and totals usually land in their own text regions, while the line-item table is detected and recognized as a single table region, so layout detection proposes where a block of header text likely ends and the line-item table likely begins, rather than leaving the model to guess at that boundary region by region. Like any detector, it can still get a boundary wrong on an unusual layout, so it's worth a quick check on documents that don't follow a standard invoice format.
Assigning a specific recognized value to a specific named field, such as supplier name versus invoice number within the header region, is the job of a direct image plus field-specific KIE prompt, not of layout detection, whose job is limited to proposing region boundaries and reading order, not field identity. It also means an invoice's table recognition and its header's text recognition can be checked, and improved, somewhat independently if one is giving a team more trouble than the other.
Choosing a deployment path for a small team
Running MiniCPM-OCR locally for full-document parsing means setting up two things side by side: the layout-detection step, and a separate inference service that does the actual recognition. A direct KIE call for one or more named fields can skip layout detection and send the image, together with a field-specific prompt, straight to the recognition service. Our deployment documentation lists several supported recognition services, and which one makes sense depends on what hardware a team already has. Two of them — vLLM and SGLang — target Linux machines with an NVIDIA GPU and aim at higher-throughput server use; vLLM in particular involves building software from source and setting up a GPU toolkit, which is more setup than a small team typically needs.
Ollama is the option our guide treats as not requiring a source build or a separate GPU toolkit — it uses Ollama's own runtime, which is also what most small teams are already familiar with if they've used it for other local models.
A fourth option, llama.cpp, is a lighter CPU- and Apple-Silicon-friendly alternative, useful if a team is already standardized on it for other local models.
A fifth option is the official Docker image, which bundles the model weights, the SDK, vLLM, and the parsing backend into a single packaged server — useful for a team that wants the throughput of the vLLM route without assembling the build-from-source setup by hand. It requires Linux x86-64, an NVIDIA GPU, a driver compatible with CUDA 12.9, and Docker configured with the NVIDIA Container Toolkit, so it doesn't change the underlying hardware requirement: a Mac running Docker Desktop still can't run this GPU-backed image, and a team without that Linux/NVIDIA setup is still better served by Ollama or llama.cpp.
For the Ollama path, the model files for MiniCPM-OCR 1.0 — the recognition model, its vision component, and an acceleration file for faster decoding, all three required together from the same release — add up to roughly 2GB to download. That size matters mainly for initial setup time and disk space on a modest machine, not for how much memory the service needs while running.
The layout-detection step runs as a separate, lightweight piece of software on the same machine and needs to be installed alongside whichever recognition service a team picks. Given these conditions, Ollama is a convenient starting point for a small team that's already using it for other local models and doesn't have a dedicated GPU server: it avoids a from-source build and a separate GPU toolkit for the recognition service, though full-document parsing still needs the SDK's layout-detection environment installed alongside it.
Why amounts, tax, and line items shape the final choice
The clearest sign that a small team needs MiniCPM-OCR's structured, row-aligned extraction comes from the money fields. A grand total is only useful if it's attached to the correct invoice, in the correct currency, and consistent with the subtotal and tax lines above it — and that consistency check is something a team has to build into its own acceptance process regardless of which model produces the numbers, because getting individual digits right is not the same as getting the arithmetic relationship right.
Line items raise a related but distinct requirement: a model can recognize every number correctly and still misalign a quantity with the wrong row, so checking line items means confirming row count and row alignment, not just checking that the right numbers appear somewhere on the page.
This is also where MiniCPM-OCR Jev earns its place in the workflow, for a team processing enough invoices to make full manual review impractical: rather than reading every field on every invoice, staff can let the quality score route attention to the regions most likely to need a second look, while spot-checking a sample of the rest.
For a small team weighing its options, the practical path is to adopt MiniCPM-OCR 1.0 as the starting point for the extraction itself, deploy it through Ollama unless GPU infrastructure for vLLM or SGLang is already in place, and bring in MiniCPM-OCR Jev once invoice volume makes full manual review too slow. MiniCPM-V 4.7 is worth considering instead of, or alongside, MiniCPM-OCR when pulling fields off an invoice is one part of a broader visual-reasoning task — answering open-ended questions about the same document in the same conversation, for example — rather than a dedicated, recurring extraction job on its own.