For direct OCR recognition:
pip install "transformers>=5.0.0" torch pillow
from PIL import Image
import torch
from transformers import AutoProcessor, AutoModelForImageTextToText
model_id = "VietAlphaLabs/SenOCR-Vi"
image_path = "document.png"
device = "cuda" if torch.cuda.is_available() else "cpu"
model = (
AutoModelForImageTextToText
.from_pretrained(model_id, torch_dtype=torch.float32)
.to(device)
.eval()
)
processor = AutoProcessor.from_pretrained(model_id)
image = Image.open(image_path).convert("RGB")
messages = [
{
"role": "user",
"content": [
{"type": "image", "image": image},
{"type": "text", "text": "OCR:"},
],
}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(device)
outputs = model.generate(**inputs, max_new_tokens=512)
text = processor.decode(
outputs[0][inputs["input_ids"].shape[-1]:-1]
)
print(text)
[!NOTE]
The qualified benchmark artifact was served in FP32. Lower-precision deployment should be validated separately for the target environment.
PaddleOCR
For page-level document parsing, use SenOCR-Vi as the VLM recognition model inside the PaddleOCR-VL 1.6 pipeline.
Install the appropriate PaddlePaddle build for the target system, then:
pip install -U "paddleocr[doc-parser]>=3.6.0" huggingface_hub
from pathlib import Path
from huggingface_hub import snapshot_download
from paddleocr import PaddleOCRVL
model_dir = snapshot_download(repo_id="VietAlphaLabs/SenOCR-Vi")
output_dir = Path("./output")
output_dir.mkdir(parents=True, exist_ok=True)
pipeline = PaddleOCRVL(
pipeline_version="v1.6",
vl_rec_model_dir=model_dir,
)
output = pipeline.predict("document.png")
for result in output:
result.print()
result.save_to_json(save_path=output_dir)
result.save_to_markdown(save_path=output_dir)
PaddleOCR-VL also supports PDF input, layout analysis, document restructuring, and optimized serving backends. See the PaddleOCR-VL documentation.
Download the model
hf download VietAlphaLabs/SenOCR-Vi --local-dir SenOCR-Vi/
Evaluation
Vietnamese
SenOCR-Vi is evaluated on the corrected Vietnamese page population used for the MDPBench document-parsing comparison.
Table with columns: Model, Parameters, Vietnamese composite| Model | Parameters | Vietnamese composite |
|---|
| chandra-ocr-2 | 5B | 85.60 |
| MonkeyOCRv2-B-Parsing | 0.7B | 83.20 |
| Claude-Sonnet-4.6 | Undisclosed | 83.10 |
| SenOCR-Vi | 0.959B | 82.83 |
| ChatGPT-5.2-2025-12-11 | Undisclosed | 82.10 |
| PaddleOCR-VL-1.6 |
External model scores are taken from the MDPBench official leaderboard. Public parameter counts are shown where available; Claude-Sonnet-4.6 and ChatGPT-5.2 do not disclose model size.
At 0.959B parameters, SenOCR-Vi is 0.27 points behind Claude-Sonnet-4.6, 0.73 points ahead of ChatGPT-5.2, and 1.93 points ahead of PaddleOCR-VL-1.6 on Vietnamese. chandra-ocr-2 scores 2.77 points higher at 5B parameters, about 5.2 times SenOCR-Vi's parameter count.
Text recognition
On the 160-page Vietnamese slice:
Table with columns: Metric, SenOCR-Vi| Metric | SenOCR-Vi |
|---|
Page-level text_block Edit_dist | 0.13305 |
1 - Edit_dist | 86.7% |
The 86.7% figure is a Vietnamese text-recognition score under 1 - Edit_dist; the 82.83 document composite also includes structured document elements.
Document conditions
On the controlled English/Vietnamese/Simplified Chinese population:
Table with columns: Condition, Composite| Condition | Composite |
|---|
| Digital documents | 91.1 |
| Photographed documents | 80.8 |
Multilingual
SenOCR-Vi remains usable outside Vietnamese, although multilingual aggregate performance is not the primary optimization target.
Table with columns: Language, Composite| Language | Composite |
|---|
| English | 82.08 |
| Vietnamese | 82.83 |
| Simplified Chinese | 84.03 |
| EN/VI/ZH macro | 82.98 |
For comparison, PaddleOCR-VL-1.6 records an EN/VI/ZH macro of 83.43 from the corresponding MDPBench language columns.
Benchmark note
SenOCR-Vi scores are re-aggregated over the actual evaluation-page population.
The original project scorer emitted three additional non-page rows because of a documented key-parsing defect. All three affected the Vietnamese population. Removing those phantom rows gives the reported 82.83 Vietnamese composite.
The 82.98 EN/VI/ZH macro is a three-language summary only. It is not the full MDPBench overall score.
Training
SenOCR-Vi was initialized as a fresh decoder-only LoRA fine-tune of PaddleOCR-VL-1.6.
Table with columns: Setting, Value| Setting | Value |
|---|
| Base model | PaddlePaddle/PaddleOCR-VL-1.6 |
| Total parameters | 958,588,736 |
| Trainable parameters | 12,091,392 |
| Trainable share | 1.2614% |
| LoRA rank | 32 |
| LoRA alpha | 64 |
| LoRA scaling | 2.0 |
| Decoder projections | 126 |
| Training records | 42,254 |
The vision encoder, vision-language aligner/projector, embeddings, and LM head remained frozen.
LoRA was applied to seven projections in each of 18 decoder layers:
q_proj
k_proj
v_proj
o_proj
gate_proj
up_proj
down_proj
The final adapter was merged into the base weights in FP32. Merge-equivalence validation produced 128/128 exact decoded matches between base-plus-adapter inference and the merged model.
Data
The training corpus contains 42,254 OCR records and 1,171,860 supervised target tokens per corpus pass.
Table with columns: Corpus lane, Records, Target tokens| Corpus lane | Records | Target tokens |
|---|
| Vietnamese handwriting (Viet-Handwriting-OCR-v2) | 23,046 | 456,066 |
| VinText | 10,174 | 32,531 |
| Vietnamese text corpus | 1,539 | 491,846 |
| General OCR replay | 4,687 | 22,594 |
| Private archival corpus | 2,808 | 168,823 |
The corpus is Vietnamese-dominant, with handwriting, scene/document text, longer-form printed Vietnamese, general OCR replay, and restricted archival material. The Vietnamese handwriting lane is sourced from 5CD-AI/Viet-Handwriting-OCR-v2.
Restricted archival source material is not redistributed with SenOCR-Vi. Public datasets retain their original licensing terms.
Limitations
SenOCR-Vi is optimized primarily for Vietnamese text recognition.
Structured elements remain more difficult than ordinary text on the controlled evaluation population:
Table with columns: Component, Score| Component | Score |
|---|
| Text | 86.5% under 1 - NED |
| Table | 70.7 TEDS |
| Formula | 72.5 CDM |
The model is therefore not positioned as a table- or formula-specialized OCR system.
Other difficult cases include:
- complex or irregular tables;
- formula-heavy scientific pages;
- dense multi-column layouts;
- highly colorful textbooks and magazines;
- severe image degradation or unusual page geometry.
No controlled production benchmark has yet established pages per second, optimized BF16 peak VRAM, or latency relative to other OCR systems.
For legal, financial, historical, or otherwise high-stakes transcription, human review is recommended.
License
SenOCR-Vi is released under the Apache License 2.0.
The model is built on PaddleOCR-VL-1.6, which is also distributed under Apache 2.0.
Dataset licenses vary by source. Restricted archival material is not included in the release.
Citation
@misc{vietalphalab2026senocrvi,
title={SenOCR-Vi: A Vietnamese-Specialized Document OCR Model},
author={VietAlpha Lab},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/VietAlphaLabs/SenOCR-Vi},
}
References