Roboflow
Z.ai

Z.ai: GLM-OCR

GLM-OCR Overview

GLM-OCR is a multimodal OCR model for complex document understanding, built on the GLM-V encoder-decoder architecture by Zhipu AI. The model combines a 0.4B-parameter CogViT visual encoder pre-trained on large-scale image-text data, a lightweight cross-modal connector with efficient token downsampling, and a 0.5B-parameter GLM language decoder, totaling 0.9B parameters. To address the inefficiency of standard autoregressive decoding in deterministic OCR tasks, GLM-OCR introduces a Multi-Token Prediction (MTP) mechanism that predicts multiple tokens per step, significantly improving decoding throughput while keeping memory overhead low through shared parameters. Training proceeds through four stages: visual encoder pretraining with MIM, CLIP, and distillation objectives; vision-language pretraining on document parsing, grounding, and VQA data; supervised fine-tuning on curated OCR datasets covering text, formula, table, and key information extraction; and full-task reinforcement learning to improve accuracy and structural consistency.

At the system level, GLM-OCR adopts a two-stage pipeline in which PP-DocLayout-V3 first performs layout analysis, followed by parallel region-level recognition. This design enables robust handling of diverse document layouts including tables, formulas, and multi-column text. The model supports document parsing and targeted recognition tasks, producing structured outputs in Markdown, JSON, and LaTeX formats across more than 100 languages. On the OmniDocBench V1.5 benchmark, GLM-OCR scores 94.62, and achieves 94.0 on OCRBench and 96.5 on UniMERNet for formula recognition.

GLM-OCR Interactive Demo

GLM-OCR Details & Performance

Details

Resources

Vision Tasks

OCRDocument Question AnsweringVisual Question AnsweringVision LanguageChart Question Answering

Features

Multimodal VisionLLMs with Vision Capabilities

Usage

Past 30 Days

Performance

Avg. Latency

Arena Rankings

GLM-OCR Vision Evals

GLM-OCR has not yet been evaluated on the current benchmark. The results below are from the legacy version of Vision Evals, our previous benchmark. See the current Vision Evals

HighestLowest
This model#8 of 5887.34% pass rate · better than 84%
Score87.34%pass rate across 229 tasks
Speed1.00savg response per task
Costpricing unavailable
Tokenstokens unavailable
Score key:≥75%40–74%<40%
CategoryPassedScore
Handwritten Math10 / 10
100%
Text Recognition27 / 30
90%
License Plate Recognition27 / 30
90%
Focused Scene OCR87 / 99
87.9%
VQA & Extraction49 / 60
81.7%

Scores based on a single evaluation run · Methodology

View all legacy Vision Evals results →

Price vs. performance

Estimated cost per task vs. OCR score, for this model and others ranked near it. Upper-left is the sweet spot (high quality, low cost). Based on Vision Evals (legacy) results.

10 of 11 models plotted · 1 not yet evaluated

ModelScoreMedian tokensEst. cost / taskCompare
GoogleGemini 3 Flash93.0%1.3K$0.0010Compare
GoogleGemini 3.5 Flash90.4%1.3K$0.0034Compare
GoogleGemini 3.1 Flash-Lite90.0%1.1K$0.0003Compare
GoogleGemini 3.1 Pro89.5%1.1K$0.0024Compare
AnthropicClaude Fable 589.5%782$0.014Compare
Z.aiGLM-OCR(this model)87.3%
AnthropicClaude Opus 4.887.3%670$0.0049Compare
AnthropicClaude Opus 4.786.9%1.1K$0.0069Compare
QwenQwen3.5 27B85.6%273$0.0002Compare
GoogleGemma 4 31B84.7%423$0.0001Compare
AnthropicClaude Sonnet 583.8%725$0.0019Compare

Alternatives to GLM-OCR

Other models worth comparing for similar use cases.

Qwen
Qwen3 VL 8B Instruct
Qwen3 VL 8B Instruct is an open-weight multimodal vision-language model developed by Qwen / Alibaba Cloud as part of the Qwen3-VL series, designed for instruction-following tasks that combine text with visual inputs such as images and video. Released around October 2025 under the Apache-2.0 license, it targets developers who need capable multimodal reasoning without the scale or cost of very large models.The model contains roughly 8.8 billion dense parameters and supports text, image, and video understanding with strong spatial perception, visual reasoning, and emerging visual agent abilities such as GUI interaction. A standout feature is its native ~256K token context window, extendable to around 1M tokens, enabling long-document reading and extended video comprehension. In today’s landscape, it balances openness, long-context capacity, and solid multimodal performance against heavier proprietary models. Typical applications include multimodal assistants, document and video analysis, visual question answering, and research or product prototyping where transparency and deployability matter.
Qwen
Qwen3.5 9b
Qwen3.5-9B is a 9-billion-parameter multimodal foundation model developed by Alibaba Cloud's Qwen team, released on March 2, 2026 as part of the Qwen3.5 model family. Designed for efficient multimodal reasoning and long-context language tasks, it notably outperforms the older Qwen3-30B, a model more than three times its size, on key benchmarks including GPQA Diamond, IFEval, and LongBench.The model supports vision-language inputs through an early-fusion multimodal architecture built on a dense hybrid foundation of Gated Delta Networks and Gated Attention. It can also operate in a text-only mode by skipping the vision encoder during inference. It provides a 262,144-token context window (extensible to ~1M tokens via YaRN) and is released under the Apache License 2.0. Within the current AI landscape, Qwen3.5-9B offers a strong balance of capability and efficiency, making it well-suited for multimodal assistants, document analysis, long-context reasoning, and developer-deployed agentic systems.
Google
PaliGemma 2
PaliGemma 2 is a vision-language model released in December 2024 by Google DeepMind. It pairs the SigLIP-So400m vision encoder with the Gemma 2 language model family, extending the original PaliGemma architecture with stronger language capabilities and a wider set of transfer benchmarks. The model is designed primarily as a fine-tuning base rather than a chat-optimized assistant. Google releases pretrained "PT" checkpoints intended for task-specific adaptation rather than direct out-of-the-box use.PaliGemma 2 accepts an image paired with a text prompt and generates natural language output, supporting image captioning, visual question answering, optical character recognition, document understanding, object detection and segmentation (with appropriate fine-tuning), and a range of specialized vision-language tasks. The model is released at three parameter sizes (3B, 10B, and 28B), built on the Gemma 2 2B, 9B, and 27B language backbones. Each size is available at three input resolutions: 224, 448, and 896 pixels. Alongside the base PT checkpoints, Google released PaliGemma 2 Mix variants that have been tuned on a mixture of downstream tasks to provide stronger out-of-the-box performance for common applications such as OCR and document parsing. PaliGemma 2 is distributed under the Gemma license, a custom license from Google that permits commercial use subject to the terms of the Gemma Prohibited Use Policy.
Google
Gemini 3.1 Flash-Lite
Gemini 3.1 Flash-Lite is a natively multimodal reasoning model from Google DeepMind in the Gemini 3 series, based on the Gemini 3 Pro architecture. It processes text, image, video, audio, and PDF inputs within a 1 million token context window and produces text output up to 64K tokens. The model targets high-volume, latency-sensitive workloads and supports visual question answering, image and document data extraction, content moderation, classification, translation, automated speech recognition, and agentic data pipelines. It exposes configurable thinking levels of minimal, low, medium, and high, which set the depth of internal reasoning applied per request and let developers balance response quality against cost and latency.On benchmarks reported at launch, Gemini 3.1 Flash-Lite scores 86.9% on GPQA Diamond and 76.8% on the MMMU Pro multimodal benchmark, and reaches an Elo score of 1432 on the Arena.ai leaderboard. According to Artificial Analysis benchmarks, it produces a 2.5 times faster time to first answer token and a 45% increase in output speed relative to Gemini 2.5 Flash. It also shows improved instruction following, higher audio input quality for automated speech recognition tasks, and support for structured JSON output used in data extraction pipelines.
OpenAI
GPT-5.4 Nano
GPT-5.4 nano is a high-throughput model developed by OpenAI and released on March 17, 2026, as the efficiency-optimized entry in the GPT-5.4 family. Engineered for cost-sensitive production environments and latency-critical workloads, it features an expanded 400,000-token context window that enables the processing of large document batches or extensive logs in a single pass. The model is primarily optimized for text-heavy operations, serving as a premier engine for high-volume classification, data extraction, ranking, and the orchestration of lightweight sub-agents where speed and low per-token costs are the primary requirements.While it supports text and image inputs, GPT-5.4 nano is designed as a text-first worker rather than a specialized visual reasoning tool. In multi-model architectures, it is best utilized for structured text tasks and simple coding sub-tasks, leaving intensive vision reasoning and UI navigation to its sibling, GPT-5.4 mini. Compared to the previous GPT-5 nano, this version provides a significant leap in reliability for structured outputs and tool calling, making it a dependable and economical choice for developers building scalable, automated pipelines that require rapid execution at the edge of the GPT-5.4 ecosystem.
Azure
Florence-2
Florence-2, introduced by Microsoft Research at CVPR 2024, is an open-source vision-language foundation model designed to unify diverse computer vision tasks within a single sequence-to-sequence framework. Unlike traditional models that specialize in specific tasks, Florence-2 accepts both images and text prompts and outputs text for tasks such as captioning, object detection, segmentation, OCR, and region-based grounding. It comes in two sizes—Florence-2-base (~230M parameters) and Florence-2-large (~770M parameters)—and is trained on FLD-5B, a large dataset of ~126M images with ~5.4B annotations.The model demonstrates strong zero-shot and fine-tuned performance, often rivaling larger vision-language systems while remaining lightweight and efficient. Released under the MIT license, all weights are publicly available, making it accessible for fine-tuning and deployment in applications like VQA, content tagging, accessibility, and research. Florence-2’s compact design, versatility, and openness position it as a practical alternative to larger proprietary multimodal models.

Deploy GLM-OCR with an API

GLM-OCR runs as a hosted REST endpoint through Roboflow Workflows. Pick a task, then hand the prompt to your coding agent or copy the code. Forking the workflow into a free Roboflow workspace replaces the your-workspace and YOUR_API_KEY placeholders with your own.

Connect your agent to Roboflow (once)

Add the Roboflow MCP server

claude mcp add --transport http roboflow https://mcp.roboflow.com/mcp

Run /mcp and authorize Roboflow in your browser when the OAuth flow opens.

Start a new Claude Code session so the MCP loads, then paste the prompt below (it works the same in any agent).

Fork this workflow to your Roboflow workspace to use it.

Integrate the Roboflow "GLM-OCR" workflow into my app.

- Endpoint: POST https://serverless.roboflow.com/<your-workspace>/workflows/playground-glm-ocr-ocr
- Auth: send my Roboflow API key as `api_key` in the request body, read from the ROBOFLOW_API_KEY env var (never hardcode).
- Body: { "api_key": ..., "inputs": { `image`: { type: "url" | "base64", value } } }.

With the Roboflow MCP connected, call `workflows_get` on "playground-glm-ocr-ocr" to read the exact input schema (the source of truth), then `workflows_run` on a sample image to confirm the output shape before writing code (the MCP is authenticated, so this needs no key). Without the MCP, use the contract above.

Before running the app, set up these keys so it does not error at runtime:
- `ROBOFLOW_API_KEY` (sent as `api_key`) from https://app.roboflow.com/settings/api
Create a .gitignore'd .env with these variables, using placeholder values for any I haven't given you. Then pause and tell me directly, in your reply: the full path to the .env file, exactly which keys I need to paste in, and the link to get each one. Wait for me to confirm I've added them before you run anything. Do not run the app until I confirm.

Then add the integration to my codebase: match my project's language, framework, and conventions; read every key from environment variables (never hardcode); add basic error handling; and include a small runnable example. If you can't tell what language my project uses, ask me.
Installpip install inference-sdk

Fork this workflow to your Roboflow workspace to use it.

# 1. Import the library
from inference_sdk import InferenceHTTPClient

# 2. Connect to your workflow
client = InferenceHTTPClient(
  api_url="https://serverless.roboflow.com",
  api_key="YOUR_API_KEY"
)

# 3. Run your workflow on an image
result = client.run_workflow(
  workspace_name="your-workspace",
  workflow_id="playground-glm-ocr-ocr",
  images={
    "image": "YOUR_IMAGE.jpg"  # Path to your image file
  },
  use_cache=True  # cache workflow definition for 15 minutes
)

# 4. Get your results
print(result)

Fork this workflow to your Roboflow workspace to use it.

const response = await fetch('https://serverless.roboflow.com/your-workspace/workflows/playground-glm-ocr-ocr', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    api_key: 'YOUR_API_KEY',
    inputs: {
      "image": {"type": "url", "value": "IMAGE_URL"}
    }
  })
});

const result = await response.json();
console.log(result);

Fork this workflow to your Roboflow workspace to use it.

curl --location 'https://serverless.roboflow.com/your-workspace/workflows/playground-glm-ocr-ocr' \
--header 'Content-Type: application/json' \
--data '{
  "api_key": "YOUR_API_KEY",
  "inputs": {
    "image": {"type": "url", "value": "IMAGE_URL"}
  }
}'

GLM-OCR License

MIT

License terms and commercial-use guidance for GLM-OCR.

This model is released under the MIT License, a short and permissive open-source license that allows commercial use, modification, and redistribution.

Read the full MIT license ↗

Yes. Under the terms of the MIT license, you can freely use this model for commercial purposes. You must retain the copyright notice and license text when redistributing.

License information is provided as a guide and is not legal advice.

Frequently Asked Questions About GLM-OCR Vision

Yes. GLM-OCR accepts image input, and on Roboflow's previous vision benchmark it scored 87.3% on OCR. You can test it on your own image in the demo above.

GLM-OCR has not yet been evaluated on Roboflow's current Vision Evals. The results on this page are from the previous benchmark.

Yes. The demo on this page runs GLM-OCR in the free Roboflow Playground: upload an image and see results in seconds. A free account unlocks unlimited runs.