burapha β€” Thai Handwritten Character LoRA (Qwen2.5-VL-7B)

LoRA adapter that fine-tunes Qwen/Qwen2.5-VL-7B-Instruct to read single handwritten Thai characters. Trained on the BURAPHA-TH dataset only (experiment e1 of THIRA β€” Thai Handwriting Intelligence Recognition & Analysis).

Model Details

  • Base model: Qwen/Qwen2.5-VL-7B-Instruct, revision cc594898137f460bfe9f0759e9844b3ce807cfb5
  • Adapter: LoRA, r=16, alpha=32, dropout=0.05
  • Target modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
  • Task: read a single handwritten Thai character from an image crop and output the character
  • Prompt used during training/inference: "Read the handwritten Thai character in the image. Answer with the character only."

Dataset

Trained on BURAPHA-TH: A Multi-Purpose Character, Digit, and Syllable Handwriting Dataset (release 2021-03-06, ~70.8k balanced train samples used).

  • Source: https://services.informatics.buu.ac.th/datasets/Burapha-TH/
  • Citation: Burapha-TH: A Multi-Purpose Character, Digit, and Syllable Handwriting Dataset, Applied Sciences, 2022.
  • License / usage terms: Granted by the Burapha-TH team (Faculty of Informatics, Burapha University) for research and education use only β€” baselines, training/evaluation of prototypes, academic reports and publications. Commercial use is explicitly excluded from this permission; any commercial application requires contacting the dataset authors separately to negotiate terms. Any publication using this dataset must cite the paper above.

Evaluation

From the project's internal eval harness (runs/e1, see results.json in this repo for full detail).

Test set N CER char F1 Exact match
burapha (in-domain) 13,600 0.0388 0.9612 96.12%
hme (out-of-domain math) 24,607 0.4324 0.7490 12.47%
thai_sentence (out-of-domain prose) 2,032 0.5041 0.6856 1.87%
combined 38,207 0.4277 0.7516 42.24%

Findings

Everything below is measured, from the runs recorded in this project. It is reported here because a model card that only shows the in-domain number is misleading.

1. It learned Thai glyphs, not Thai text. 96.12% exact match on isolated BURAPHA characters collapses to 1.87% on connected Thai sentences (CER 0.504). BURAPHA is a character dataset; nothing in this adapter's training teaches word or sentence structure. Do not deploy it on Thai prose β€” use a sentence-trained adapter for that.

2. It is unusable on handwritten mathematics (CER 0.432, 12.47% exact). Expected for a single-dataset adapter, and the reason the project trained the joint e3.

3. Joint training dominates it. e3, trained on BURAPHA + HME100K together, scores 0.0400 on BURAPHA β€” statistically indistinguishable from this adapter's 0.0388 β€” while also scoring 0.0421 on maths, where this adapter scores 0.4324. There is no measured task on which e1 beats e3 by a meaningful margin. e1 is superseded by e3.

4. Weight-space merging does not recover this adapter's Thai skill. Merging e1 with the math adapter e2 at several ratios was tried and all of it was worse than joint training:

merge (e1–e2 weight) burapha CER hme CER thai_sentence CER
0.7 – 0.3 0.0480 0.1134 0.4386
0.5 – 0.5 0.1215 0.0592 0.4133
0.3 – 0.7 0.5144 0.0483 0.4797
e3 (joint training) 0.0400 0.0421 0.6753

Every merge ratio trades one skill for the other; joint training gets both. A three-way merge (e7) was also tried and lands at burapha 0.109–0.171 and hme 0.369–0.443 β€” worse than e3 on both. Do not merge these adapters; retrain jointly instead.

5. Not selected for the production pipeline. The Learnly MVP uses a routed two-adapter configuration β€” a sentence-trained Thai adapter for Thai-script regions, e3 for symbolic and mathematical regions. e1 is retained as the single-dataset baseline that establishes the BURAPHA ceiling, not as a deployed component.

How to read the CER numbers

CER here is corpus-level (total Levenshtein edits Γ· total reference characters) computed after a normalisation pass that strips outer math delimiters and applies latex_normalize. That normalisation collapses runs of whitespace but keeps single spaces, which is fine for this adapter but not comparable across decoders that emit space-separated tokens β€” see the note in the e3 card. Character precision/recall/F1 are an order-agnostic bag-of-characters overlap, not an alignment.

How to Use

import torch
from peft import PeftModel
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor

base = Qwen2_5_VLForConditionalGeneration.from_pretrained(
    "Qwen/Qwen2.5-VL-7B-Instruct",
    revision="cc594898137f460bfe9f0759e9844b3ce807cfb5",
    torch_dtype=torch.bfloat16,
)
model = PeftModel.from_pretrained(base, "TLDRKKU/burapha")
processor = AutoProcessor.from_pretrained("TLDRKKU/burapha")

Training Procedure

  • 1 epoch, cosine LR schedule, learning rate 1e-4, warmup ratio 0.03
  • Effective batch size 32 (per-device 8 Γ— grad accumulation 4)
  • bf16, gradient checkpointing enabled
  • Framework: PEFT 0.20.0

Related

  • TLDRKKU/HMk100 β€” HME100K-only adapter (e2)
  • TLDRKKU/burapha-HMk100 β€” joint adapter (e3), the one to prefer

Part of THIRA β€” Thai Handwriting Intelligence Recognition & Analysis.

Downloads last month
10
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for TLDRKKU/burapha

Adapter
(387)
this model