Tools,

OCR GGUF models in llama.cpp, tested on a Mac

1,954 of 1,955

words, the best GGUF runs on 10 pages

Get the script

Two files, one server

An OCR GGUF is two files: the model and its mmproj, the image part. llama-server runs both.

Plain llama.cpp: 1,945 to 1,954 words

llama-server or llama-mtmd-cli, the same 10 pages. Times are not like for like: llama-mtmd-cli loads the model for every page.

Words found, of 1,955, and time for 10 pages
Model Words Time
LightOnOCR-2 1B 1,954 71.7 s
MiniCPM-OCR 1.0 1,954 16.4 s
Xiaomi-OCR-0 1,954 45.6 s
LightOnOCR-3 4B 1,953 129.5 s
HunyuanOCR 1.0 1,951 45.7 s
GLM-OCR 1,950 117.9 s
Unlimited-OCR 1,949 43.2 s
Qianfan-OCR, Nov 27 1,949 85.2 s
DeepSeek-OCR 2 1,948 83.3 s
FireRed-OCR 1,948 131.2 s
dots.ocr, Nov 27 1,946 496.5 s
LightOnOCR-3 0.8B, Nov 26 1,945 20.3 s
The GGUF file and build for each row
  • LightOnOCR-2 1B: ggml-org Q8_0, llama-server b12316.
  • MiniCPM-OCR 1.0: openbmb Q8_0, llama-server b11901, with the DSpark draft model; 21.5 s without it.
  • Xiaomi-OCR-0: prithivMLmods Q4_K_M, llama-mtmd-cli build 12359.
  • LightOnOCR-3 4B: mradermacher Q8_0, llama-server b12316.
  • HunyuanOCR 1.0: ggml-org Q8_0, llama-mtmd-cli b12470, pages at 1,280 px.
  • HunyuanOCR at the default page size: 1,949 words in 91.7 s.
  • GLM-OCR: ggml-org Q8_0, llama-mtmd-cli b12316.
  • Unlimited-OCR: sahilchachra Q8_0, llama-mtmd-cli b12391 with --jinja.
  • DeepSeek-OCR 2: sabafallah q8_0, llama-mtmd-cli b12316.
  • FireRed-OCR: mradermacher Q4_K_M, llama-mtmd-cli build 12359.
  • LightOnOCR-3 0.8B: prithivMLmods Q8_0, llama-server build 12359.
  • Qianfan-OCR: ggml-org Q8_0, llama-server build 12359.
  • dots.ocr: ggml-org Q8_0, llama-server build 12359.
  • Nov 27 times are the sum of the page times, in a night run.
  • Qianfan-OCR's 4-bit MLX copy read 1,951 words on our Qianfan-OCR test (bf16: 1,952).
  • dots.ocr in LM Studio, the same Q8_0 file: 1,946 words too, the same count on each page, in 417.4 s.

With a toolkit or LM Studio on top

The same kind of GGUF files, run through another app.

Words found, of 1,955, and time for 10 pages
Model, app Words Time
olmOCR-2 7B, olmocr 1,954 76.5 s
GLM-OCR, LM Studio 1,953 68.7 s
PaddleOCR-VL 1.6, LM Studio 1,950 45.5 s
MinerU2.5 Pro, mineru-llama-cpp 1,949 41.0 s
PaddleOCR-VL 1.6, doc_parser 1,947 72.8 s
dots.ocr, LM Studio 1,946 417.4 s
Surya 2.5, surya-ocr 1,926 55.6 s
The GGUF file and app for each row
  • olmOCR-2 7B: lmstudio-community Q8_0, llama-server b12316 + olmocr.
  • GLM-OCR: ggml-org Q8_0, LM Studio 0.4.26.
  • PaddleOCR-VL 1.6 in LM Studio: the same PaddlePaddle GGUF.
  • MinerU2.5 Pro 1.2B: jinzhenj Q8_0, mineru-llama-cpp 0.2.0, a warm run.
  • PaddleOCR-VL 1.6: PaddlePaddle GGUF, PaddleOCR doc_parser + llama-server b12316.
  • dots.ocr: ggml-org Q8_0, LM Studio 0.4.26.
  • Surya 2.5: datalab-to surya-ocr-2.5-gguf, the default file, surya-ocr 0.23.0 + llama-server b12316.
  • Surya with the Q8_0 file: 1,926 words in 49.7 s.

The older PaddleOCR-VL 1.5 has a PaddlePaddle GGUF too. Through doc_parser, it edged out 1.6 on our files.

Two commands: a server, then pages

Start llama-server with the model and its mmproj, then send it pages. We ran these two lines with GLM-OCR:

llama-server -m GLM-OCR-Q8_0.gguf --mmproj mmproj-GLM-OCR-Q8_0.gguf -c 16384 --port 8080
python3 gguf_ocr.py page1.jpg --prompt "Text Recognition:"

It read 201 of 202 words on page 1, the same text as our bench run.

gguf_ocr.py, the whole script
"""Send page images to a running llama-server and print the text (standard library only).

Usage: python3 gguf_ocr.py page1.jpg [page2.jpg ...] [--prompt "Text Recognition:"] > book.md
Start the server first, for example:
  llama-server -m GLM-OCR-Q8_0.gguf --mmproj mmproj-GLM-OCR-Q8_0.gguf -c 16384 --port 8080
"""

import argparse
import base64
import json
import urllib.request

ap = argparse.ArgumentParser()
ap.add_argument("images", nargs="+")
ap.add_argument(
    "--prompt",
    default="",
    help="the model card's OCR prompt; leave empty for image-only models",
)
ap.add_argument("--url", default="http://127.0.0.1:8080/v1/chat/completions")
a = ap.parse_args()
for path in a.images:
    with open(path, "rb") as f:
        b64 = base64.b64encode(f.read()).decode()
    content = [
        {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}}
    ]
    if a.prompt:
        content.append({"type": "text", "text": a.prompt})
    body = {
        "messages": [{"role": "user", "content": content}],
        "max_tokens": 4096,
        "temperature": 0,
    }
    req = urllib.request.Request(
        a.url, json.dumps(body).encode(), {"Content-Type": "application/json"}
    )
    with urllib.request.urlopen(req, timeout=600) as r:
        print(json.load(r)["choices"][0]["message"]["content"].strip() + "\n")

Each model wants its own prompt

Pass it with --prompt. For image-only models, leave it out. The 7 pairs we loaded:

Model Prompt
GLM-OCR, MiniCPM-OCR Text Recognition:
PaddleOCR-VL OCR:
dots.ocr Extract the text content from this image.
Qianfan-OCR Parse this document to Markdown.
LightOnOCR None, the image only

Build 12359: 7 of 7 loaded

Homebrew llama-server, page 1 of the scan (202 words).

GGUF pair Disk Page 1
GLM-OCR Q8_0 1.43 GB 201 in 5.0 s
PaddleOCR-VL 1.6 1.82 GB 201 in 1.7 s
MiniCPM-OCR 1.0 Q8_0 1.71 GB 202 in 3.3 s
LightOnOCR-2 1B Q8_0 1.09 GB 202 in 3.0 s
LightOnOCR-3 0.8B Q8_0 0.93 GB 196 in 2.2 s
dots.ocr Q8_0 3.24 GB 199 in 33.5 s
Qianfan-OCR Q8_0 5.05 GB 200 in 8.1 s
The seven GGUF repos
  • ggml-org/GLM-OCR-GGUF
  • PaddlePaddle/PaddleOCR-VL-1.6-GGUF
  • openbmb/MiniCPM-OCR-1.0-gguf
  • ggml-org/LightOnOCR-2-1B-GGUF
  • prithivMLmods/LightOnOCR-3-0.8B-GGUF
  • ggml-org/dots.ocr-GGUF
  • ggml-org/Qianfan-OCR-GGUF

Traps before the first page

Traps in the text

No Mac or GPU: our Actor

Our Apify Actor, PDF to Markdown OCR, reads scans in the cloud, with nothing to install.

Same 10 pages as our n8n test

Proofread Wikisource scans, 1,955 words, scored as true words found in order.

Not tested: tables, handwriting, other languages, a CUDA GPU.

How we ran it
  • Apple M5 Max, 128 GB. Homebrew llama-server 1.0.0, build 12359 (b1b770d90).
  • One server per model: -c 16384, --threads 2, --no-warmup, on 127.0.0.1, with the default Metal offload.
  • One request per page: the JPEG, 1920 px wide, the card's prompt, temperature 0, up to 4,096 tokens.
  • LightOnOCR: image only, temperature 0.2, top_p 0.9, seed 42, the page made smaller first, as in our earlier runs.
  • LightOnOCR-3 0.8B ran with --reasoning off, as the 4B ran.
  • LightOnOCR-3 0.8B also printed the running heads, which cost no true words. Its 10 lost words are formatting, not misreads: italics marks, a moved quote, one dash for the book's two.
  • LightOnOCR-3 0.8B's 20.3 s is the sum of its page times; with the server load, 24.9 s.
  • Budget: 240 s a model. It stopped dots.ocr during page 6.
  • The first 5 pages of dots.ocr: 1,011 of 1,016 words.
  • Night run, Nov 27: a budget of 1,800 s, so dots.ocr read all 10 pages.
  • Its first 5 pages found the same 1,011 words as on Nov 26.
  • Qianfan-OCR lost 6 words: a misread (tommyroth), the last word of page 1, and 4 punctuation marks.
  • dots.ocr lost 9 words: italics marks, one dash for two, a split quote, and 2 misreads (spanning, know).
  • Each GGUF at a fixed Hub commit, its SHA-256 checked after download, deleted after the runs.
  • One model at a time, at low priority, while other work ran, so times are rough.
  • Rows from earlier days come from our earlier tests, linked in the tables.
  • The Tesseract (--psm 3) and Actor numbers are from our Falcon test, on the same scan.
  • Scripts and results stay in our private repo, in research/bench/ocr-gguf-2026-11-26/.

Questions people ask

What is an OCR GGUF?

An OCR model in the GGUF format that llama.cpp reads. It comes as two files: the model and its mmproj, which reads the image. All 7 pairs we loaded on Nov 26 and 27 ran in Homebrew llama-server.

Which GGUF OCR model reads the most words?

On our clean scan, four GGUF runs found 1,954 of 1,955 words: olmOCR-2, LightOnOCR-2, MiniCPM-OCR 1.0 and Xiaomi-OCR-0. MiniCPM-OCR was the fastest of the four.

Why does my script get Connection refused from llama-server?

llama-server build 12359 listens on port 9931 by default. Start it with --port 8080, the port the script uses.