Xiaomi-OCR-0 + Mirage (GGUF)
BF16 (transformers) Β· MLX Β· GGUF (llama.cpp)
Xiaomi-OCR-0 for llama.cpp, converted from the original weights at revision
bbd8cf8 with llama.cpp's converter (commit 1b6935b) and quantized with llama.cpp build 12359. Every pair
below is under 10^9 bytes and passed the rule; numbers were measured with llama-server on Apple Silicon (Metal).
These are plain quants, some with a text-only imatrix (llama-imatrix has no image input, so it was calibrated on the BF16 model's own answers).
| files | bytes | OCRBench | doc edit distance β | CORD F1 | |
|---|---|---|---|---|---|
Xiaomi-OCR-0-Q8_0.gguf + mmproj-Q8_0.gguf |
949,514,976 | 847 | 0.0836 | 78.10 | recommended |
Xiaomi-OCR-0-Q6_K-imat.gguf + mmproj-F16.gguf |
851,527,104 | 844 | 0.0834 | 77.55 | |
Xiaomi-OCR-0-Q6_K.gguf + mmproj-F16.gguf |
851,526,880 | 842 | 0.0823 | 77.70 | |
Xiaomi-OCR-0-Q4_K_M-imat.gguf + mmproj-F16.gguf |
746,890,176 | 841 | 0.0908 | 77.18 |
BF16 reference: OCRBench 843, document edit distance 0.0829, CORD F1 77.55.
Xiaomi-OCR-0-Mirage-bundle.gguf holds the recommended pair in one file. llama.cpp can't run it directly: unpack it first with
python gguf_bundle.py unpack Xiaomi-OCR-0-Mirage-bundle.gguf (standard library only), which restores the two files byte for byte.
Use
hf download Lucasgitguy-co/Xiaomi-OCR-0-Mirage-GGUF Xiaomi-OCR-0-Q8_0.gguf mmproj-Q8_0.gguf mirage_ocr.py --local-dir xiaomi-ocr-gguf
llama-server -m xiaomi-ocr-gguf/Xiaomi-OCR-0-Q8_0.gguf --mmproj xiaomi-ocr-gguf/mmproj-Q8_0.gguf --port 8080 -c 16384 --temp 0 --repeat-penalty 1 --jinja --reasoning off --image-min-tokens 64 --image-max-tokens 16384
Then send images to the OpenAI-compatible API with thinking off ("chat_template_kwargs": {"enable_thinking": false}),
or use the Mirage pipeline:
pip install "cactus-compute==4.2.0" rapidfuzz pillow huggingface_hub
python xiaomi-ocr-gguf/mirage_ocr.py page.png --task doc --backend llama --llama-url http://127.0.0.1:8080 --json
What Mirage does here
Mirage (Cactus Compute, Apache-2.0) is a 54M-parameter text detector and
reader that only runs inside the cactus-compute engine. Its forward pass and training code are not public, so it
cannot be merged into, distilled into or converted with Xiaomi-OCR-0. It runs beside the model in mirage_ocr.py:
- Boxes: with
--json, every output line gets the Mirage box whose text matches it best (fuzzy ratio β₯ 70), in 0β1000 coordinates. The text itself always comes from Xiaomi-OCR-0. - Zoom: Zoom (
--zoom: crop and upscale the region where Mirage found text, photos only) was tested on all 1000 OCRBench questions with the MLX BF16 model: overall 843 β 802, Scene Text-centric VQA 167 β 162 (of 200). It did not meet the pre-registered rule (overall not lower and scene text higher), so it is off by default. - No skip: Mirage reads Latin script only and found no text at all on 163 of 1000 OCRBench images that all contain text, so it is never used to decide that an image is empty.
Mirage's weights are not in this repo; mirage_ocr.py downloads them from Cactus-Compute/mirage at a pinned revision.
cactus-compute sends anonymous usage counts unless CACTUS_TELEMETRY=0; mirage_ocr.py sets it to 0.
Use --no-mirage to run Xiaomi-OCR-0 alone.
How it was evaluated
- OCRBench, all 1000 questions, official substring rule. OCRBench at n = 1000 has a standard error of about Β±1.2 points (12 questions), so differences of a few questions are noise.
- Documents: 100 OmniDocBench text pages (50 English, 50 Chinese), normalized edit distance (lower is better). This is an approximation, not the official OmniDocBench score.
- CORD v2 test, 100 receipts, field F1 with the CORD schema prompt.
- Same prepared image (Xiaomi's own resize: 2048 long edge, 32 px grid), raw non-thinking prompt, greedy decoding, no repetition penalty, for every backend. The MLX BF16 run is the reference: it scored 843 on OCRBench, matching Xiaomi's reported 84.6.
- Pass rule, written down before any candidate was scored: OCRBench within 10 questions of BF16, document edit distance at most 0.010 worse, CORD F1 at most 1.0 point worse, and every file needed to run at most 10^9 bytes.
- "Same output as BF16" is the share of answers that are character-for-character identical to the BF16 answer.
Distillation was tried and did not help. DWQ-style training of the 4-bit quantization scales against the BF16 model beat the plain 4-bit quant on only 1 of 3 benchmarks, and the 6-bit run diverged. Every quant published here is a plain quant. The DWQ model is listed in the full table for completeness and is not published.
All evaluated versions
| version | bytes | OCRBench (/1000) | doc NED β | CORD F1 | same output as BF16 (OCRBench / docs / CORD) |
|---|---|---|---|---|---|
| MLX BF16 (reference) | 1,726,071,379 | 843 | 0.0829 | 77.55 | reference |
| transformers BF16 (upstream weights) | 1,766,940,039 | 843 (+0) | 0.0823 (-0.0006) | 78.18 (+0.63) | 96% / 80% / 87% |
| MLX 6-bit plain | 833,276,908 | 846 (+3) | 0.0844 (+0.0015) | 77.67 (+0.12) | 93% / 75% / 65% |
| MLX 4-bit DWQ | 645,299,748 | 831 (-12) | 0.0888 (+0.0059) | 78.58 (+1.03) | 84% / 50% / 26% |
| MLX 4-bit plain | 645,303,148 | 836 (-7) | 0.0877 (+0.0048) | 77.23 (-0.32) | 84% / 50% / 22% |
| GGUF BF16 + mmproj F16 | 1,762,648,800 | 843 (+0) | 0.0831 (+0.0002) | 78.07 (+0.52) | 94% / 71% / 89% |
| GGUF Q8_0 + mmproj Q8_0 | 949,514,976 | 847 (+4) | 0.0836 (+0.0007) | 78.10 (+0.55) | 94% / 70% / 83% |
| GGUF Q6_K + mmproj F16 | 851,526,880 | 842 (-1) | 0.0823 (-0.0006) | 77.70 (+0.15) | 92% / 69% / 77% |
| GGUF Q4_K_M + mmproj F16 | 746,889,952 | 841 (-2) | 0.0912 (+0.0083) | 75.63 (-1.92) | 88% / 63% / 25% |
| GGUF Q6_K (text imatrix) + mmproj F16 | 851,527,104 | 844 (+1) | 0.0834 (+0.0005) | 77.55 (+0.00) | 93% / 70% / 73% |
| GGUF Q4_K_M (text imatrix) + mmproj F16 | 746,890,176 | 841 (-2) | 0.0908 (+0.0079) | 77.18 (-0.37) | 88% / 59% / 33% |
| MLX BF16 + Mirage zoom | 1,726,071,379 | 802 (-41) | 0.0829 (+0.0000) | 77.55 (+0.00) | 90% / 100% / 100% |
Licence
Apache-2.0 (LICENSE, NOTICE). The weights are Xiaomi-OCR-0's (xiaomi-research/Xiaomi-OCR-0, revision
bbd8cf8, Apache-2.0, built on Qwen3.5-0.8B). Mirage and cactus-compute are Apache-2.0. The evaluation and
calibration data (OCRBench, OmniDocBench, CORD v2 CC BY 4.0, DocVQA, TextVQA) are not included.
How everything was made, step by step: GUIDE.md. Part of the OCR and document extraction collection.
Related: the receipt LoRA Xiaomi-OCR-0-CORD-MLX-LoRA.
- Downloads last month
- 311