Qwen3.5-0.8B IAM Handwriting OCR (25-step GGUF)
A compact vision-language model fine-tuned to transcribe one cropped line of English handwriting at a time. This release contains the merged 25-step LoRA checkpoint as Q4_K_M weights and a separate BF16 vision projector. The model runs locally with a multimodal build of llama.cpp. Qwen3.5-0.8B-Base · Teklia/IAM-line
Files
| File | Contents | Size |
|---|---|---|
Qwen3.5-0.8B-Base.Q4_K_M.gguf | Fine-tuned model weights | 529 MB |
mmproj-Qwen3.5-0.8B-Base-BF16.gguf | Vision encoder and projector for image input | 207 MB |
Run locally
Download both files with the Hugging Face CLI. Replace line.png with a tightly cropped image of one handwritten line. llama.cpp multimodal documentation
hf download leonnzhang/qwen3.5-0.8b-iam-25-GGUF \
Qwen3.5-0.8B-Base.Q4_K_M.gguf \
mmproj-Qwen3.5-0.8B-Base-BF16.gguf \
--local-dir .
llama-mtmd-cli \
-m Qwen3.5-0.8B-Base.Q4_K_M.gguf \
--mmproj mmproj-Qwen3.5-0.8B-Base-BF16.gguf \
--image line.png \
--jinja -c 2048 --temp 0 -n 64 \
-p "Transcribe the text visible in the image."
For CPU-only inference, add --device none --no-mmproj-offload --no-op-offload. The expected answer is the transcription as plain text. A runtime may display chat-template markers in its terminal output.
Training
Unsloth Studio used supervised LoRA fine-tuning on Apple Silicon with MLX, targeting both the language and vision layers. The run prepared 1,024 line images from the training split and 976 from the validation split. Unsloth merged the LoRA weights before exporting the GGUF pair.
| Setting | Value |
|---|---|
| Base checkpoint revision | a9a407bcae463285164cc9133995c515379cebe5 |
| Dataset revision | fbdad97500ce54635c0d1ba306bf535cb40656cf |
| Optimizer steps | 25 |
| Epochs completed | 0.195 (about 19.5% of one pass) |
| LoRA rank / alpha / dropout | 16 / 16 / 0 |
| Effective batch size | 8 (batch size 2 × 4 accumulation steps) |
| Peak learning rate | 2 × 10⁻⁴ with 5 warmup steps and linear decay |
| Maximum sequence length | 2,048 tokens |
| Seed | 3407 |
The run was configured for three epochs with a 25-step cap. It reached that cap after 200 image presentations from the 1,024-image training subset.
Evaluation
| Training-log measurement | Step | Value |
|---|---|---|
| First logged validation loss | 2 | 2.1068 |
| Last logged validation loss | 24 | 0.2483 |
| Last logged validation perplexity | 24 | 1.2819 |
| Final logged training loss | 25 | 0.2013 |
These measurements come from the training run before GGUF export. In a local smoke test with both exported GGUFs and llama.cpp, the model returned the text “The morning train was late.” from a synthetic line image. Character error rate (CER) and word error rate (WER) on the IAM test split remain unmeasured.
Handwritten medication-name benchmark
Promptfoo evaluated the exported checkpoint and two Qwen3.5-0.8B baselines in LM Studio at temperature 0. All three received the same prompt and the same 100 cropped images, covering 59 distinct medication names from the test split of a dataset separate from the IAM training data. Handwriting OCR dataset
| Model | Character error rate ↓ | Character edits ↓ | Exact match ↑ |
|---|---|---|---|
| Qwen3.5-0.8B Base (BF16) | 65.22% | 405 | 18/100 (18%) |
| Qwen3.5-0.8B Instruct (MLX 4-bit) | 43.96% | 273 | 21/100 (21%) |
| This checkpoint (Q4_K_M GGUF) | 32.69% | 203 | 26/100 (26%) |
Character error rate (CER) is the total Levenshtein edit count divided by the 621 reference characters. Exact match requires the entire name to match, including capitalization and internal punctuation, after the same output cleanup for all models. Cleanup trims surrounding whitespace and removes trailing closing thinking markers and stray space-separated periods.
Compared with Base, the exported checkpoint reduced character edits by 49.9% and increased exact match by 8 percentage points. These results reflect the complete inference configurations, including differences in weight format and precision. The 100-image subset was reused during development.
Limitations
The training data consists of cropped English handwriting lines. Performance on full-page layouts, other languages, degraded scans, and unfamiliar handwriting styles remains unmeasured. Ambiguous characters may be omitted, substituted, or guessed. Check important transcriptions against the source image.
Attribution
The base model is distributed by Qwen under Apache 2.0. The training data is Teklia’s line-level packaging of the IAM Handwriting Database by Urs-Viktor Marti and Horst Bunke. See the upstream resources for their respective terms. Qwen license · Dataset card · IAM paper