/ Модель

Характеристики

Контекст
262 144 токена
Лицензия
Apache 2.0
Архитектура
qwen3_5 · dense
Базовая модель
LightOnOCR-3-4B
Библиотека
transformers
Опубликована
3 ноя 2026

LightOnOCR-3-4B-cultural-heritage-eng

Изображение и текст → текст3 профессии
86скачиваний за 30 дней1лайквеса обновлены3 ноя 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Модель транскрибирует рукописные англоязычные архивные страницы Yale построчно, сохраняя исходное написание и добавляя редакторскую разметку Smithsonian.

LightOnOCR-3-4B-cultural-heritage-eng — модель распознавания текста на изображениях, созданная дообучением LightOnOCR-3-4B командой Yale Cultural Heritage. Она предназначена для построчной транскрипции рукописных англоязычных архивных документов из коллекций библиотеки Йельского университета с соблюдением соглашений Smithsonian Transcription Center: сохраняет исходное написание, пунктуацию и регистр, а также добавляет редакторскую разметку для зачёркиваний, помет на полях, неуверенных прочтений, таблиц, печатей, штампов и пустых страниц.

Модель использует архитектуру Qwen3.5ForConditionalGeneration и принимает изображение страницы вместе с транскрипционным запросом. Она обучена на 11 029 страницах, а при проверке на 582 страницах из 39 документов получила CER 0,077 и WER 0,0983; точное совпадение с эталоном составило около 61% строк. На этих данных она показала лучший CER среди 16 сравнивавшихся вариантов. Для применения требуется использовать предусмотренный карточкой prompt.txt.

Результаты наиболее надёжны для рукописей и типов документов, похожих на обучающие материалы из пяти коллекций Yale. На других почерках, периодах, языках и типах документов качество может быть ниже; редакторские теги полезны, но их расположение приблизительно, а результат требует проверки человеком. Лицензия — Apache-2.0.

Сценарии применения

  • транскрибация рукописных архивных страниц на английском языке
  • оцифровка рукописей из исторических коллекций
  • построчное распознавание текста в документах Yale
  • извлечение помет на полях, зачёркиваний и неуверенных прочтений
  • подготовка черновиков транскрипций для проверки архивистом

Ограничения

Качество может снижаться на почерках, периодах, языках и типах документов, отличающихся от обучающих коллекций Yale. Редакторская разметка приблизительна, около 61% строк совпали с эталоном точно, поэтому результат следует проверять человеком.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Бенчмарки пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь рядом с другими моделями теста

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Изображение → текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

LightOnOCR-3-4B-cultural-heritage-eng

lightonai/LightOnOCR-3-4B fine-tuned to transcribe handwritten English-language archival documents from Yale Library collections, following Smithsonian Transcription Center style conventions.

Given a page image and the transcription prompt (shipped here as prompt.txt), the model returns the page line by line, preserving original spelling, punctuation and capitalisation, with editorial markup for deletions, marginalia, uncertain readings, tables, seals, stamps and blank pages.

Results

All numbers come from the same evaluation job, so the base and fine-tuned rows are a direct comparison. Decoding is greedy, with up to 2,048 new tokens and 2,048 visual tokens per page.

metric (582 held-out pages)base LightOnOCR-3-4Bthis model
CER0.25640.0770
WER0.30190.0983
line recall0.24060.6066
pages transcribed exactly0.7%13.9%
degenerate (looping) pages0.2%0.0%

CER and WER are micro-averaged (total edits ÷ total reference characters or words), after Unicode NFD normalisation. Line recall is the share of reference lines reproduced exactly and in order.

How much of the error is markup?

Most of the remaining error is in the editorial markup, not in the reading. The reference and the prediction for the 527 non-blank held-out pages were rescored with markup removed from both sides:

what is ignoredCER
nothing (whitespace tidied)0.0755
[[...]] tags ([[strikethrough]], [[left margin]], [[?]], [[seal]] ...)0.0419
+ abbreviation expansions, y[ou]r → yr0.0382
+ table column separators |0.0369

Removing the double-bracket tags alone accounts for nearly half of all character errors, although the tags are under 5% of the reference text. The model uses the right kinds of tags at about the right rate, but it often places them differently from the human transcriber. For example, it marks uncertainty ([[?]]) on different words. Treat the tags as useful but approximate, and the underlying text as the reliable part.

Compared with other models trained on the same data

The same data and the same evaluation pages were used to train other open vision-language models, each with both LoRA and full fine-tuning. This model was the best of 16:

modeltuningCERline recall
LightOnOCR-3-4B (this model)LoRA0.07700.607
Qwen3.5-4BLoRA0.10470.590
Qwen3.5-9BLoRA0.10990.616
chandra-ocr-2LoRA0.11010.596
LightOnOCR-3-0.8BLoRA0.11590.570
Qwen3.5-2BLoRA0.11900.573
LightOnOCR-3-4Bfull fine-tune0.12600.571

For every model except LFM2.5-VL, LoRA beat full fine-tuning at this data size; for Qwen3.5-0.8B the two were tied.

Usage

The model was trained with the prompt in prompt.txt, and it should be served with that same prompt. LightOnOCR's own empty-prompt "transcription mode" is a different task and does not produce the Smithsonian conventions.

pip install "transformers>=5.5.4" torch pillow huggingface_hub
import torch
from PIL import Image
from huggingface_hub import hf_hub_download
from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration

REPO = "yale-cultural-heritage/LightOnOCR-3-4B-cultural-heritage-eng"

model = Qwen3_5ForConditionalGeneration.from_pretrained(
    REPO, dtype=torch.bfloat16, device_map="auto"
).eval()
processor = AutoProcessor.from_pretrained(REPO)   # carries the 2,048-visual-token page budget
prompt = open(hf_hub_download(REPO, "prompt.txt"), encoding="utf-8").read()

image = Image.open("page.jpg").convert("RGB")
messages = [{
    "role": "user",
    "content": [{"type": "image"}, {"type": "text", "text": prompt}],
}]
text = processor.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = processor(text=[text], images=[[image]], return_tensors="pt").to(model.device)

with torch.inference_mode():
    out = model.generate(
        **inputs,
        do_sample=False,          # greedy, as evaluated
        max_new_tokens=2048,
    )

print(processor.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip())

generation_config.json sets do_sample=False and repetition_penalty=1.1. The penalty is there for serving: across these experiments it suppressed occasional repetition loops. The table above was produced without it (repetition_penalty=1.0); pass that value to reproduce it exactly.

With vLLM

vllm serve yale-cultural-heritage/LightOnOCR-3-4B-cultural-heritage-eng \
  --default-chat-template-kwargs '{"enable_thinking": false}'
import base64, requests
from huggingface_hub import hf_hub_download

REPO = "yale-cultural-heritage/LightOnOCR-3-4B-cultural-heritage-eng"
prompt = open(hf_hub_download(REPO, "prompt.txt"), encoding="utf-8").read()
image_b64 = base64.b64encode(open("page.jpg", "rb").read()).decode()

r = requests.post("http://localhost:8000/v1/chat/completions", json={
    "model": REPO,
    "messages": [{"role": "user", "content": [
        {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_b64}"}},
        {"type": "text", "text": prompt},
    ]}],
    "temperature": 0,
    "max_tokens": 2048,
})
print(r.json()["choices"][0]["message"]["content"])

Do not put a literal <image> placeholder in the text when calling an OpenAI-style API. The image is a separate content part, and a stray <image> string degrades output.

Training

The model was trained by supervised fine-tuning on page images paired with their reference transcriptions. Its input was the page image followed by the prompt, and its target was the transcription. Only the transcription tokens were scored in the loss; the prompt and image were masked. A LoRA adapter was trained on both the vision encoder and the language decoder and then merged into the base weights, so this repository is a standalone checkpoint with no peft dependency.

The vision encoder is adapted as well because the input (handwritten archival documents) is unlike the printed documents LightOnOCR was built for. In earlier experiments in this project, adapting the encoder was the single largest improvement measured.

base modellightonai/LightOnOCR-3-4B (Qwen3_5ForConditionalGeneration)
methodLoRA, merged after training
LoRA rank / alpha / dropout32 / 64 / 0.05
adapted modules347 linear layers, vision tower and language decoder
trainable parameters78.1 M of 4.62 B (1.7%)
training pages11,029 (4 of 11,033 longer than the 8,192-token budget were dropped, not truncated)
epochs3 (4,137 optimizer steps)
effective batch8 (1 × 8 gradient accumulation)
learning rate1e-4, cosine schedule
max sequence length8,192 tokens
visual tokens per page2,048 (≈2.1 MP after resize)
precisionbf16, gradient checkpointing
hardware1 × NVIDIA RTX PRO 6000 Blackwell (96 GB), Yale Bouchet cluster
wall time20.8 h
validation loss by epoch0.255 / 0.233 / 0.251

Sequences are never truncated. A truncated target teaches the model to stop mid-page, and a truncated prompt removes the rules the target follows, so over-length samples are dropped instead.

The held-out split

The evaluation pages come from 39 whole documents (archival folders), stratified across the collections. A page-level random split would put pages in the same hand on both sides, and would measure memory of that hand rather than reading. The 39 documents and their 582 pages form the validation split of the dataset.

Limitations

  • English-language archival handwriting, Yale collections. The training pages come from five collections: ru_151, ycal_mss_1616, ru_1154, ru_0056 and gen_mss_1457. Expect weaker results on hands, periods, languages and document types far from these.
  • Markup is a convention, not ground truth. Where to place [[?]], which deletions to tag, and when a mark counts as a [[stamp]] or a [[seal]] are judgement calls. The model learned the conventions, but its tag placement often differs from a human's (see above).
  • Differences under about 0.02 CER are not meaningful. In this project, repeated runs of one configuration differ by up to 0.02 CER.
  • The output needs review. About 61% of lines come out exactly right, so plan for human review before using it as an edition.

Acknowledgements

The transcriptions were prepared by Jon Manton and his team. The images are from Yale Library collections. The base model is LightOn's LightOnOCR-3-4B, released under Apache 2.0.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
Qwen3_5ForConditionalGeneration
Ревизия весов
316da7f

0 моделей