LoRA adapters (4-bit NF4 QLoRA) that adapt Qwen/Qwen3-VL-4B-Instruct to extract the main Persian title from a full book-cover image. Released with the MVIP2026 paper "Parameter-Efficient Adaptation of a Vision-Language Model for Persian Book-Cover Title Recognition".
seed_42/, seed_1234/, seed_2025/ = the three independent training runs
(3 available) used for the variability analysis.| Item | Value |
|---|---|
| Base model | Qwen/Qwen3-VL-4B-Instruct @ ebb281ec70b05090aa6165b016eac8ec08e71b17 |
| Dataset | shenasa/bookroom-persian-book-covers-and-titles @ 295d5c7cd89e041c0a9f230d774a39d92c7e6681 |
| Train / val | 1000 / 100 covers from the official train split (shuffle seed 42) |
| LoRA | r=16, alpha=32, dropout=0.05, targets q/k/v/o_proj |
| Trainable params | 11796480 |
| Training | 3 epochs, lr 1e-4 cosine, 10 warm-up steps, global batch 16, fp16 + fp32 adapters |
| Decoding | greedy, 1 beam, max 40 new tokens |
| System | N | Norm EM | Macro CER | Corpus CER | EditSim | Word F1 |
|---|---|---|---|---|---|---|
| Qwen2.5-VL-3B ZS | 4998 | 0.0714 | 0.6548 | 0.6577 | 0.4271 | 0.2886 |
| Qwen3-VL-4B ZS | 4998 | 0.0634 | 0.6214 | 0.6422 | 0.4187 | 0.2569 |
| Qwen3-VL-4B QLoRA s42 | 4998 | 0.0684 | 0.6732 | 0.6257 | 0.4583 | 0.3057 |
| Qwen3-VL-4B QLoRA s1234 | 4998 | 0.0684 | 0.6894 | 0.6294 | 0.4605 | 0.3069 |
| Qwen3-VL-4B QLoRA s2025 | 4998 | 0.0706 | 0.6812 | 0.6277 | 0.4588 | 0.3052 |
| EasyOCR + largest-text | 4998 | 0.0268 | 0.7396 | 0.7456 | 0.3273 | 0.1517 |
| EasyOCR + all-text | 4998 | 0.0040 | 2.1971 | 1.8399 | 0.2816 | 0.1400 |
| Tesseract + largest-text | 4998 | 0.0064 | 0.9380 | 0.9192 | 0.1351 | 0.0489 |
| Tesseract + all-text | 4998 | 0.0002 | 3.1575 | 2.5795 | 0.1798 | 0.0548 |
| Qwen3-VL-4B QLoRA mean (3 seeds) | 4998 | 0.0692 | 0.6813 | 0.6276 | 0.4592 | 0.3059 |
| Qwen3-VL-4B QLoRA std (3 seeds) | 0 | 0.0013 | 0.0081 | 0.0019 | 0.0011 | 0.0008 |
Mean/std rows are over the three training seeds. CER: lower is better.
import torch
from transformers import AutoProcessor, AutoModelForImageTextToText, BitsAndBytesConfig
from peft import PeftModel
base = "Qwen/Qwen3-VL-4B-Instruct"
proc = AutoProcessor.from_pretrained(base, revision="ebb281ec70b05090aa6165b016eac8ec08e71b17",
min_pixels=12544, max_pixels=451584)
model = AutoModelForImageTextToText.from_pretrained(
base, revision="ebb281ec70b05090aa6165b016eac8ec08e71b17", device_map="auto", dtype=torch.float16,
quantization_config=BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16, bnb_4bit_use_double_quant=True))
model = PeftModel.from_pretrained(model, "Fragoa/qwen3-vl-4b-persian-book-title-qlora") # or subfolder="seed_1234"
prompt = "عنوان اصلی فارسی کتاب را از روی جلد استخراج کن. فقط خود عنوان را بنویس؛ نام نویسنده، مترجم، ناشر و هیچ توضیح دیگری را ننویس."
msgs = [{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": prompt}]}]
text = proc.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
inputs = proc(text=[text], images=[image], return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=40, do_sample=False)
print(proc.batch_decode(out[:, inputs["input_ids"].shape[1]:], skip_special_tokens=True)[0])
Trained on 1,000 covers only; the model can over-generate (append author/publisher text) on short titles and occasionally answer in Latin script. Not a general Persian OCR system.
v2/1k_mlp_s42/adapter_model.safetensors 132 MBv2/full_mlp_s1234/adapter_model.safetensors 132 MBv2/full_mlp_s2025/adapter_model.safetensors 132 MBv2/full_mlp_s42/adapter_model.safetensors 132 MBadapter_model.safetensors 47 MBseed_1234/adapter_model.safetensors 47 MBseed_2025/adapter_model.safetensors 47 MBseed_42/adapter_model.safetensors 47 MBv2/full_attn_s42/adapter_model.safetensors 47 MBQwen/Qwen3-VL-4B-Instruct