Skip to page content
SAVRN
Search Plan a project

Open-weight model · Image to text

t-rsi-ocr

by Raymond Gonzalez psikosen/t-rsi-ocr

t-rsi-ocr is an open-weight model for image to text from Raymond Gonzalez, released under MIT License. It has 1M parameters and a 1,024-token context. At 16-bit it needs about 0 GB of GPU memory, which fits on 1x MI300X from $1.85 an hour, at the lowest prices in the SAVRN Index. It draws 13 downloads a month.

Every weight is -1, 0 or +1, packed four to a byte. The model reads a 32-pixel-tall text strip and emits characters through CTC, decoded with a prefix beam search over a 27 KB character language model.

Parameters1M
Context1,024
Weights1.7 MB
Licensemit
AccessOpen weights
Monthly Downloads13

Runs On

What it takes to serve t-rsi-ocr (1M parameters): the memory its weights need at each precision, and the cheapest way to rent enough data-center GPUs to hold them.

PrecisionWeightsMemory neededCheapest setupPer hourAlso fits
16-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
8-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00
4-bit 0.0 GB 0.0 GB 1x MI300X (192 GB)
Vultr
$1.85 1x H100 $1.99 · 1x MI325X $2.00

Memory is the weights at that precision plus 20% for the runtime and a short context; a long context needs more. Prices are the lowest on-demand hourly rates in the SAVRN Index, read Oct 18, 2026.

t-rsi-ocr on every accelerator the SAVRN Index prices, at every precision

Model Card

By Raymond Gonzalez, published under mit, revision 9f23e59865c3.

Every weight is -1, 0 or +1, packed four to a byte. The model reads a 32-pixel-tall text strip and emits characters through CTC, decoded with a prefix beam search over a 27 KB character language model. It is more accurate than Tesseract 5 on degraded text and on fonts, ties on clean documents, and returns noticeably fewer perfect lines. Full numbers and the reasons are below, including where it loses. Reproduce with python3 benchmarkvstesseract.py. Ground truth needs no hand labelling: a digital PDF already contains its own exact text, so rasterizing a page and cropping each line at the bbox the PDF reports gives pixels whose correct answer is known. Training and test documents are split by…

Read Raymond Gonzalez's full model card

T-RSI Fast Reflex OCR

A 1.58-bit ternary BitNet text-line recognizer in 380 KB

[!WARNING] Experimental research release. Every number below was measured on one Apple Silicon machine against ground truth this project generated. It has not been independently replicated. Treat the figures as reproducible-by-you, not as verified.

Every weight is -1, 0 or +1, packed four to a byte. The model reads a 32-pixel-tall text strip and emits characters through CTC, decoded with a prefix beam search over a 27 KB character language model.

It is more accurate than Tesseract 5 on degraded text and on fonts, ties on clean documents, and returns noticeably fewer perfect lines. Full numbers and the reasons are below, including where it loses.


Measured results

Reproduce with python3 benchmark_vs_tesseract.py. Ground truth needs no hand labelling: a digital PDF already contains its own exact text, so rasterizing a page and cropping each line at the bbox the PDF reports gives pixels whose correct answer is known. Training and test documents are split by file and deduplicated by content fingerprint.

Character accuracy

scenario T-RSI Tesseract 5
fonts, clean 99.14% 97.77% +1.37
fonts, degraded 99.36% 96.69% +2.67
documents, clean 96.82% 96.85% −0.03
documents, degraded 0.5 96.36% 96.37% −0.01
documents, degraded 1.0 93.75% 91.98% +1.77

Exact-line match — where it loses

scenario T-RSI Tesseract 5
fonts, clean 89.3% 72.7%
fonts, degraded 92.7% 70.7%
documents, clean 73.7% 85.7%

Tesseract's errors cluster onto a few hard lines and leave the rest clean. This model's scatter — single characters across many otherwise-good lines — and one stray character ruins a line as thoroughly as ten. That is the documented weakness of CTC, which treats every timestep as conditionally independent given the image and so cannot notice that the letters it just emitted do not form a word.

Multi-hypothesis voting closes most of that gap at the cost of extra passes:

decoding char accuracy WER exact line ms/line
single pass 97.90% 0.1004 76.2% 19.3
3 stretches + vote 98.21% 0.0827 84.5% 62.4
5 stretches + vote 98.29% 0.0786 86.5% 108.8
Tesseract 5 97.86% 0.0548 87.9% 105.0

By content type (real documents)

content T-RSI Tesseract 5
prose 98.82% 98.96%
symbol-heavy 96.01% 94.68%
numeric / amounts 98.20% 100.00%
alphanumeric IDs 80.00% 83.10%
ALL CAPS headers 99.60% 100.00%

Alphanumeric identifiers are the weakest content for both engines. Random codes carry no language structure, so no language model can rescue a misread glyph.


Size, memory and speed

T-RSI Tesseract 5
Packed ternary weights 312.0 KB —
Float32 tensors (LayerNorm, biases, scales) 27.4 KB —
Character 3-gram LM 27.4 KB —
Inference code 32.2 KB —
Install total 380 KB 48.9 MB
Peak process RAM 41.5 MB 35.4 MB
Cold start to first result 77 ms 395 ms
Steady-state per line 19.3 ms 105 ms

129× smaller on disk, 5× faster, 5× faster to cold start — and it uses more total memory than Tesseract. The model is only ~9 MB of that; Python with numpy and pillow costs 31.8 MB before a single weight loads. A C or Rust port would remove that, but no such port has been measured, so it is not a claim.

Position encoding is fixed sinusoidal, computed at load and stored as zero bytes. A learned embedding at 1024×192 float32 would cost 768 KB — more than twice all the ternary weights combined.


Architecture

Layers 4
Hidden size 192
Attention heads 6 (head dim 32)
FFN intermediate 384
Patch grid 32 × 8, one token per 8-pixel column
Ternary weights 1,277,952
Vocabulary 256 slots, 95 printable ASCII
Weight quantization ternary {-1, 0, +1}, STE, per-tensor mean|w| scale
Activation quantization 8-bit absmax, dequantized
Decoder CTC prefix beam search, width 4

Inference is engine.py, NumPy only, no framework. Weights are ternary, so an integer SIMD or microcontroller port needs only additions and subtractions. On a CPU the same arithmetic runs through BLAS, which is not literally multiplication-free — the property belongs to the weights, not to this runtime.

engine.py is checked against the PyTorch training module on shared weights and must agree to float32 precision. That test exists because the two once silently computed different functions.


Quickstart

from PIL import Image
from engine import FastReflexOCREngine

engine = FastReflexOCREngine.from_pretrained(
    "psikosen/t-rsi-ocr",
    lm_name="char_lm_3gram.npz",   # omit for greedy CTC
    beam_width=4,
)

text, latency_us, ram_kb = engine.recognize(Image.open("line.png"))
print(f"{text!r}  ({latency_us:.0f} us)")

Higher accuracy, more passes:

from data_generator_v2 import stretch_width
from vote import rover

engine.input_stretch = 1.0        # variants carry their own stretch
factors = [1.05, 1.15, 1.25, 1.35, 1.45]
weights = [0.8, 1.2, 1.6, 1.4, 0.8]
hyps = [engine.recognize(stretch_width(img, f))[0] for f in factors]
text = rover(hyps, weights=weights, null_penalty=0.85)

Two things that matter more than the model

1. Most documents need no OCR at all. DOCX files and digital PDFs already contain their exact text. Reading it takes 4.8 ms per page against Tesseract's 2,038 ms for the same page — 425× faster and exact rather than 97% accurate. Rasterizing a text layer and guessing it back loses table structure and turns 1999.00 into 999.00. Check for a text layer before reaching for any recognizer.

2. This is a line recognizer, not a page reader. It needs pre-cropped lines. Tesseract does layout analysis and recognition in one pass; this does not, and no line detector ships with it. A per-line speed comparison assumes the crops already exist.


Training

python3 train_v2.py --epochs 70 --pool 50000 --real 25000 \
    --layers 4 --hidden 192 --heads 6 --guide-weight 0.5 --out model_v4

49,022 synthetic lines across 111 screened system fonts, mixed with 19,816 real lines cropped from PDFs. Both matter: a synthetic-only model scored 81% on held-out fonts and 16% on real documents — it had learned the renderer.

Augmentation covers blur, sensor speckle, non-uniform lighting, ±5° skew, exposure drift, and horizontal scale jitter (1.0–1.4×). That last one is what makes input_stretch work at inference: CTC cannot emit more characters than it has frames, real lines average 1.29 frames per character, and stretching to 1.69 is worth +14.9 points of exact-line match. Applied to a model trained without the jitter, the same trick is a net loss.

Training uses an attention decoder as an auxiliary teacher (GTC, arXiv:2002.01276), discarded at export — it costs zero bytes and zero milliseconds at inference.


Limitations

  • Line recognizer only. No page layout, no line segmentation, no table structure.
  • 95 printable ASCII characters. No accents, no CJK, no mathematical notation, no typographic quotes.
  • Exact-line match trails Tesseract on clean documents, 73.7% against 85.7% single-pass. Voting narrows it to 86.5% against 87.9% at equal speed.
  • Uses more total RAM than Tesseract (41.5 MB against 35.4 MB), because of the Python runtime rather than the model.
  • Alphanumeric identifiers are weak (80.0%), as they are for every engine measured.
  • Evaluated on one machine. Independent replication welcome.

What was tried and did not work

Recorded so it is not rebuilt from the same reasoning.

approach result
Patch width 4 (more CTC frames) 92.2% against patch-8's 97.8%; each token sees too little context
Dictionary word repair built three times; detection works (greedy-vs-beam disagreement is an 11.6× error signal), correction does not
Larger LM corpus saturated at 4,933 of 9,025 contexts
Caching ternary weights as float32 1.13× faster end to end, +4 MB RAM
Per-head attention no memory saved; CPython does not return freed memory to the OS

Team C · experimental research release

Configuration

Architecture
TRSIFastReflexForOCR
Context length (tokens)
1,024
Layers
4
Hidden size
192
Feed-forward size
384
Attention heads
6
Vocabulary size
256
Stored precision
int8
Model type
t_rsi_fast_reflex_ocr

Identity and Version

Repository
psikosen/t-rsi-ocr
Publisher
Raymond Gonzalez
Task
Image to text
Modality
Image and text
Library
transformers
Parameters
1M parameters
Languages
en
Revision
9f23e59865c36021a57cdff289d6d68181d2fc1a
First published
2026-09-17
Last updated
2026-09-19

Files and Weights

15 files, 1.8 MB in total. The weights are 3 files totalling 1.7 MB in bin, npz, safetensors.

Weights3 files · 1.7 MB
Configuration8 files · 97.4 KB
Tokenizer2 files · 11.3 KB
Documentation1 file · 9.7 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
char_lm_3gram.npzWeights27.4 KB fe044beadb13
model.safetensorsWeights1.3 MB 64dc8c83550c
weights_packed_1.58bit.binWeights319.5 KB b78201b0c27d
beam_decoder.pyConfiguration14.0 KB —
config.jsonConfiguration951 B —
data_generator_v2.pyConfiguration22.6 KB —
engine.pyConfiguration21.5 KB —
model_architecture.pyConfiguration12.2 KB —
packing_utils.pyConfiguration1.6 KB —
train_v2.pyConfiguration18.7 KB —
vote.pyConfiguration5.9 KB —
README.mdDocumentation9.7 KB —
.gitattributesRepository1.5 KB —
tokenizer.jsonTokenizer6.3 KB —
vocab.jsonTokenizer5.0 KB —

License and Download

License
mit
Access
Open weights, no gate
Download size
1.7 MB
Download from Raymond Gonzalez

Released by Raymond Gonzalez through its official repository on Hugging Face. Read the license.

Built From

  • Described by arXiv:2002.01276

Evaluations

Each result is shown as reported, with the conditions its reporter stated. None is a SAVRN measurement. A comparison lines two results up only when their configuration, unit and setup are all stated and identical.

BenchmarkConditionsResultReported byRevisionDate
Held-out PDF lines (13 unseen documents, text-layer ground truth) Task Text Line RecognitionMetric Character Error RateComparison conditions not established 0.0318 psikosen
Publisher reported
Evaluated revision not stated —
Held-out PDF lines (13 unseen documents, text-layer ground truth) Task Text Line RecognitionMetric Exact Line MatchComparison conditions not established 0.737 psikosen
Publisher reported
Evaluated revision not stated —
Held-out PDF lines (13 unseen documents, text-layer ground truth) Task Text Line RecognitionMetric Word Error RateComparison conditions not established 0.1094 psikosen
Publisher reported
Evaluated revision not stated —
Held-out multi-font synthetic lines (40 unseen typefaces) Task Text Line RecognitionMetric Character Error RateComparison conditions not established 0.0086 psikosen
Publisher reported
Evaluated revision not stated —
Held-out multi-font synthetic lines (40 unseen typefaces) Task Text Line RecognitionMetric Exact Line MatchComparison conditions not established 0.893 psikosen
Publisher reported
Evaluated revision not stated —
Held-out multi-font synthetic lines (40 unseen typefaces) Task Text Line RecognitionMetric Word Error RateComparison conditions not established 0.0373 psikosen
Publisher reported
Evaluated revision not stated —

Memory Requirements

PrecisionWeights in memory
As published1.7 MB
16-bit0.0 GB
8-bit0.0 GB
4-bit0.0 GB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About t-rsi-ocr

How much GPU memory does t-rsi-ocr need?

About 0 GB at 16-bit and 0 GB at 4-bit: the weights (1M parameters) plus a working margin. A long context needs more.

What is the cheapest GPU to run t-rsi-ocr on?

At 16-bit, 1x MI300X from $1.85 an hour; at 4-bit, 1x MI300X from $1.85 an hour, at the lowest on-demand prices the SAVRN Index lists.

Can I use t-rsi-ocr commercially?

Yes. t-rsi-ocr is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

What is t-rsi-ocr's context length?

1,024 tokens, from the maximum position embeddings in its published configuration.

Similar Models

captioning pretrained on COCO dataset - base architecture (with ViT base backbone). Authors from the paper write in the abstract: Vision-Language Pre-training (VLP) has advanced the performance for many vision-language tasks. However, most existing pre-trained models only excel in either understanding-based tasks or generation-based tasks. Furthermore, performance improvement has been largely achieved by scaling up the dataset with noisy image-text pairs collected from the web, which is a suboptimal source of supervision. In this paper, we propose BLIP, a new VLP framework which transfers flexibly to both vision-language understanding and generation tasks. BLIP effectively utilizes the…

Open weights bsd-3-clause 512 tokens transformers

Model · Image to text

manga-ocr-base

Maciej Budyś

Optical character recognition for Japanese text, with the main focus being Japanese manga. It uses Vision Encoder Decoder framework. Manga OCR can be used as a general purpose printed Japanese OCR, but its main goal was to provide a high quality text recognition, robust against various scenarios specific to manga: - both vertical and horizontal text - text with furigana - text overlaid on images - wide variety of fonts and font styles - low quality images Code is available here.

Open weights apache-2.0 transformers

Model · Image to text

PP-OCRv5_server_det

PaddlePaddle

PP-OCRv5serverdet is one of the PP-OCRv5det series, the latest generation of text detection models developed by the PaddleOCR team. Designed for high-performance applications, it supports the detection of text in diverse scenarios—including handwriting, vertical, rotated, and curved text—across multiple languages such as Simplified Chinese, Traditional Chinese, English, and Japanese. Key features include robust handling of complex layouts, varying text sizes, and challenging backgrounds, making it suitable for practical applications like document analysis, license plate recognition, and scene text detection. The key accuracy metrics are as follow: Please refer to the following commands to…

Open weights apache-2.0 PaddleOCR

Model · Image to text

UVDoc

PaddlePaddle

The main purpose of text image correction is to carry out geometric transformation on the image to correct the document distortion, inclination, perspective deformation and other problems in the image, so that the subsequent text recognition can be more accurate. Please refer to the following commands to install PaddlePaddle using pip: For details about PaddlePaddle installation, please refer to the PaddlePaddle official website. Install the latest version of the PaddleOCR inference package from PyPI: You can quickly experience the functionality with a single command: You can also integrate the model inference of the TextImageUnwarping module into your project. Before running the following…

Open weights apache-2.0 PaddleOCR

Model · Image to text

en_PP-OCRv5_mobile_rec

PaddlePaddle

enPP-OCRv5mobilerec is one of the PP-OCRv5rec that are the latest generation text line recognition models developed by PaddleOCR team. It aims to efficiently and accurately support the recognition of English. The key accuracy metrics are as follow: Note: If any character (including punctuation) in a line was incorrect, the entire line was marked as wrong. This ensures higher accuracy in practical applications. Please refer to the following commands to install PaddlePaddle using pip: For details about PaddlePaddle installation, please refer to the PaddlePaddle official website. Install the latest version of the PaddleOCR inference package from PyPI: You can quickly experience the…

Open weights apache-2.0 PaddleOCR

Model · Image to text

PP-LCNet_x1_0_doc_ori

PaddlePaddle

The Document Image Orientation Classification Module is primarily designed to distinguish the orientation of document images and correct them through post-processing. During processes such as document scanning or ID photo capturing, the device might be rotated to achieve clearer images, resulting in images with various orientations. Standard OCR pipelines may not handle these images effectively. By leveraging image classification techniques, the orientation of documents or IDs containing text regions can be pre-determined and adjusted, thereby improving the accuracy of OCR processing. The key accuracy metrics are as follow: Please refer to the following commands to install PaddlePaddle…

Open weights apache-2.0 PaddleOCR