Tools,

Xiaomi-OCR-0 on a Mac, tested on 10 scanned pages

1,954 of 1,955

words read, in every way we ran it

Get the script

It beat Tesseract on a clean scan

Xiaomi-OCR-0 is a 0.8B OCR model from xiaomi-research, on Qwen3.5-0.8B-Base, under Apache-2.0.

Words found, of 1,955, and time
Run Words Time
Xiaomi-OCR-0, mlx-vlm 1,954 37 s
Our Actor's code, on our Mac 1,880 54 s
Tesseract 5.5.4 1,878 34 s

This is a clean, easy scan; we tested nothing harder.

Five ways to run it, one score

All five found 1,954 words.

Time for 10 pages, and peak memory
Path Time Peak
mlx-vlm, bf16 repo 37 s 3.16 GB
mlx-vlm, 4-bit copy 39 s 2.22 GB
llama.cpp, Q4_K_M 46 s 1.51 GB
llama.cpp, BF16 66 s 2.50 GB
The card's transformers code 183 s 4.09 GB

llama.cpp times include a model load on every page. Peak is MLX's own count for mlx-vlm and the most resident memory for llama.cpp and the card: two different measures.

Install once, with uv and Python 3.12

uv venv --python /opt/homebrew/bin/python3.12 venv
uv pip install --python venv/bin/python "mlx-vlm==0.8.1"

For PDFs you also need pdftoppm, from poppler.

One script: scanned PDF in, text out

Save this as xiaomiocr.py. It loads the model once for the whole book:

import sys

from mlx_vlm import apply_chat_template, generate, load

PROMPT = (
    "Extract all information from the main body of the document image and represent it in markdown format, "
    "ignoring headers and footers. Tables should be expressed in OTSL format, formulas in the document should be "
    "represented using LATEX format, and the parsing should be organized according to the reading order."
)
model_id, *pages = sys.argv[1:]
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)
    print(r.text, flush=True)

Then run it on scan.pdf

pdftoppm -r 300 -jpeg -jpegopt quality=95 scan.pdf page
venv/bin/python xiaomiocr.py xiaomi-research/Xiaomi-OCR-0 page-*.jpg > book.txt

On our scan: 1,954 words in 58 s, with render and load. The first run also downloads the 1.75 GB model.

One page, from the command line

mlx-vlm's own command loads the model again for each page, so our 10 pages took 142 s. The first page included the download.

venv/bin/python -m mlx_vlm.generate --model xiaomi-research/Xiaomi-OCR-0 --max-tokens 4096 --temperature 0 --no-verbose --prompt "Extract all information from the main body of the document image and represent it in markdown format, ignoring headers and footers. Tables should be expressed in OTSL format, formulas in the document should be represented using LATEX format, and the parsing should be organized according to the reading order." --image page.jpg

In llama.cpp, strip the think tags

GGUF files: prithivMLmods/Xiaomi-OCR-0-GGUF. The prompt is the Document prompt, as in the script.

The llama.cpp command, with the full prompt
llama-mtmd-cli -m Xiaomi-OCR-0.Q4_K_M.gguf --mmproj Xiaomi-OCR-0.mmproj-bf16.gguf --image page.jpg -p "Extract all information from the main body of the document image and represent it in markdown format, ignoring headers and footers. Tables should be expressed in OTSL format, formulas in the document should be represented using LATEX format, and the parsing should be organized according to the reading order." --temp 0 -n 4096 -c 16384 > page.txt

Every page starts with an empty think block, or a lone closing tag with --jinja (mlx-vlm's default prompt is clean). No thinking text, no word lost. This sed line removes every tag:

sed -e '/^<think>$/d' -e '/^<\/think>$/d' page.txt

The card's code runs, 5 times slower

The card's transformers quickstart ran on MPS in float16. It made the same text as mlx-vlm with the bf16 repo, but took 183 s for 10 pages.

What transformers says, and the install line

transformers prints that it falls back to its reference PyTorch code, because causal_conv1d and flash-linear-attention are not installed. We did not try to install them.

uv venv --python 3.13
uv pip install "transformers==5.17.0" "torch==2.14.0" "torchvision==0.29.0" pillow

Two old repo names still redirect

What it got wrong: one closing quote

Same 10 pages as our Falcon test

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

Not tested: tables, formulas, handwriting, key information extraction, other languages, other GGUF sizes, a CUDA GPU.

How we ran it
  • mlx-vlm 0.8.1 and MLX 0.32.5, in a venv made by uv.
  • Python 3.12 (3.13 for the card's code) on macOS 26.6.
  • Repos: xiaomi-research/Xiaomi-OCR-0, playstonex/Xiaomi-OCR-0-4bit-mlx and prithivMLmods/Xiaomi-OCR-0-GGUF, each at a fixed commit. No repo holds a .py file. Every mlx-vlm load used trust_remote_code=False, and the card's code keeps the transformers default (off).
  • Each page as a 1920 px JPEG, temperature 0, up to 4,096 tokens. No page came near the limit.
  • llama.cpp from Homebrew, build 12359, one process per page. mlx-vlm and card times leave out the model load.
  • One Apple Silicon Mac, one job at a time, at low priority, while other work ran, so times are rough.
  • Tesseract: --psm 3. Our Actor: its code at build 0.1.145. Both rows are from our Falcon test today, on the same scan.
  • llama-mtmd-cli warns that Qwen-VL models need at least 1024 image tokens for grounding. We left --image-min-tokens alone.
  • Scripts and results stay in our private repo, in research/bench/xiaomi-ocr-2026-11-26/.

No Mac setup: our Actor

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

Questions people ask

Does Xiaomi-OCR-0 run on a Mac?

Yes. On Apple Silicon it ran in mlx-vlm, in llama.cpp with the GGUF files, and in the card's transformers quickstart on MPS. Each found 1,954 of 1,955 words on our scan. The quickstart was about 5 times slower.

Why does llama.cpp add think tags?

llama-mtmd-cli writes an empty think block at the top of every page, or a lone closing tag with --jinja. There is no thinking text, and no word is lost. The sed line on this page removes every tag.

Is the 4-bit MLX copy as good?

On our scan, yes. playstonex/Xiaomi-OCR-0-4bit-mlx found the same words, from 0.63 GB on disk against 1.75 GB. Its text differs from the bf16 repo in 11 places: all quote marks but one dash.

Is Xiaomi-OCR-0 free for business use?

xiaomi-research publishes it under Apache-2.0, which allows business use. Its base model and the GGUF and 4-bit copies we ran carry the same license. mlx-vlm and llama.cpp are MIT.