GLM-OCR, tested on a real scanned PDF
1,950
of 1,955 scan words, read in order
On a Mac, use llama.cpp
GLM-OCR is a small model, 0.9B. Its GGUF model runs in llama.cpp on the Mac GPU.
1,950 of 1,955 words, in order
118 s for 10 pages, Mac GPU
Install Poppler for pdftoppm. Put llama.cpp and the two
Q8_0 GGUF files next to the PDF, then run sh glm.sh. You
get one Markdown file, book.md.
The full glm.sh script
pdftoppm -r 200 -png book.pdf page
for p in page-*.png; do
./llama-b12316/llama-mtmd-cli -m gguf/GLM-OCR-Q8_0.gguf --mmproj gguf/mmproj-GLM-OCR-Q8_0.gguf \
--image "$p" -p "Text Recognition:" --temp 0 --repeat-penalty 1.1 -n 8192 \
--no-warmup --threads 2 > "${p%.png}.md" 2>> cli.log || exit 1
done
cat page-*.md > book.md
The settings come from the SDK
The script uses the settings in the SDK's own config file:
- The prompt
Text Recognition: - Pages drawn at 200 dpi
- Temperature 0, repeat penalty 1.1, up to 8,192 tokens
The SDK also runs a layout model, PP-DocLayoutV3, and reads each block on its own. This script sends whole pages.
Typed pages: it dropped the heading
GLM-OCR reads every page as a picture, typed pages too. It read 11 of 13 words of the typed cover page. It left out the first line, COVER SHEET.
In the 11-page file, the scan words stayed at 1,950, in 116 s.
German: two columns close to our Actor
The script has no language option. I gave it 3 German pages. One is a magazine page with two columns. It kept the column order.
191 of 206 umlauts
951 of 972 words in order, two columns
Next to DeepSeek OCR on the same files: 30 more two-column words, 2 fewer umlauts.
GLM-OCR and our Actor: 3 rows each
Our Actor, from a file URL, with no install:
curl -s -X POST "https://api.apify.com/v2/acts/brasspage~pdf-ocr-to-markdown/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"documentUrls": ["https://api.apify.com/v2/key-value-stores/sTnmNrGoSsi7tLQvs/records/anythingllm-mixed-11-pages.pdf"]}' \
| jq -r '.[].markdown' > mixed.md
| Test | GLM-OCR | Actor |
|---|---|---|
| Scan words in order | 1,950 | 1,874 |
| Typed cover words | 11 | 13 |
| Umlauts | 191 | 192 |
| Two columns, in order | 951 | 954 |
| Time, 11 pages | 116 s | 133 s |
| Time, 3 German pages | 42 s | 59 s |
The Actor read 2 more cover words, 3 more two-column words and 1 more umlaut.
It needs no GPU and no 1.4 GB download. It costs $0.006 a page.
The license allows business use
The GLM-OCR model card says MIT. The SDK on GitHub is Apache 2.0. I read both before the download. Neither adds use terms.
How I tested it
- Scan: the 10 pages of OCR in n8n, proofread Wikisource book scans, 1,955 true words. The 11-page file adds the 13-word typed cover page of AnythingLLM OCR.
- German: the 3 pages of Paperless-ngx OCR, 1,887 words, 206 umlauts.
- Score: true words found in order in book.md, with the scorer of the tessdata test. German: the scorer of Tesseract German.
- llama.cpp b12316 for macOS on an Apple Silicon Mac GPU, at the lowest priority, 2 threads. GGUF revision 65a42de1148d, Q8_0 model and Q8_0 mmproj. Pages drawn at 200 dpi. Times include the model start on every page.
- One run each, but the 11-page file ran twice. In run 1, the first model start waited 16 minutes. The text was the same both times.
- The script above is the file that ran. The Actor: two real runs earlier the same day, build 0.1.65, on the same files.
What I did not test
- The SDK with its PP-DocLayoutV3 layout model, and the cloud API.
- The f16 file and the OCR prompt from the llama.cpp pull request.
- Transformers, vLLM, SGLang and NVIDIA GPUs. Ollama has its own test: Ollama OCR.
- Handwriting, tables, math, forms and JSON extraction.
Sources
Two ways to skip the work
Run it yourself. Our Apify Actor turns scanned PDFs into Markdown, tables included.
Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free.
Questions people ask
Does GLM-OCR run on a Mac?
Yes. With its GGUF model in llama.cpp on the Mac GPU, GLM-OCR read 10 scanned pages in 118 s. The two GGUF files are 1.4 GB.
What prompt does GLM-OCR need?
Text Recognition: for text. The SDK also has Table Recognition: and Formula Recognition:. Its config file sets 200 dpi, temperature 0 and a repeat penalty of 1.1.
Can a business use GLM-OCR?
Yes. The model card says MIT and the SDK is Apache 2.0, with no added use terms. Keep the license and notices if you share the model.
Related guides
- GOT-OCR 2.0 on a scanned PDF: Mac setup and results, tested
- Ollama OCR on a scanned PDF: 2 models tested on a Mac
- LightOnOCR on a scanned PDF: Mac setup and results, tested
- DeepSeek OCR on a scanned PDF: Mac setup and results, tested
- PaddleOCR-VL on a scanned PDF: Mac setup and results, tested
- dots.ocr on a scanned PDF: Mac setup and results, tested
- Chandra OCR on a scanned PDF: Mac setup and results, tested
- PDF to Markdown in Python: 5 libraries tested
- MarkItDown OCR: scanned PDFs, the plugin and Ollama, tested