Papers › TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models

TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models

21 Sep 2021arXiv:2109.10282archive 2025-07-28

Minghao Li, Tengchao Lv, Jingye Chen, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, Furu Wei

Text recognition is a long-standing research problem for document digitalization. Existing approaches are usually built based on CNN for image understanding and RNN for char-level text generation. In addition, another language model is usually needed to improve the overall accuracy as a post-processing step. In this paper, we propose an end-to-end text recognition approach with pre-trained image Transformer and text Transformer models, namely TrOCR, which leverages the Transformer architecture for both image understanding and wordpiece-level text generation. The TrOCR model is simple but effective, and can be pre-trained with large-scale synthetic data and fine-tuned with human-labeled datasets. Experiments show that the TrOCR model outperforms the current state-of-the-art models on the printed, handwritten and scene text recognition tasks. The TrOCR models and code are publicly available at \url{https://aka.ms/trocr}.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2109.10282")

Code

Syntology Ran 0 of 6 code samples harvested from 2 repositories linked to this paper; 6 have no recorded run.

By repository: community (archive-listed): 6 samples from 2 repositories, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

microsoft/unilm officialpytorch report
d-gurgurov/im2latex mentioned on GitHubpytorchMIT report
huggingface/transformers mentioned on GitHubpytorch report
oleehyo/texteller mentioned on GitHubpaddleApache-2.0 report
pwc-1/Paper-9 mindspore report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

6 samples harvested; 0 ran; 0 honoured the contract we drafted; 6 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

6unverified

Licence: 0 of the 6 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

contains_ignore_begin oleehyo/texteller/texteller/api/format.py community (archive-listed) unverified Apache-2.0 (permissive) · ddd787523c07e485 · report
contains_ignore_skip oleehyo/texteller/texteller/api/format.py community (archive-listed) unverified Apache-2.0 (permissive) · 59b0d21e9bd0149a · report
filter_dataset d-gurgurov/im2latex/src/im2latex_finetune_handwritten.py community (archive-listed) unverified MIT (permissive) · e06ee9353a478f82 · report
find_comment_index oleehyo/texteller/texteller/api/format.py community (archive-listed) unverified Apache-2.0 (permissive) · fad68f0fdc560775 · report
to_katex oleehyo/texteller/texteller/api/katex.py community (archive-listed) unverified Apache-2.0 (permissive) · 8560b82a7e0c9ba0 · report
transform oleehyo/texteller/texteller/paddleocr/predict_det.py community (archive-listed) unverified Apache-2.0 (permissive) · 064afdff91999507 · report

Tasks

Handwritten Text RecognitionLanguage ModelingLanguage ModellingOptical Character RecognitionOptical Character Recognition (OCR)Scene Text RecognitionText Generation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Handwritten Text Recognition IAM TrOCR-large 558M CER 2.89 #3 of 17 Archive leaderboard report
Handwritten Text Recognition IAM TrOCR-base 334M CER 3.42 #5 of 17 Archive leaderboard report
Handwritten Text Recognition IAM TrOCR-small 62M CER 4.22 #6 of 17 Archive leaderboard report
Handwritten Text Recognition IAM(line-level) TrOCR Test CER 3.4 #1 of 5 Archive leaderboard report
Handwritten Text Recognition IAM(line-level) TrOCR Test WER - #1 of 5 Archive leaderboard report
Handwritten Text Recognition LAM(line-level) TrOCR Test CER 3.6 #5 of 6 Archive leaderboard report
Handwritten Text Recognition LAM(line-level) TrOCR Test WER 11.6 #5 of 6 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Introduced by this paper: TrOCR

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTrOCRTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections