VOOZH about

URL: https://huggingface.co/tiiuae/Falcon-OCR

โ‡ฑ tiiuae/Falcon-OCR ยท Hugging Face


Falcon OCR

Falcon OCR is a 300M parameter early-fusion vision-language model for document OCR. Given an image, it can produce plain text, LaTeX for formulas, or HTML for tables, depending on the requested output format.

Most OCR VLM systems are built as a pipeline with a vision encoder feeding a separate text decoder, plus additional task-specific glue. Falcon OCR takes a different approach: a single Transformer processes image patches and text tokens in a shared parameter space from the first layer, using a hybrid attention mask where image tokens attend bidirectionally and text tokens decode causally conditioned on the image.

We built it this way for two practical reasons. First, it keeps the interface simple: one backbone, one decoding path, and task switching through prompts rather than a growing set of modules. Second, a 0.3B model has a lower latency and cost footprint than 0.9B-class OCR VLMs, and in our vLLM-based serving setup this translates into higher throughput, often 2โ€“3ร— faster depending on sequence lengths and batch configuration. To our knowledge, this is one of the first attempts to apply this early-fusion single-stack recipe directly to competitive document OCR at this scale.

Links

Quickstart

Installation

pip install "torch>=2.5" transformers pillow einops

Falcon OCR requires PyTorch 2.5 or newer for FlexAttention. The first call may be slower as torch.compile builds optimized kernels.

Single-Image OCR

import torch
from PIL import Image
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
 "tiiuae/Falcon-OCR",
 trust_remote_code=True,
 torch_dtype=torch.bfloat16,
 device_map="auto",
)
image = Image.open("document.png")
texts = model.generate(image) # default category is "plain"
print(texts[0])

Choose an output format with category

texts = model.generate(image, category="text") # plain text
texts = model.generate(image, category="formula") # LaTeX
texts = model.generate(image, category="table") # HTML table

API

model.generate(images, category="plain", **kwargs)

  • Inputs:
    • images: a PIL.Image.Image or a list of images
    • category: one of plain, text, table, formula, caption, footnote, list-item, page-footer, page-header, section-header, title
  • Returns: list[str], one extracted string per image

Layout OCR (Two-Stage Pipeline)

For sparse documents, running OCR on the whole image can work well. For dense documents with heterogeneous regions (multi-column layouts, interleaved tables and formulas, small captions), we provide an optional two-stage pipeline:

  1. A layout detector finds regions on the page.
  2. Falcon OCR runs independently on each crop with a category-specific prompt. We use PP-DocLayoutV3 as the layout detector.
results = model.generate_with_layout(image)
for det in results[0]:
 print(f"[{det['category']}] {det['text'][:100]}...")

Batch mode:

results = model.generate_with_layout(
 [Image.open("page1.png"), Image.open("page2.png")],
 ocr_batch_size=32,
)

The layout model is loaded lazily on the first generate_with_layout() call and runs on the same GPU as the OCR model. Returns: list[list[dict]], one list per image, in reading order:

{
 "category": "text", # layout category
 "bbox": [x1, y1, x2, y2], # in original image pixels
 "score": 0.93, # detection confidence
 "text": "..." # extracted text
}

When to Use What

Mode Best for How
Plain OCR Simple documents, real-world photos, slides, receipts, invoices model.generate(image)
Layout + OCR Complex multi-column documents, academic papers, reports, dense pages like newspapers model.generate_with_layout(image)

Benchmark Results

Results Analysis

First, a compact model can be competitive when the interface is simple and the training signal is targeted. On olmOCR, Falcon OCR performs strongly on multi-column documents and tables, and is competitive overall against substantially larger systems. Second, evaluation on full-page parsing is sensitive to matching and representation details. On OmniDocBench, the table and formula metrics depend not only on recognition quality but also on how predicted elements are matched to ground truth and how output structure is normalized.

More broadly, these results suggest that an early-fusion single-stack Transformer can be a viable alternative to the common "vision encoder plus text decoder" recipe for OCR. We do not view this as a finished answer, but as a promising direction: one early-fusion backbone, a shared parameter space between text and images, a single decoding interface, and better data and training signals, rather than increasingly complex pipelines. To our knowledge, this is among the first demonstrations that this early-fusion recipe can reach competitive document OCR accuracy at this scale, and we hope it encourages further work in this direction.

Serving Throughput

Measured on a single A100-80GB GPU with vLLM, processing document images from olmOCR-Bench under high concurrency for optimal vLLM utilization.

  • Layout + OCR โ€” The full end-to-end pipeline: layout detection finds regions on each page, crops them, and vLLM runs OCR on every crop. This represents the real-world serving throughput, inclusive of both layout detection and OCR time.
Mode tok/s img/s Description
Layout + OCR 5,825 2.9 Full pipeline: layout detection โ†’ crop โ†’ per-region OCR

At 0.3B parameters, Falcon OCR is roughly 3ร— smaller than 0.9B-class OCR VLMs (e.g., PaddleOCR VL), which translates directly into higher serving throughput at competitive accuracy.

Limitations

  • Old scans and tiny text: Heavily degraded scans and very small glyphs remain challenging. These cases often require higher effective resolution and better coverage in the training mixture.
  • Non-unique table representations: Visually identical tables can be encoded in structurally different HTML forms, which can affect tree-based metrics.
  • Formula matching sensitivity: LaTeX and Unicode conventions can be penalized differently depending on the benchmark normalization and matching pipeline.

Examples

Click each section below to expand.


vLLM Server

We also provide a Docker-based vLLM-backed inference server capable of serving approximately 6,000 tokens per second.

Single Docker image with two services:

Service Default Port Description
vLLM 8000 Falcon-OCR vision-language model (OpenAI-compatible API)
Pipeline 5002 Full document parsing: layout detection โ†’ crop โ†’ OCR โ†’ markdown

The layout model runs inside the pipeline process โ€” it is not a standalone service.

Quick Start

docker run -d --name falcon-ocr \
 --gpus '"device=0,1"' \
 -e EXPOSED_GPU_IDS=0,1 \
 -e VLLM_GPU=0 \
 -e PIPELINE_GPU=1 \
 -e VLLM_GPU_MEM_UTIL=0.90 \
 -p 8000:8000 \
 -p 5002:5002 \
 ghcr.io/tiiuae/falcon-ocr:latest

API

Configuration

All settings are controlled via environment variables at docker run time.

Deployment Modes

Citation

If you use Falcon OCR, please cite:

@article{bevli2026falcon,
 title = {Falcon Perception},
 author = {Bevli, Aviraj and Chaybouti, Sofian and Dahou, Yasser and Hacid, Hakim and Huynh, Ngoc Dung and Le Khac, Phuc H. and Narayan, Sanath and Para, Wamiq Reyaz and Singh, Ankit},
 journal = {arXiv preprint arXiv:2603.27365},
 year = {2026},
 url = {https://arxiv.org/abs/2603.27365}
}
Downloads last month
6,356
Safetensors
Model size
0.3B params
Tensor type
F32
ยท

Model tree for tiiuae/Falcon-OCR

Finetunes
4 models

Space using tiiuae/Falcon-OCR 1

Collection including tiiuae/Falcon-OCR

Paper for tiiuae/Falcon-OCR

Article mentioning tiiuae/Falcon-OCR

Evaluation results