# Surya: A Document OCR and Layout Analysis Toolkit

> Surya is an open-source toolkit providing OCR in 90+ languages, text detection, layout analysis, reading order prediction, table recognition, and LaTeX OCR, with compact models that benchmark favorably against cloud services.

- Authors: Bevaya AI Team
- Published: 2026-03-15
- Code: Surya (GitHub) <https://github.com/VikParuchuri/surya>
- Model: Detection Model (surya_det3) <https://huggingface.co/vikp/surya_det3>
- Model: Layout Model (surya_layout2) <https://huggingface.co/vikp/surya_layout2>
- Source: Bevaya Labs, <https://labs.bevaya.ai/>

---


## TL;DR

Surya is an open-source document AI toolkit by Vik Paruchuri (Datalab) that provides a full pipeline: OCR in 90+ languages, line-level text detection, layout analysis (15 categories), reading order prediction, table recognition, and LaTeX OCR. It ships compact, efficient models (38.4M for detection, 30M for layout) that run on both GPU and CPU. There is no formal academic paper; the project is documented via its GitHub repository.

---

## What kind of paper is this?

**Dominant:** $\Psi\_{\text{Resource}}$. The primary contribution is the toolkit itself: pre-trained models, inference pipelines, and a streamlit demo. It provides a practical, end-to-end document processing system.

**Secondary:** $\Psi\_{\text{Impact}}$. With 19,000+ GitHub stars, Surya has seen significant community adoption among open-source document layout tools. It aims to provide a practical alternative to cloud services by packaging academic-grade models with production-oriented inference.

## What is the motivation?

Commercial OCR and layout analysis services (Google Document AI, AWS Textract, Azure Document Intelligence) offer strong performance but are proprietary, costly, and require API access. Academic models (LayoutLM, DiT, DocLayout-YOLO) require substantial setup and are often not packaged as ready-to-use tools. Surya fills the gap: an open-source toolkit with competitive accuracy, simple installation (`pip install surya-ocr`), and automatic model weight download.

## What is the novelty?

Surya is not a single research contribution but a well-engineered toolkit that integrates multiple capabilities:

### Layout Analysis

The layout model (`surya_layout2`, 30M parameters) detects 15 element categories:

| Surya Label | Visual Primitive | Logical Role | Notes |
| :--- | :--- | :--- | :--- |
| **Text** | `Text` | `Body` | Standard prose content. |
| **Section-header** | `Text` | `SectionHeader` | Section headings. |
| **Caption** | `Text` | `Caption` | Figure/table descriptions. |
| **Footnote** | `Text` | `Footnote` | Bottom-of-page notes. |
| **List-item** | `Text` | `ListItem` | Bulleted/numbered items. |
| **Page-header** | `Text` | `PageHeader` | Running headers. |
| **Page-footer** | `Text` | `PageFooter` | Running footers. |
| **Table** | `Table` | *(primitive only)* | Tabular regions. |
| **Picture** | `Image` | `Figure` | Non-textual visual content. |
| **Figure** | `Image` | `Figure` | Visual content (distinct from Picture in training but functionally similar). |
| **Formula** | `Formula` | `DisplayEquation` | Mathematical notation. |
| **Form** | `Table` | `FormGroup` | Form-structured content. |
| **Table-of-contents** | `Table` | `TOC` | Navigation structures. |
| **Handwriting** | `Text` | `Body` | Handwritten text regions. `is_handwritten: True`. |
| **Text-inline-math** | `Formula` | `InlineEquation` | Math embedded within text lines. |

This 15-class set closely follows the DocLayNet taxonomy (11 classes) extended with Form, TOC, Handwriting, and Text-inline-math.

### Other Capabilities

- **OCR:** 90+ language support. Character-level, word-level, and line-level outputs with bounding boxes and confidence scores.
- **Text detection:** Line-level detection model (38.4M params, `surya_det3`).
- **Reading order:** Positional ordering of detected layout elements.
- **Table recognition:** Row and column detection within table regions.
- **LaTeX OCR:** Math expression recognition.

## What experiments were performed?

Surya reports self-collected benchmarks on PubLayNet (which the author states is not in the training data):

| Layout Type | Precision | Recall |
| :--- | ---: | ---: |
| Image | 0.913 | 0.940 |
| List | 0.808 | 0.868 |
| Table | 0.850 | 0.961 |
| Text | 0.930 | 0.946 |
| Title | 0.921 | 0.954 |

Inference timing is reported at approximately 0.13 seconds per image on an A10 GPU. Reading order is reported at 88% mean accuracy, with approximately 0.4 seconds per image.

These benchmarks are self-reported and the evaluation protocol is not documented in detail. It is unclear whether standard COCO-style mAP was used, how IoU thresholds were set, or whether confidence thresholds were tuned. No comparisons against other open-source layout models (e.g., DocLayout-YOLO, LayoutLMv3) under controlled conditions are provided.

## What are the outcomes/conclusions?

Surya provides a practical, pip-installable toolkit that bundles multiple document analysis capabilities into a single package. The self-reported benchmarks suggest competitive performance on PubLayNet, though the lack of standardized evaluation protocol makes direct comparison with other tools difficult.

The toolkit's main value proposition is convenience: a single install provides OCR, layout detection, reading order, table recognition, and LaTeX OCR. However, the absence of a formal paper, disclosed training data, or reproducible training recipe means users must rely on the author's benchmarks without independent verification.

## Licensing

Surya uses a split licensing model:
- **Code:** GPL-3.0 (copyleft; derivative works must be open-source under GPL).
- **Model weights:** The repository README describes a "Modified AI Pubs Open Rail-M" license (free for research, personal use, and startups under \$2M funding/revenue; broader commercial use requires a separate license from Datalab). However, the HuggingFace model cards for both `surya_det3` and `surya_layout2` tag the license as CC-BY-NC-SA-4.0. This discrepancy between the README and the HuggingFace metadata is unresolved; users should verify the applicable terms directly with the author before commercial use.

This means that while Surya is open-source, it is **not freely available for commercial use** at scale. The GPL code requirement means any application integrating Surya must also be GPL-licensed (or obtain a commercial license), and the model weights carry their own non-commercial restriction.

## Limitations

- **No formal paper.** No peer-reviewed methodology description, no formal ablation studies, no reproducible training recipe. Benchmark methodology is self-reported.
- **Training data undisclosed.** The training data for the detection and layout models is not documented publicly.
- **GPL + restrictive model license** limits commercial adoption without a paid license.
- **Self-reported benchmarks only.** The PubLayNet and reading order benchmarks use the author's own evaluation methodology, which may differ from standard COCO-style mAP.

## Reproducibility

### Models

- **Detection model** (`surya_det3`): 38.4M parameters. Weights available on [HuggingFace](https://huggingface.co/vikp/surya_det3). Architecture details (backbone, head design) are not formally documented beyond the code.
- **Layout model** (`surya_layout2`): 30M parameters. Weights available on [HuggingFace](https://huggingface.co/vikp/surya_layout2). Similarly, architecture documentation is limited to the source code.
- No base model lineage or pretraining strategy is disclosed for either model.

### Algorithms

- **Inference only.** The repository provides inference code but no training scripts, training configurations, or fine-tuning recipes.
- No optimizer, learning rate schedule, batch size, or training duration is disclosed.
- No data augmentation or preprocessing pipeline for training is documented.

### Data

- **Training data is undisclosed.** The author states that PubLayNet is not in the training data, but no further details on training data sources, size, or composition are available.
- No data filtering, deduplication, or annotation pipeline is documented.

### Evaluation

- Benchmarks are self-reported on PubLayNet (precision/recall per class) and a reading order task (mean accuracy).
- The evaluation protocol is not described in detail: IoU thresholds, confidence thresholds, and metric definitions are not specified.
- No standard baselines are compared under controlled conditions.
- No error bars, multiple runs, or statistical significance tests are reported.

### Hardware

- Inference timing reported on an A10 GPU (~0.13 seconds per image for layout, ~0.4 seconds per image for reading order).
- The toolkit supports both GPU and CPU inference; no CPU timing is reported.
- Training hardware is not disclosed.

## BibTeX

No formal citation exists. Reference via GitHub:

```bibtex
@misc{surya2024,
  title={Surya: Document OCR Toolkit},
  author={Paruchuri, Vik},
  year={2024},
  howpublished={\url{https://github.com/VikParuchuri/surya}},
  note={Accessed: 2026-03-15}
}
```


