TitanOCR handwriting reader — Qwen3.5-0.8B (run A4, GGUF)
A LoRA fine-tune of Qwen/Qwen3.5-0.8B that reads one cropped line or word of handwriting — doctor-style prescription scrawl — and writes it verbatim.
It was built for TitanOCR, where it runs on CPU as a second reader behind PP-OCR:
- every reading is force-aligned against the CTC recogniser's per-frame posteriors for the same crop, which gives pixel support and word boxes;
- the losing reading is kept;
- until a calibration fitted on human truth exists, every line whose text this model delivers is flagged for review.
Not for clinical decisions. This is a research and demo model. It makes no accuracy claim, and its readings need human review.
Files
| File | What | Bytes | sha256 |
|---|---|---|---|
titanocr-hw-qwen35-08b-a4-Q8_0.gguf | language model | 833,592,000 | 9787910d8c5f6b743ecbef62b975e1c055cbc7066c8a318196fa35d9fd0cfa64 |
titanocr-hw-qwen35-08b-a4-mmproj-F16.gguf | vision projector | 204,986,560 | 9d2b0c51133c0b5509f9b631c0282cb967c369ea8c514850e9295349deb74ecd |
How it is run
The runtime is llama.cpp 30f7df1a831b (tag b11586):
llama-server --model titanocr-hw-qwen35-08b-a4-Q8_0.gguf \
--mmproj titanocr-hw-qwen35-08b-a4-mmproj-F16.gguf \
--threads 2 --threads-batch 2 --parallel 1 --seed 0 \
--reasoning off --cache-ram 0 --no-repack --jinja \
--image-min-tokens 8 --image-max-tokens 256
Resize every crop first, exactly as in training: 128 px high (aspect kept, bicubic), both sides rounded to multiples of 32, at most 2 048 px wide — a wider line is shrunk to fit with its height still a multiple of 32 (titanocr.engines.handwriting.normalise_crop). With the token limits above, llama.cpp then never resizes it again; a long line costs at most 256 image tokens.
Each request sends the image first, then the prompt htr-crop@v3 (included), with:
- greedy decoding (
temperature 0,top_k 1); max_tokens 96;- the grammar
latin-text.gbnf(included): printable ASCII without the backslash and the backtick, plus£, and⟨?⟩for an unreadable word. It rules out look-alike Cyrillic or Greek letters, LaTeX and markdown code.
Training (run A4)
- Data. Real handwriting only (synthetic font lines made two earlier readers worse):
- GNHK's train half (CC BY 4.0), lines straightened along their own direction, with
⟨?⟩where GNHK's annotators marked an illegible scribble: 6,703 train and 476 val lines (val by document); - RxHandBD's Train_Set words (CC BY 4.0), as in run A2: 3,675 train and 193 val crops.
Never trained on: GNHK's test half, RxHandBD's Test_Set and the
rxhandbd-devsplit.
- GNHK's train half (CC BY 4.0), lines straightened along their own direction, with
- Recipe. Unsloth 2026.9.12, transformers 5.5.0, trl 0.24.0, peft 0.20.0. LoRA
r=32, alpha=32 on the vision and language layers; 2 epochs, lr 2e-4, fp16 on a Tesla T4
(Kaggle); seed 38. Training took 3370 s, and loss fell from 3.05 to
0.053. The full record is in
run.json. - Export. The adapter was merged, then converted with llama.cpp's
convert_hf_to_gguf.pyat30f7df1a831b: language model Q8_0, vision projector F16.
Development evidence — not an accuracy claim
Handwritten lines. 300 lines from GNHK's test half (a seeded sample of its 2,056 fully handwritten test lines; human labels; never trained on), read on CPU (Apple M5, 2 threads) with greedy decoding:
| Reader | CER | exact | letters-only exact |
|---|---|---|---|
| PP-OCRv5 (TitanOCR's shipped recogniser) | 22.8 % | 17.7 % | 26.7 % |
| Qwen3.5-0.8B + run A2 (the previous reader, trained on single words) | 31.3 % | 15.3 % | 40.3 % |
| Qwen3.5-2B, untrained | 30.5 % | 34.3 % | 54.7 % |
| this model | 11.7 % | 41.0 % | 65.7 % |
Prescription words. On 60 crops of RxHandBD's rxhandbd-dev split (never trained on) it
reads 75.0 % letters-only exact, against run A2's 76.7 %: the line training did not cost
single words.
On the in-run val split (669 lines and crops, measured on the GPU), letters-only exact went from 48.4% to 73.4%.
Treat these numbers with care:
- n = 300 lines from 172 photos: the intervals are a few points wide;
- GNHK is English notes, lists and diaries, not prescriptions;
- no human-labelled set of Indian prescriptions has been read yet.
Limitations
- Training data. English handwriting in phone photos (GNHK: notes, lists, diaries from Europe, North America, Africa and Asia) and Bangladeshi prescription words (RxHandBD). Indian doctors' prescriptions, other languages and other scripts are untested.
- It can "correct". A fluent model can turn a misspelt word into a plausible drug name. TitanOCR checks every reading against the pixels for exactly this reason; on its own, this model has no such check.
- Uncalibrated. Its token probabilities are not P(correct).
- Speed on CPU. A median of 1.9 s per handwritten line (3.3 s at p90) on 2 CPU threads (Q8_0, Apple M5), with lines up to 2 048 px wide; a single word takes about 0.5 s, as with run A2.
Licence and attribution
- Weights: Apache-2.0, as is the base model Qwen/Qwen3.5-0.8B.
- Training data:
- GNHK — A. W. C. Lee, J. Chung, M. Lee, GNHK: A Dataset for English Handwriting in the
Wild, ICDAR 2021, https://www.goodnotes.com/gnhk, licensed CC BY 4.0 (fetched from the
Hugging Face copy
aryaman27/goodnotes-handwritten-dataset@90429776); - RxHandBD — Md Masudul Islam, RxHandBD: A Handwritten Prescription Word Image Dataset, Mendeley Data V3, doi:10.17632/dsb5r6vskg.3, licensed CC BY 4.0.
- GNHK — A. W. C. Lee, J. Chung, M. Lee, GNHK: A Dataset for English Handwriting in the
Wild, ICDAR 2021, https://www.goodnotes.com/gnhk, licensed CC BY 4.0 (fetched from the
Hugging Face copy