Tools,

MLX OCR: 6 models on 10 scanned pages

1,953 of 1,955

words GLM-OCR read, in 39 s

Get the script

mlx-vlm runs OCR models on the Mac GPU. All six read well. Three traps come first, each with a short fix.

GLM-OCR read the most words

Words found, of 1,955, and time for 10 pages
Model Words Time
GLM-OCR 1,953 39 s
Unlimited-OCR 1,951 32 s
DeepSeek-OCR 2 1,947 32 s
dots.ocr 1,946 124 s
DeepSeek-OCR 1,944 27 s
PaddleOCR-VL 1.6 1,942 20 s
Tesseract 5.5.4, no MLX 1,878 35 s
Our Actor's code, on our Mac 1,879 41 s

Each page went in as a 1920 px JPEG with the model's own OCR prompt, at temperature 0. Times leave out the model load.

Which MLX copies we used
mlx-community copies: size on disk, peak memory
Copy Disk Peak
GLM-OCR-bf16 2.2 GB 4.0 GB
Unlimited-OCR-8bit 3.9 GB 6.9 GB
DeepSeek-OCR-2-8bit 4.0 GB 5.4 GB
dots.ocr-8bit 4.4 GB 6.7 GB
DeepSeek-OCR-8bit 3.9 GB 5.4 GB
PaddleOCR-VL-1.6-4bit 0.7 GB 1.8 GB

Peak is the most memory MLX used while it read the 10 pages. We took the most downloaded copy of each model.

Faster than LM Studio on our Mac

Time for the same 10 pages
Model mlx-vlm LM Studio
GLM-OCR 39 s 69 s
Unlimited-OCR 32 s 62 s
DeepSeek-OCR 27 s 60 s
dots.ocr 124 s 417 s
PaddleOCR-VL 1.6 20 s 46 s

The LM Studio runs used the same pages and prompts, earlier the same night, with GGUF files in its llama.cpp engine. Our MLX copies range from 4-bit to bf16. We did not test LM Studio's MLX engine.

Words found stayed close. The biggest gap: PaddleOCR-VL's 4-bit copy found 8 fewer.

DeepSeek-OCR needs one flag in Python

In Python, both DeepSeek-OCR models stopped at load() with "Unrecognized processing class". The real error was hidden: transformers wanted the model's own Python code, with torch, torchvision, addict and matplotlib.

model, processor = load("mlx-community/DeepSeek-OCR-8bit", trust_remote_code=False)

With it, no code from the model repo runs, and both load. The mlx_vlm.generate command already passes it.

The model card command stops early

Four of the six mlx-community cards show --max-tokens 100 and "Describe this image." GLM-OCR stopped a third of the way down page 1. DeepSeek-OCR described the page instead of reading it.

Use the OCR prompt and room for a full page:

mlx/bin/python -m mlx_vlm.generate --model mlx-community/GLM-OCR-bf16 \
  --max-tokens 4096 --temperature 0.0 \
  --prompt "Text Recognition:" --image page-01.jpg

That read 201 of 202 words on page 1, for GLM-OCR and for DeepSeek-OCR with its own prompt.

Install once, with an Apple Silicon Python

brew install poppler [email protected]
python3.12 -m venv mlx
mlx/bin/pip install mlx-vlm==0.7.12

If the install finds no mlx for your Mac, that Python is an Intel build. uv picked one on our Mac. This must print arm64:

python3.12 -c "import platform; print(platform.machine())"

One script: scanned PDF in, text out

Save this as mlxocr.py:

import re
import sys

from mlx_vlm import apply_chat_template, generate, load

model_id, prompt, *pages = sys.argv[1:]
# Left unset, mlx-vlm turns trust_remote_code on, and DeepSeek-OCR fails to load.
model, processor = load(model_id, trust_remote_code=False)
chat = apply_chat_template(processor, model.config, prompt, num_images=1)
for page in pages:
    r = generate(model, processor, chat, [page], max_tokens=4096, temperature=0.0)
    # DeepSeek-OCR and Unlimited-OCR add layout tags. Drop them.
    print(re.sub(r"<\|(ref|det)\|>.*?<\|/\1\|>", "", r.text, flags=re.S), flush=True)

Then run it in the folder with scan.pdf:

pdftoppm -r 300 -jpeg -jpegopt quality=95 scan.pdf page
mlx/bin/python mlxocr.py mlx-community/GLM-OCR-bf16 "Text Recognition:" page-*.jpg > book.txt

On our scan it found 1,953 words in 48 s, page render and model load included.

The prompt for each model
  • GLM-OCR: Text Recognition:
  • Unlimited-OCR: document parsing.
  • DeepSeek-OCR and DeepSeek-OCR 2: <|grounding|>Convert the document to markdown.
  • dots.ocr: Extract the text content from this image.
  • PaddleOCR-VL: OCR:

Same 10 pages, one scorer

The 10 pages are proofread Wikisource scans, 1,955 words in all. The score is true words found in order, with exact case and punctuation, curly and straight quotes counted the same.

How we ran it
  • mlx-vlm 0.7.12 and MLX 0.32.4.
  • Python 3.12 on macOS 26.6.
  • Each model from Hugging Face at a fixed commit.
  • One Apple Silicon Mac, one model at a time, at low priority, so times are rough.
  • GLM-OCR and Unlimited-OCR ran twice. Each gave the same text both times.
  • Before scoring, we removed the layout tags that both DeepSeek-OCR models and Unlimited-OCR add.
  • Licenses: mlx-vlm and MLX are MIT, and the models MIT or Apache-2.0. dots.ocr adds its own agreement, and our public domain scan fits it.

Scanned pages to text, no install

Run it yourself. Our Apify Actor reads PDF, PNG, JPEG, WEBP and TIFF for $0.006 a page, with nothing to install. Its code found 1,879 of these 1,955 words.

Try the Actor

Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free.

Get one page free

Questions people ask

What is the best MLX model for OCR?

GLM-OCR read the most, 1,953 of 1,955 words. PaddleOCR-VL was the fastest and the smallest, and it found 11 fewer words.

Why does mlx-vlm say Unrecognized processing class for DeepSeek-OCR?

In mlx-vlm 0.7.12, load() turns trust_remote_code on when you leave it out, and then DeepSeek-OCR fails. Pass trust_remote_code=False. The mlx_vlm.generate command needs no change.

Is MLX faster than LM Studio for OCR?

On our Mac, yes, for all five models we ran in both, though the model files differ. We tested LM Studio with its llama.cpp engine, not its MLX engine.

Does DeepSeek-OCR 2 work with MLX?

Yes. mlx-community/DeepSeek-OCR-2-8bit found 1,947 of 1,955 words. In Python it needs the same trust_remote_code=False fix as DeepSeek-OCR.

Can I use these models at work?

mlx-vlm and MLX are MIT. The models are MIT or Apache-2.0. dots.ocr adds its own agreement, which allows business use.