lector-4b-v1
A page reader for Latin scholastic print (16thโ20th century): one page image in, one Markdown page file
out, in the diplomatic-v1 dialect (print spelling, รฆ/ล, &, accents, u/v, abbreviation marks; long s as
s; footnotes ^[โฆ], marginal notes ^[โฆMโง โฆ], a footnote continued from the previous page as a last
block starting โฆCONTINUED-NOTEโง). Full fine-tune of Qwen/Qwen3.5-4B (4.66B parameters, bf16 9.3 GB), 2 epochs, 3,732 pages + 2,000
lines, by lector (Schola Thomistica), 2026-11-01; internal run ft6. Same data and prompt as
lector-2b-v1: only the size differs.
The name: a lector read the set text aloud and expounded it in the medieval schools; the Dominican order still grants the degree of Lector of Sacred Theology.
Use it exactly like this
- Prompt:
prompt.txtin this repo, verbatim, as the only text of one user turn after the image. It is the prompt the model was trained on; later lector prompts belong to later models. - Image: one portrait page (split two-page spreads at the gutter first), RGB, longest side resized
to 1280 px (Lanczos) when larger. Processor:
min_pixels = 256*32*32,max_pixels = 1280*1280. - Decoding: bf16, greedy (
do_sample=False,repetition_penalty=1.0),max_new_tokens=3500, stop at<|im_end|>or eos, chat template withenable_thinking=False. - Loop guard on the output (lector
prompts.unloop), always:A page where the guard fired lost text after the loop: re-read it another way.text = re.sub(r"^\|.*$\n?", "", text, flags=re.M) # tables are not in the dialect text = re.sub(r"(.{12,1500}?)\1{2,}", r"\1", text, flags=re.S) # a run repeated 3+ times -> once
Scores (lector-bench v0, md_cer folded, page-weighted, through the loop guard)
| all 146 pages | public split, 86 pages | public: omit30 / insert30 | marginal notes found | |
|---|---|---|---|---|
| ft2 (Qwen3-VL-2B, internal) | 0.137 | 0.059 | 8 / 1 | 4 / 103 |
| ft4 (Qwen3.5-2B, internal) | 0.099 | 0.089 | 14 / 3 | 45 / 103 |
| lector-2b-v1 (ft5) | 0.092 | 0.066 | 6 / 3 | 48 / 103 |
| lector-4b-v1 (ft6) | 0.076 | 0.039 | 3 / 1 | 71 / 103 |
omit30 / insert30: pages where a run of 30+ words was skipped or invented. รlvarez 1610: 0.022 (2b-v1 0.053); Bรกรฑez 1602: 0.256 (0.449); 19thโ20th-century print: 0.002โ0.04. Validation loss 0.087 (2b-v1 0.103). Generation took about as long per page as 2b-v1 (โ 8 s; 2b-v1 on an H100, this one on an H200).
Known weaknesses
- Very dense, heavily abbreviated old print (Bรกรฑez 1602: 0.26), which no training page resembles.
- It can stop at the foot of the first column of a two-column old page (Hurtado p. 42: half the page). Check the length of what it returns against the page.
- Loops are rarer than in 2b-v1 but possible; keep the guard.
- It sometimes writes
^[โฆMโงโฆRโง โฆ](paragraph summary). Treat that role as a guess (2b-v1's precision was 0.59 on v0): the kind of a marginal note is decided at scouting/QA, not by the reader.
- Downloads last month
- 19