Surya | Multilingual Document OCR, Layout Analysis & Reading Order Toolkit


Surya
Surya

Introduction

Surya is an open-source (Apache 2.0) multilingual document analysis toolkit developed by Datalab (the creators of Marker and Chandra). Designed to turn raw document images and multi-column PDFs into structured, machine-readable representations, Surya provides end-to-end processing across 90+ languages. Beyond raw text optical character recognition (OCR), Surya handles document layout detection (18+ block labels), reading order sorting, table structure recognition (HTML with spans), and line-level bounding box detection using compact, highly efficient vision-language architectures.

Use Cases

  • Multi-Column & Complex Layout Document Parsing
    Extract text from academic papers, magazines, and dense corporate reports while accurately reconstructing natural reading order across multi-column flows.
  • High-Accuracy Multilingual OCR (90+ Languages)
    Digitize printed documents, mixed-script texts, and non-Latin alphabets with specialized tokenizers and language-specific OCR checkpoints.
  • Table Detection & HTML Structure Extraction
    Detect table boundaries in documents and extract row/column geometry, producing clean HTML representations with support for merged rows and column spans (colspan/rowspan).
  • Mathematical Equation & Code Recognition
    Isolate formulas, equations, and code blocks from prose text, rendering mathematical notations directly into clean LaTeX or structured blocks.
  • Document Pre-Processing for Agent RAG Pipelines
    Convert raw scanned PDFs into semantically chunked, layout-aware blocks to prevent context fragmentation in vector databases and RAG workflows.

Features & Benefits

  • Unified Multi-Task Architecture
    Combines layout analysis, full-page OCR, reading order inference, and table extraction in a single compact model footprint (~650M parameters).
  • Granular 18-Class Layout Classification
    Identifies and labels structural elements: Text, SectionHeader, Table, Equation, Picture, Form, PageHeader, PageFooter, Code, Footnote, and ChemicalBlocks.
  • Precise Reading Order Detection
    Calculates a 0-indexed reading order position for each recognized block to ensure extracted text preserves logical narrative flow.
  • Pluggable High-Throughput Inference Engines
    Supports vLLM (with Multi-Token Prediction speculative decoding) for NVIDIA GPUs, alongside llama.cpp/GGUF quantization for Apple Silicon (MPS) and CPU execution.
  • Line-Level Bounding Box Geometry
    Emits exact 4-corner polygon coordinates and axis-aligned bounding boxes (bbox) with per-token confidence scores.
  • Developer CLI & Python SDK Integration
    Provides pre-built command-line utilities (`surya_layout`, `surya_ocr`, `surya_table`, `surya_detect`) and Python APIs for seamless ingestion pipeline integration.

Pros

  • Lightweight Footprint with Enterprise Precision
    Delivers benchmark-leading accuracy under 3B parameters, running efficiently on consumer GPUs, Apple Silicon, and commodity CPUs.
  • Preserves Logical Reading Order
    Eliminates the multi-column text mixing common in naive OCR tools, producing clean text streams for LLM consumption.
  • 100% Permissive Open Source (Apache 2.0)
    Free for commercial deployment and self-hosting, ensuring total data privacy and zero per-page third-party API costs.

Cons

  • Inference Compute Demands on Batch Processing
    Running full-page VLM inference across massive multi-thousand-page document archives requires dedicated GPU acceleration (e.g., vLLM) to maintain low latency.
  • Heavily Degraded / Cursive Handwriting Limits
    While excellent at printed documents and clean forms, heavily degraded historical manuscripts and unconstrained cursive script may experience lower accuracy.

Tutorial

None

Pricing


Popular Products