Roboflow

TrOCR Overview

TrOCR (Transformer-based Optical Character Recognition) is an end-to-end OCR model released in September 2021 by Microsoft Research. It departs from the traditional two-stage OCR pipeline — which typically combines a CNN-based feature extractor with an RNN-based sequence decoder — by using a pure Transformer architecture composed of a pretrained image Transformer encoder and a pretrained text Transformer decoder, an approach that later became standardized as the VisionEncoderDecoder pattern in Hugging Face Transformers.

TrOCR takes a cropped text line image as input and produces a sequence of output tokens, supporting printed, handwritten, and scene text recognition. The model is designed for use downstream of a separate text detection stage — TrOCR recognizes text in pre-cropped regions rather than detecting text locations in a full page. Microsoft released three size variants: TrOCR-small (62M parameters, DeiT-small encoder + MiniLM decoder), TrOCR-base (334M parameters, BEiT-base encoder + RoBERTa-large decoder), and TrOCR-large (558M parameters, BEiT-large encoder + RoBERTa-large decoder). Pretrained and fine-tuned checkpoints are available for printed text (on SROIE), handwritten text (on IAM), and scene text (on the standard scene text benchmarks) under the MIT license, distributed through the Microsoft unilm repository and Hugging Face. At release, TrOCR achieved state-of-the-art results across all three benchmark categories, and the model continues to be used as a baseline for handwritten text recognition.

TrOCR Details & Performance

Details

Resources

Vision Tasks

OCR

Features

Usage

Past 30 Days

Not available

Not in Playground

Performance

Avg. Latency

Arena Rankings

Not yet ranked in arena

TrOCR Vision Evals

TrOCR 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#56 of 5826.2% pass rate · better than 3%
Score26.2%pass rate across 229 tasks
Speed0.28savg response per task
Costpricing unavailable
Tokenstokens unavailable
Score key:≥75%40–74%<40%
CategoryPassedScore
Text Recognition16 / 30
53.3%
Focused Scene OCR34 / 99
34.3%
License Plate Recognition10 / 30
33.3%
VQA & Extraction0 / 60
0%
Handwritten Math0 / 10
0%

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.

6 of 7 models plotted · 1 not yet evaluated

ModelScoreMedian tokensEst. cost / taskCompare
AnthropicClaude Sonnet 4.567.3%866$0.0039Compare
GoogleGemma 3 4B64.2%314<$0.0001Compare
OpenAIGPT-5.4 Nano62.5%294$0.0001Compare
AnthropicClaude Haiku 4.561.6%861$0.0012Compare
QwenQwen3.6 Plus58.5%166$0.0001Compare
AzureTrOCR(this model)26.2%
MoonshotAIKimi K2.519.6%706$0.0006Compare

Alternatives to TrOCR

Other models worth comparing for similar use cases.

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.
Z.ai
GLM-OCR
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.
docTR
docTR (Document Text Recognition) is an open-source OCR toolkit developed by Mindee, with its initial public release in March 2021 under the Apache 2.0 license. It provides end-to-end document text recognition through a two-stage pipeline consisting of text detection and text recognition, both implemented as deep learning models. docTR supports multiple detection architectures including DBNet and LinkNet, and recognition architectures including CRNN and SAR, with both TensorFlow and PyTorch backends available.docTR is designed for reading text in document images including scanned PDFs, photographs of printed documents, and forms. It handles multilingual text recognition across standard Latin-script languages and is deployable through Roboflow Inference. It is suited for document digitization pipelines, automated form processing, and applications requiring accurate structured text extraction from document images.
Surya
Surya is an OCR and document layout analysis toolkit developed by Vikram Paruchuri and distributed via Mindee, first released in January 2024 under the GPL-3.0 license. It supports text recognition across more than 90 languages, document layout detection, reading order prediction, table recognition, and equation detection, providing a comprehensive set of tools for extracting structured information from document images.Surya is designed to operate without cloud API dependencies, running fully on local hardware with support for CPU and GPU inference. It is commonly used for digitizing scanned documents, extracting text from PDFs with complex layouts, and building automated document processing pipelines.
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
Google Vision OCR
Google Vision OCR, released as part of the Cloud Vision API’s general availability in February 2016, is a proprietary Google Cloud service for extracting text from images and documents. It supports common formats like JPEG, PNG, GIF, TIFF, and PDF, and provides two main modes: TEXT_DETECTION for short snippets and scene text, and DOCUMENT_TEXT_DETECTION for dense documents, which returns structured layout information with bounding boxes.While not an LLM (so it has no token context window or parameter count), the service performs OCR across printed text and some handwriting. It outputs detected text along with positional metadata, making it useful for digitizing scanned files, receipts, forms, and signs. However, complex layouts like tables often require downstream processing. Accessible via REST and RPC APIs, with client libraries in major languages, Google Vision OCR is widely used for document processing pipelines, archival, and accessibility applications.

TrOCR License

MIT · Permissive license

TrOCR is released under MIT, a permissive license. The TrOCR license lets you use, modify, and sell work built on the model, with the copyright notice as the only real obligation and no requirement to open-source related code changes.

Commercial use
Permitted with no separate commercial license. No usage caps, revenue thresholds, or field-of-use limits apply to TrOCR.
Modification
Permitted. You can fine-tune or rewrite TrOCR and keep the result closed-source.
Redistribution
Permitted. Include the original copyright and permission notice in copies or substantial portions of the work.

MIT grants no explicit patent license and disclaims all warranties. If patent exposure is a concern for your deployment, review it with counsel before launch.

Read the full MIT license ↗

Do I need a commercial license for TrOCR?

No commercial license is needed for TrOCR: permissive terms let you keep related code private while deploying commercially.

Do not hesitate to reach out with questions for your commercial project — our team will help you start solving business problems on the first call. See Roboflow commercial licensing for the models included in each plan.

Talk to sales

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

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 TrOCR Vision

Yes. TrOCR accepts image input, and on Roboflow's previous vision benchmark it scored 26.2% on OCR.

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