One run, one GPU, about eleven hours: the vision side of LightOnOCR-3-1B learns historic hands, the language model stays as it is.
The training code follows with the code release.
| Base | lightonai/LightOnOCR-3-1B, revision 23d5440 |
|---|---|
| Trained | vision encoder + projector, 409.6 M of 1,005.6 M parameters; the language model frozen |
| Data | 21,038 pages / 17.7 M characters from 12 subsets (Data); validation 610 pages |
| Image | cropped to the sheet, longest edge 1540 px on a 28 px grid, JPEG XL distance 1, colour |
| Optimiser | AdamW, LR 2e-4, 50 warm-up steps, cosine to 0, gradient-norm clip 0.5, no weight decay |
| Batch | 8 pages per step × 4 accumulation = 32 pages |
| Length | 3,488 steps = 5.3 epochs; max sequence 6,144 tokens (no page cut); FlashAttention 2 |
| Hardware | 1 × NVIDIA RTX PRO 6000 Blackwell (peak memory 88.6 GB), 10 h 56 min |
The base model already writes German, French and Latin well; what it cannot do is read historic hands. Training only the vision encoder and the projector (41 % of the parameters) keeps its language knowledge intact. In a side test on the hardest source (Humboldt's manuscripts), opening the last four language layers or the whole language model at a low learning rate lowered the validation loss but did not read better beyond noise.
Every page is cropped to the paper edge (no scanner bed, colour chart or second page of a spread), scaled to 1540 px on its longest edge and stored as lossy JPEG XL. The validation set is a seeded 3 % hash of the page id — the same rule for every source — so no page is ever both trained and scored. Pages with a defect flag (the edition omits text, the text under-fills the page, a catchword unread), pages that failed the crop check and pages under 50 characters of ground truth are left out. The sources are not re-weighted: every page is seen once per epoch.
Checkpoints were saved along the run and each one read the 610 validation pages. The release is step 2600, the minimum of the validation loss on the 530 pages with checked ground truth. In two training runs with this recipe the later, annealed checkpoints read no better than that minimum — not on the validation pages — and the minimum kept the most exactly read words.
The recommended setting, greedy_rp1.1, is greedy decoding with a repetition penalty of 1.1 over only
the last 20 tokens. On all 610 validation pages it read at 4.74 % CER and ran away on 2 pages; the plain sampled setting
(temperature 0.1, top-p 0.9) read at 5.09 % with 7 runaways. A whole-context repetition penalty, as built into most
inference libraries, taxes every mark and line break on the page and caused block loops.
About 11 GPU-hours on one RTX PRO 6000. Adapting the model to a new hand costs far less: in a first few-shot test, 28 pages of an unseen, hard collection and 60 training steps (under an hour) roughly halved its CER, from 44 % to 25 % — one collection, a preliminary result.