Results
CER / WER (lower is better), greedy decoding, 50 samples each on the held-out eval split and on external ahmedheakl/arocrbench_khatt:
Table with columns: Model, Eval CER ↓, Eval WER ↓, KHATT CER ↓, KHATT WER ↓| Model | Eval CER ↓ | Eval WER ↓ | KHATT CER ↓ | KHATT WER ↓ |
|---|
| Qwen3-VL-2B-Instruct (base) | 0.792 | 0.947 | 1.893 | 1.801 |
| Alhazen-OCR | 0.328 | 0.504 | 0.841 | 1.193 |
Held-out character error: 0.79 → 0.33. External KHATT handwriting: 1.89 → 0.84 CER.
This release (khattmix) adds line-level KHATT handwriting (~30% of the mix) on top of synthetic printed, invoices, and paragraph handwriting; KHATT-bench transcript overlap is removed from train.
Training
- Objective: QLoRA SFT, one epoch
- LR: 2e-5 cosine, warmup 5%
- Effective batch: 16 (8 × grad accum 2) on A100 80GB
- LoRA: r=16, RSLoRA, vision + language layers
- Mix: ~30% loay synthetic / 15% invoices / 30% KHATT lines / 23% KHATT paragraphs / 2% historical (~18k train rows)
Usage
Serve the base with the adapter attached (vLLM example):
vllm serve Qwen/Qwen3-VL-2B-Instruct \
--enable-lora \
--lora-modules alhazen=context212/alhazen-ocr \
--limit-mm-per-prompt '{"image": 1}' \
--mm-processor-cache-gb 0 \
--no-enable-prefix-caching
Prompt:
Extract all the text from this image, preserving the original reading order.
Keep temperature=0 for transcription.
Limitations
- Tuned for Arabic institutional paperwork; not a general multilingual OCR.
- KHATT remains harder than printed forms — scores above 1.0 CER mean many lines are still wrong.
- Eval above is capped at 50 samples per split; treat as directional until a full-split rerun.
Citation
@misc{alhazen-ocr-2026,
title = {Alhazen-OCR},
author = {Context212},
year = {2026},
howpublished = {\url{https://huggingface.co/context212/alhazen-ocr}}
}