★ Reading this for free? Get 20 structured AI courses + per-chapter AI tutor — the first chapter of every course free, no card.Start free in 30 seconds

Z.ai · Open-Weight · MIT Weights

GLM-OCR: The 0.9B Model That Made Local OCR Actually Good

GLM-OCR is a 0.9-billion-parameter document-parsing model from Z.ai that ranks #1 overall on OmniDocBench V1.5 with a score of 94.62 — and the whole thing is a 2.2GB download (ollama pull glm-ocr). If your machine can run any local model at all, it can run this one: there is no VRAM math to do, no quant to agonize over. With 6.5M pulls it sits in the top 25 of the entire Ollama library. This guide covers the install, the two setup gotchas that trip most people (Ollama version, and the native-API quirk), the PDF-to-Markdown pipeline, and what a 0.9B specialist genuinely cannot do.

📅 Published: August 9, 2026🔄 Last Updated: August 9, 2026✓ Manually Reviewed

Quick answer: install & sizes

Update Ollama first (older versions refuse the pull — details below), then:

ollama pull glm-ocr
ollama run glm-ocr "Text Recognition: ./page.png"
TagDownloadRuns on
glm-ocr:latest2.2 GBAny modern GPU, or CPU-only
glm-ocr:q8_01.6 GBSame, slightly smaller footprint
glm-ocr:bf162.2 GBFull-precision weights

Tag sizes per the Ollama library page. At 0.9B parameters there is no meaningful VRAM barrier — even a 4GB card has headroom. If OCR is only one of the things you want your card to do, see the best Ollama models for 8GB VRAM or the full Ollama RAM/VRAM table.

Key takeaways

  • #1 on OmniDocBench V1.5 — 94.62 overall, per Z.ai's published results, ahead of far larger document-parsing pipelines.
  • Runs on anything — 0.9B parameters, 1.6-2.2 GB download. Hardware is a non-issue.
  • MIT weights, Apache 2.0 code — free for commercial products, no strings.
  • Two setup gotchas — needs a current Ollama build, and vision requests should use the native /api/generate endpoint, not the OpenAI-compatible one.
  • It's a specialist — brilliant at page→Markdown, not a general vision-chat model.

Quick verdict

If you have a folder of PDFs, scans, or screenshots you want as clean Markdown — papers into Obsidian, invoices into a database, textbook pages into notes — GLM-OCR is the local tool to reach for first. It occupies the same slot for documents that Whisper occupies for audio: a small, free, category-leading utility model that quietly beats paid cloud APIs at its one job. Whisper made local transcription a solved problem; GLM-OCR is doing the same for document parsing, and its 6.5M Ollama pulls in about six months say the crowd has noticed.

What it is not: a vision chatbot. The language decoder inside is GLM-0.5B — it transcribes and structures what it sees, it doesn't discuss it. If you want to ask questions about an image or document, pair it with a general VLM — our GLM-4.5V local setup guide covers the same lab's chat-capable vision model.

Specs at a glance

VendorZ.ai (zai-org)
Parameters0.9 billion total (CogViT vision encoder + cross-modal connector + GLM-0.5B decoder)
PipelineTwo-stage: PP-DocLayout-V3 layout detection → parallel region recognition
Context window128K tokens (per the Ollama library page)
InputsPDF, PNG/JPG, URLs, base64
OutputsMarkdown + JSON layout details
LicenseWeights MIT · code Apache 2.0 · PP-DocLayout-V3 Apache 2.0
Adoption6.5M Ollama pulls · ~3.8M Hugging Face downloads/month · 7.2k GitHub stars (checked Aug 2026)
ReleasedEarly 2026; technical report + SDK "Skill mode" followed March 12, 2026
Hugging Facezai-org/GLM-OCR

How the two-stage pipeline works

GLM-OCR's trick is that the 0.9B model never has to understand a whole page at once. Per the official repo, the full pipeline runs in two stages:

  • 1.Layout analysis. PP-DocLayout-V3 (an Apache-2.0 layout-detection model, integrated into the pipeline) carves each page into regions: text blocks, tables, formulas, figures, headers.
  • 2.Parallel recognition. Each region goes through GLM-OCR independently — the CogViT encoder reads the crop, a lightweight connector downsamples the visual tokens, and the GLM-0.5B decoder writes it out as Markdown, LaTeX, or structured table text. Regions run in parallel, which is why PDF throughput is higher than you'd guess for a sequential model.

This division of labor is why a sub-1B model tops a benchmark full of heavyweight pipelines: layout detection is a solved vision problem that doesn't need an LLM, and per-region transcription is a narrow task a small decoder can be trained to do extremely well. It also explains a quirk in the published speed numbers below — PDFs process faster per page than standalone images.

Ollama setup (and its two gotchas)

The happy path is three commands — but two gotchas catch a lot of people, so here they are up front.

Gotcha 1: you need a current Ollama build

I tried the pull on a Mac still running Ollama 0.12.3 (installed late 2025) and got a hard refusal: Error: pull model manifest: 412: The model you are attempting to pull requires a newer version of Ollama. Update from ollama.com/download (or brew upgrade ollama on macOS) before filing bug reports.

ollama pull glm-ocr
ollama run glm-ocr "Text Recognition: ./page.png"
ollama run glm-ocr "Table Recognition: ./table.png"
ollama run glm-ocr "Figure Recognition: ./chart.png"

Those three prompt prefixes — Text, Table, Figure Recognition — are the documented interface on the Ollama model page, not free-form chat. Use them.

Gotcha 2: use the native /api/generate endpoint

The official deployment guide is explicit about this: "due to limitations in Ollama's OpenAI-compatible API for vision requests, we recommend using Ollama's native /api/generate endpoint." So if you point an OpenAI-flavored client at :11434/v1 and get empty or mangled output, that's why. Calling the native API directly:

curl http://localhost:11434/api/generate -d '{
  "model": "glm-ocr:latest",
  "prompt": "Text Recognition:",
  "images": ["<base64-encoded page image>"],
  "stream": false,
  "options": { "num_ctx": 16384 }
}'

The num_ctx bump is my recommendation, not an official requirement: a dense page of tables can decode into thousands of Markdown tokens, and Ollama's default context is stingy — give it headroom so long pages don't truncate mid-table. The model itself supports 128K, so 16384 costs you nothing at this parameter count.

PDF to Markdown with the glmocr SDK

For real documents — multi-page PDFs, batches, anything with layout — skip raw Ollama prompting and use the official Python SDK, which runs the whole two-stage pipeline and writes Markdown plus JSON layout:

pip install glmocr
glmocr parse report.pdf        # CLI
# or in Python:
# from glmocr import parse
# result = parse("report.pdf"); result.save()

By default the SDK can call Z.ai's cloud API — for a fully local run, point it at your Ollama server in the config (this block is straight from the repo's Ollama deployment guide):

ocr_api:
  api_host: localhost
  api_port: 11434
  api_path: /api/generate
  model: glm-ocr:latest
  api_mode: ollama_generate

With that in place, nothing leaves your machine — the same privacy argument that makes local Whisper transcription the default for sensitive audio applies to your contracts, medical records, and financial statements here. The SDK also supports structured extraction against a JSON schema (per the model card), which is the feature to reach for if you're parsing invoices or forms into a database rather than into prose.

vLLM / SGLang for batch jobs

The deployment guide itself positions Ollama as the testing/personal-use route and recommends vLLM or SGLang for production throughput. The official serve commands, verbatim from the repo:

# vLLM
vllm serve zai-org/GLM-OCR --port 8080 \
  --speculative-config '{"method": "mtp", "num_speculative_tokens": 3}'

# SGLang
sglang serve --model-path zai-org/GLM-OCR --port 8080 \
  --speculative-algorithm NEXTN --speculative-num-steps 3

Note the speculative-decoding flags in both — the model ships with an MTP head, and Z.ai's commands enable it by default. Add --max-model-len and --gpu-memory-utilization to taste; the repo deliberately leaves those machine-dependent. On any 8GB+ card this is a trivially light serve — if you're sizing a box for it plus bigger models, our VRAM calculator does the math.

Benchmarks

Headline result: 94.62 on OmniDocBench V1.5, #1 overall — Z.ai's published claim, repeated on the Ollama library page, with state-of-the-art results reported across formula recognition, table recognition, and information extraction. All figures below are Z.ai's own published numbers, not our measurements.

MetricResultSource
OmniDocBench V1.5 (overall)94.62 · #1Model card / repo
Throughput — PDF1.86 pages/secModel card (single replica, single concurrency; GPU not stated)
Throughput — single images0.67 images/secModel card (same setup)

Two honest notes. First, PDFs outrun single images because the pipeline batches page regions in parallel; one screenshot can't be parallelized the same way. Second, Z.ai doesn't disclose the GPU behind those throughput numbers, so treat them as relative, not as a promise for your laptop — on small CPU-only machines expect a few seconds per page, not two pages a second.

Honest limitations

  • It reads documents; it doesn't reason about them. The decoder is a 0.5B GLM. Ask it to summarize, answer questions, or interpret a chart's meaning and you've left its competence zone — chain it with a real LLM for that (see which local vision task needs which model).
  • Fluent errors on bad scans. Like every neural OCR model, when the input is blurry or degraded it can produce confident, grammatical, wrong text instead of visible garbage. For archival or legal work, spot-check against the source.
  • The Ollama route is a convenience, not the product. Raw ollama run does single-image recognition with fixed prompt prefixes; the layout-aware PDF pipeline lives in the glmocr SDK. People who judge the model on a bare Ollama prompt against a full page are underselling it.
  • OpenAI-compatible endpoints misbehave. Tools that only speak :11434/v1 (some chat UIs) may fail on vision requests with this model — the official guide steers you to native /api/generate.
  • No official VRAM/hardware guidance. Fine in practice at this size, but the throughput figures come with no disclosed GPU, so benchmark on your own hardware before promising SLAs.

Frequently asked questions

How much VRAM does GLM-OCR need?
Z.ai publishes no official VRAM requirement, but the arithmetic is friendly: the default Ollama build is a 2.2GB download (q8_0 is 1.6GB) for a 0.9B-parameter model, so weights plus inference overhead fit comfortably on a 4GB GPU — and a laptop with no dedicated GPU can run it on CPU through Ollama, just slower. This is one of the very few genuinely useful models where hardware is a non-issue. If you have 6-8GB of VRAM, the same card also runs a small chat model alongside it.
How do I run GLM-OCR on a whole PDF, not just one image?
Use the official glmocr Python SDK (pip install glmocr) rather than raw Ollama. The SDK runs the full two-stage pipeline — PP-DocLayout-V3 splits each page into regions, then GLM-OCR recognizes the regions in parallel — and writes Markdown plus JSON layout data. It accepts PDFs, PNG/JPG images, URLs, and base64 per the repo docs, and you can point it at your local Ollama server (api_mode: ollama_generate) so nothing leaves your machine. Raw ollama run is fine for one-off screenshots; the SDK is the PDF-to-Markdown tool.
Why does ollama pull glm-ocr say I need a newer version of Ollama?
GLM-OCR needs a recent Ollama runtime. When I tried pulling it on a machine still running Ollama 0.12.3 (late 2025), the pull failed with a 412 error: "The model you are attempting to pull requires a newer version of Ollama." Update Ollama from ollama.com/download (or brew upgrade ollama on macOS) and the pull works. If glm-ocr gives you empty or garbage output through a third-party UI, that is usually the separate OpenAI-compatible-endpoint issue — use the native /api/generate endpoint instead.
Is GLM-OCR free for commercial use?
Yes. Per the zai-org/GLM-OCR repo, the model weights are MIT-licensed and the pipeline code is Apache 2.0 (the integrated PP-DocLayout-V3 layout model is also Apache 2.0). MIT weights are about as permissive as open-weight releases get — no revenue caps, no separate commercial license to negotiate. You can build a paid document-processing product on it.
Is GLM-OCR better than Tesseract or other traditional OCR?
For clean typewritten text on a plain background, traditional OCR is still fine and much lighter. GLM-OCR earns its keep on everything traditional OCR fails at: complex tables, multi-column layouts, formulas, figures, and reading order — the exact categories OmniDocBench measures, where it ranks #1 overall at 94.62. The honest trade: it is a neural model, so on degraded scans it can confidently produce fluent-but-wrong text rather than obvious garbage. Spot-check anything that matters. Our OCR tutorial covers when the traditional stack is still the right call.

Build a local document-AI stack

The Local AI Master deployment course covers serving models like GLM-OCR alongside your chat and embedding models on one box.

See the course →

Related guides

🎯
AI Learning Path

Go from reading about AI to building with AI

20 structured courses. Hands-on projects. Runs on your machine. Start free.

Or own it for life — Lifetime $149 $599, pay once
LM

Written by the Local AI Master Team

The team behind Local AI Master

We build Local AI Master around practical, testable local AI workflows: model selection, hardware planning, RAG systems, agents, and MLOps. The goal is to turn scattered tutorials into a structured learning path you can follow on your own hardware.

✓ Local AI Curriculum✓ Hands-On Projects✓ Open Source Contributor
More on Ollama
See the full Best Ollama Models 2026 guide.
📚
Free · no account required

Grab the AI Starter Kit — career roadmap, cheat sheet, setup guide

No spam. Unsubscribe with one click.

🎯
AI Learning Path

Found your model? Now build something with it.

25 hands-on courses — RAG, agents, fine-tuning — all running locally. First chapter free, no card.

Or own it for life — Lifetime $149 $599, pay once
Free Tools & Calculators