SuperAPI AI Directory

GLM-OCR - Zhipu's Open-Source Lightweight Multimodal OCR Model

Author: AI小集 · Original source: AI工具集

What is GLM-OCR

GLM-OCR is a lightweight multimodal OCR model open-sourced by Zhipu AI. With only 0.9B parameters, it tops the OmniDocBench V1.5 leaderboard as SOTA with a score of 94.6. The model is based on the GLM-V architecture, integrates the self-developed CogViT visual encoder and a lightweight cross-modal connector layer, and introduces multi-token prediction loss and reinforcement learning training. It excels in highly challenging scenarios such as handwriting, complex tables, code documents, seals, and multilingual mixed layouts. The model supports HTML tables and JSON structured output, achieves an inference speed of 1.86 pages/second, is compatible with vLLM/SGLang/Ollama deployment, and is suitable for commercial scenarios such as document parsing, receipt extraction, and RAG.

GLM-OCR

GLM-OCR's Main Features

  • General Text Recognition: Supports photos, screenshots, scanned documents, and PDFs, recognizing printed text, handwriting, seals, code, and other special text.
  • Complex Table Parsing: Accurately understands structures such as merged cells and multi-level headers, and directly outputs HTML code without the need for secondary table creation.
  • Structured Information Extraction: Intelligently extracts key fields from cards, receipts, and tables, and outputs standard JSON format for integration with business systems.
  • Formula and Code Recognition: Supports accurate recognition of mathematical formulas, program code, and other professional technical content.
  • Multilingual and Mixed Layout Support: Supports processing complex layouts such as vertical text and multilingual mixed text.
  • Batch Document Processing: Supports large-scale document recognition and outputs well-structured formats, providing a high-quality data foundation for RAG.

GLM-OCR's Technical Principles

  • Overall Architecture: GLM-OCR adopts the classic "encoder-decoder" architecture design and is overall inherited from the GLM-V series. The architecture consists of three core modules: the CogViT visual encoder on the vision side (400M parameter scale), a lightweight connector layer responsible for cross-modal information fusion, and the backend GLM-0.5B language decoder.
  • Visual Encoding: The visual encoder adopts Zhipu's self-developed CogViT architecture and introduces the CLIP contrastive learning strategy for large-scale pretraining on billions of image-text pairs. This gives the model powerful text detection and layout semantic understanding capabilities, enabling it to effectively handle challenges in complex documents such as multi-column layouts, mixed text and images, and rotated text.
  • Cross-Modal Fusion: To achieve efficient fusion of visual and linguistic information, GLM-OCR designs a lightweight and efficient connector layer structure. It incorporates the SwiGLU activation mechanism and introduces a 4x downsampling strategy, enabling precise filtering and retention of key visual tokens and efficient compression and transmission of high-density visual semantic information to the backend language decoder, supporting high-precision OCR recognition output.
  • Training Optimization: In its training strategy, GLM-OCR is the first to introduce multi-token prediction loss (MTP) into OCR model training. By simultaneously predicting multiple future tokens, it enhances the density of the loss signal and significantly improves model learning efficiency. Through continuous and stable full-task reinforcement learning training, it further optimizes the model's overall recognition accuracy and cross-domain generalization ability in complex document scenarios.
  • Inference Process: At the system level, GLM-OCR adopts a two-stage technical paradigm of "layout analysis → parallel recognition". It performs document layout analysis based on PP-DocLayout-V3 to precisely locate regions such as text, tables, and images; OCR recognition is executed in parallel, ultimately achieving stable, high-quality, and highly efficient parsing results in document scenarios with diverse layouts and complex structures.

GLM-OCR's project address

  • GitHub repository:https://github.com/zai-org/GLM-OCR
  • HuggingFace model library:https://huggingface.co/zai-org/GLM-OCR
  • Online experience:https://ocr.z.ai/

GLM-OCR's application scenarios

  • Education and research: The model can accurately recognize handwritten notes, mathematical formulas, academic papers, and scanned textbooks, support complex layouts and multilingual document processing, and assist knowledge organization and academic research.
  • Enterprise office: The model can automatically parse various documents such as contracts, invoices, reimbursement forms, and meeting minutes, realize digital archiving of paper documents, and greatly improve the efficiency of information entry.
  • Finance and insurance: Supports intelligent extraction of key fields from bank cards, ID cards, insurance policies, and bills, outputs structured JSON data, seamlessly connects with core business systems, and reduces manual review costs.
  • Logistics and customs: Quickly recognizes professional documents such as customs declarations, waybills, and packing lists, accurately extracts data such as commodity information, consignees and shippers, and amounts, and accelerates customs clearance and settlement processes.
  • Software development: The model can accurately recognize code screenshots, technical documents, and API manuals, supports multiple programming languages, and facilitates developers in organizing code snippets and building technical knowledge bases.