Next3-OCR
Next3-OCR is the first OCR vision-language model in Lamapi's Next 3 series, built for accurate verbatim document transcription across Turkish and English documents, receipts, and handwriting.
Model Lineage & Identity
| Field | Details |
|---|---|
| Product Name | Next3-OCR |
| Series | Next 3 |
| Developer & Training Organization | Lamapi (thelamapi) |
| Founder | Ersin Sarp Yiğit |
| Owner | Ersin Sarp Yiğit |
| Starting Checkpoint | thelamapi/next-ocr (pinned revision: 5790b6dd78f415cd7e7e73f6a5101fc07507e7f0) |
| Architecture | Qwen3VLForConditionalGeneration (Qwen3VLProcessor, ~8.77B BF16 parameters) |
| Artifact Format | Full sharded safetensors Transformers checkpoint (merge_and_unload(safe_merge=True) from LoRA adapter) |
Benchmark Comparison (Measured Head-to-Head)
All models below were evaluated under identical conditions on the exact same locked held-out test set (24 real images: 10 Turkish documents from moganai/TurkishOCR-Bench, 7 real receipts from naver-clova-ix/cord-v2, and 7 handwritten lines from Teklia/IAM-line), plus 10 unseen neutral-prompt identity probes.
| Model | Char Accuracy (↑) | Strict CER (↓) | Strict WER (↓) | Turkish Char Accuracy (↑) | Identity Accuracy (↑) |
|---|---|---|---|---|---|
| Next3-OCR (Lamapi, Next 3) | 80.04% | 0.1996 | 0.3368 | 36.73% | 100.0% |
Next-OCR (thelamapi/next-ocr, baseline) | 75.81% | 0.2419 | 0.4229 | 26.82% | 0.0% |
EasyOCR (tr+en) | 50.65% | 0.4935 | 0.7805 | 27.51% | N/A |
Tesseract OCR (tur+eng) | 53.24% | 0.4676 | 0.662 | 33.29% | N/A |
Training Method
- Backbone & Adapter: Vision encoder frozen; 4-bit QLoRA (NF4 + BF16 compute) applied to language-model attention and MLP projections (
q_proj,k_proj,v_proj,o_proj,gate_proj,up_proj,down_proj). - Stage 1 (Identity & Task Separation): Trained with neutral system prompts, disjoint train/val/test identity templates, false-premise & roleplay resistance, and OCR-vs-identity counterexamples to prevent brand leakage into OCR outputs.
- Stage 2 (Real OCR Fine-Tuning): Trained on verified Turkish documents (
moganai/TurkishOCR-Bench), real receipts (naver-clova-ix/cord-v2), and real handwriting (Teklia/IAM-line) with validation-CER checkpoint selection and identity replay. - Merged Export: Starting checkpoint reloaded at the exact pinned revision in full BF16 (non-quantized) and merged via
merge_and_unload(safe_merge=True).
Quick Start
import torch
from PIL import Image
from transformers import AutoProcessor, Qwen3VLForConditionalGeneration
model_id = "thelamapi/next3-ocr"
processor = AutoProcessor.from_pretrained(model_id)
model = Qwen3VLForConditionalGeneration.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
image = Image.open("document.png").convert("RGB")
messages = [{"role": "user", "content": [{"type": "image", "image": image}, {"type": "text", "text": "Extract all text from this image verbatim in reading order."}]}]
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=[prompt], images=[image], return_tensors="pt").to(model.device)
with torch.inference_mode():
out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(processor.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
License & Source Metadata Notes
- The starting checkpoint
thelamapi/next-ocrlistsapache-2.0in its repository YAML metadata while its README body displays an MIT badge, and its README refers to8Bwhilesafetensorsmetadata reports8,767,123,696(~8.77B) parameters. - Limitations: Very dense, low-DPI, or severely degraded scans may still produce character errors. Always verify critical numeric/legal fields in production workflows.