Llama Party: multilingual page-wise text recognition base model

Hugging Face Hub mirror

This repository mirrors the canonical Zenodo release by Benjamin Kiessling, ALMAnaCH, Inria Paris. The files are byte-identical to the Zenodo release and have not been modified by Small Models for GLAM.

Use from the Hugging Face Hub

Party needs kraken plus the party package from GitHub (the Party project on PyPI is unrelated).

pip install "kraken>=7.0" huggingface_hub git+https://github.com/mittagessen/party

hf download small-models-for-glam/kraken-party-base model.safetensors --local-dir ./kraken-party-base

# input.xml: a segmented page (ALTO/PAGE), e.g. from `kraken segment -bl`
kraken -f alto -a -i input.xml out.xml ocr -m -B 32 ./kraken-party-base/model.safetensors

Party is page-wise recognition of text-y. It is a replacement for conventional text recognizers in automatic text recognition pipelines that utilize either bounding box or baseline+bounding polygon segmentation methods for layout analysis.

Llama party is a full-page generative text recognizer that has been pretrained on a large corpus of multilingual historical, contemporary, and born-digital document page images, both handwritten and machine-printed.

Architecture

The recognizer is a deep fusion multimodal model consisting of a Swin vision encoder and a tiny Llama (40m parameters) decoder trained with octet tokenization. The network is prompted with the line positions through positional embeddings added to the encoder hidden state. Line prompts can be encoded either as bounding boxes or as baseline+bounding curves, so the model is compatible with both segmentation paradigms.

During training the encoder weights were initialized with an ImageNet-22k pretrained Swin-base from pytorch-image-models, the decoder weights came from a custom Llama 3.2 pretrained on the historical and cultural subset of the Common Corpus tokenized with a ByT5-style octet tokenizer.

Uses

Llama party is a recognition foundation model primarily targeted at automatic text recognition for the humanities. While it produces fairly accurate output on an impressive range of material it is intended to be fine-tuned on some target dataset to ensure compliance with desired transcription guidelines.

Transcription guidelines, Normalization, and Transformations

No attempts have been made to normalize the datasets or to only use data adhering to common transcription guidelines. While some subsets of the corpus are internally consistent, only a very small subset of the languages in the training data only contain datasets from a single source.

Text was normalized to Unicode NFD and whitespace was normalized during training.

Bias, Risks, and Limitations

The training corpus is heavily skewed towards a couple of languages (English, French, German, Latin, and Middle French) and frequently incorporates datasets of esoteric material transcribed for specific purposes. Especially machine-printed and born-digital material lack diversity, so error rates will most likely vary considerably across languages and document type.

Some additional limitations are to be expected:

  • For a number of languages the training material is small and/or comes from a single source (e.g. Ancient Greek, Finnish, Georgian, Malayalam, Slovak), resulting in markedly higher error rates that will require fine-tuning.
  • Some transcriptions resolved abbreviations while others did not. Inconsistent output is to be expected, in particular for European manuscripts in Latin script.
  • As the model predicts 8-bit UTF-8 code units directly the lack of consistent Unicode normalization can cause slightly different code point streams during prediction.

How to Get Started with the Model

Install kraken through pip and the party package from github and follow the instructions. Inference is handled through kraken:

$ kraken -f alto -a -i input.xml out.xml ocr -m -B 32 ~/model.safetensors

Training Details

Training Data

The model has been pretrained on a large collection of publicly available ATR datasets, in addition to a number of restricted datasets.

Language Datasets
Ancient Greek EPARCHOS
HPGTR
HTR_CPgr23
Stavronikita Monastery Greek Handwritten Document Collection No. 114
Stavronikita Monastery Greek Handwritten Document Collection No. 53
Stavronikita Monastery Greek Handwritten Document Collection No. 79
11 private datasets
Arabic Agapet
Muharaf: Manuscripts of Handwritten Arabic Dataset
RASAM dataset
TariMa
arabic_ms_data
OpenITI Arabic Print Data
Catalan FONDUE-CA-PRINT-20
htromance-spa
1 private dataset
Church Slavonic 3 private datasets
Corsican OCR Corse
Czech 2024--medieval-czech-main
2023--medieval-czech
HTR Winter School 2025 - Medieval Czech - Biblioteka Jagiellonska BJ Rkp 441 IV
Paderov Bible handwriting ground truth
Dutch 6000 ground truth of VOC and notarial deeds / HTR of VOC, WIC and notarial deeds
ARletta
Dagboek Ernest Clarysse
FONDUE-NE-MSS-17-PR
English FONDUE-EN-PRINT-20
IAM Handwriting Database
jcrs_train
JosephHookerHTR
sloanelab
The Revolutionary City / RevCity documentation
OCR-D gt_structure_text
2 private datasets
Finnish NewsEye/READ OCR Finnish Newspapers
French Antoine Verard extracts
Copiste-d-un-jour
corpus-HTR-lignes-mixtes
dataset-celestine-doniau-danest
FONDUE-FR-MSS-16
FONDUE-FR-MSS-19-PR
FONDUE-FR-PRINT-20
genauto-td-htr
HTR Front Justice
La Correspondance Doucet-Rene Jean
Memoire sur St Domingue par H. M. Michel
Moonshines
NewsEye READ AS French Newspapers
Recensement Valaisan (Valais Time Machine)
Tapus Corpus
TIMEUS Corpus
TitresNobiliaires_17_18
FONDUE-MLT-ART
NuBIS-OCR
1 private dataset
Georgian 15 private datasets
German gt-fraktur
german_kurrent_handwritten_text_lines
OCR-D gt_structure_text
FONDUE-MLT-ART
2024--German-Group-main
2025--Early-Modern-German
Bullinger Digital Gwalther handwriting ground truth
charlottenburger-amtsschrifttum
Chronicling Germany
dach-gt
DigiTheo Ground Truth
Dresdner Hofdiarium
Fibeln
FONDUE-DE-MSS-16-PR
FONDUE-DE-MSS-18
FONDUE-DE-MSS-19-PR
FONDUE-DE-MSS-20-PR
FONDUE-MLT-PRINT-TEST
FoNDUE_Kunsthistorisches-UZH_Archivdatenbank
Ground truth for Neue Zurcher Zeitung black letter
Hakenkreuzbanner
inzigkofen
Klosterneuburg, Stiftsbibl., Cod. 48
koenigsfelden
mkn-kurrent-gt
NewsEye / READ OCR Austrian Newspapers
nuremberg_letterbooks
reichsanzeiger-gt
Weisthuemer
Training Data Incunabula Reichenau
1 private dataset
German (shorthand) 1 private dataset
Hebrew 2025-hebrew
2 private datasets
Italian Diario del Soldato Bruno Celestino
EpiSearch HTR
FONDUE-IT-PRINT-20
FONDUE-IT-PRINT-20-PR
HTRogène Medieval Italian Manuscripts
HTRomance, Medieval Italian corpus of ground-truth for Handwritten Text Recognition
LiDi1.0-project
2 private datasets
Latin OCR-D gt_structure_text
NuBIS-OCR
Training Data Incunabula Reichenau
2025--late-medieval-latin-main
burchards-dekret-digital
Caroline Minuscule ground truth
Carolingian Latin Group HTR Wien Winter School 2025
CREMMA Medii Aevi
DISTINGUO Latin ground truth
Eutyches
FONDUE-LA-MSS-16-PR
FONDUE-LA-MSS-17-PR
FONDUE-LA-MSS-MA
FONDUE-LA-PRINT-16
HTR Winter School 2023/2024 - Late Medieval Latin, ONB 3891
HTR Winter School 2024/2025 - Late Medieval Latin, ONB 4135; ONB 4680
HTRogène Medieval Latin Manuscripts
HTRomance, Medieval Latin corpus of ground-truth for Handwritten Text Recognition
notarial_charter
Paris Bible Project
Wien ONB Cod 2160 ground truth
Malayalam Ground Truth data for printed Malayalam
Middle Dutch data
Middle French Cremma Medieval
De la généalogie des dieux
Données imprimés du 16e siècle
Données HTR incunables du 15e siècle
Données HTR manuscrits du 15e siècle
Données imprimés du 18e siècle
Fabliaux
FONDUE-FR-AAEB-16
FONDUE-FR-AAEB-17
FONDUE-FR-MSS-18
FONDUE-FR-PRINT-16
FONDUE-FR-PRINT-17
HTR-SETAF-Jean-Michel
HTR-SETAF-LesFaictzJCH
HTR-SETAF-Pierre-de-Vingle
HTRogene French
HTRomance, Medieval French corpus of ground-truth for Handwritten Text Recognition
Imprimés 17e siècle
Liber
OCR17plus
TNAH-2021-DecameronFR
transcription-chastel
Multilingual Training Data Incunabula Reichenau
TranscriboQuest25_MedVernacReligio
Norwegian NorHand v3 / Dataset for Handwritten Text Recognition in Norwegian
Occitan HTRogène Medieval Occitan Manuscripts
1 private dataset
Ottoman Turkish arabic_ms_data
OpenITI Arabic Print Data
Persian arabic_ms_data
OpenITI Arabic Print Data
Picard 1 private dataset
Portuguese iForal-Dataset
Portuguese Handwriting 16th-19th c.
Russian 2 private datasets
Slovak Slovensky Supermodel P&T1
Spanish htromance-spa
FoNDUE Spanish chapbooks 19th c. Dataset
FONDUE-ES-MSS-19-PR
FONDUE-ES-PRINT-19
HTR - Araucania manuscript XIX
HTRogène Medieval Spanish Manuscripts
ohg
3 private datasets
Swedish Finnish Court Records-sub500
kat57 Swedish ground truth dataset
NewsEye / READ OCR training dataset from Swedish Newspapers
riskarchiv
Syriac zenodo.18157525
winter_school_vienna
2 private datasets
Ukrainian 1 private dataset
Urdu OpenITI Arabic Print Data
Vietnamese 1 private dataset
Yiddish 7 private datasets

Training Procedure and Hyperparameters

  • Training regime: 5 × A40 GPU, BF16 mixed precision, Muon optimizer (with an auxiliary AdamW group for embeddings/heads), batch size 16, gradient accumulation 16, cosine schedule with 10000 iteration warmup, max LR 3e-4, min LR 1e-5, weight decay 1e-5, gradient clipping 1.0, NFD normalization, augmentation enabled, random sampling of bounding box and curve line prompts.

Evaluation

Testing Data, Factors & Metrics

Testing Data

The model was evaluated on held-out test splits drawn from the training data sources.

Metrics

Language CER
Ancient Greek 40.76%
Arabic 7.34%
Catalan 5.92%
Church Slavonic 7.30%
Corsican 7.48%
Czech 11.03%
Dutch 8.14%
English 7.63%
Finnish 38.16%
French 7.49%
Georgian 20.70%
German 9.10%
Hebrew 12.23%
Italian 2.81%
Latin 7.47%
Malayalam 39.53%
Middle Dutch 13.31%
Middle French 1.47%
Multilingual 6.27%
Norwegian 1.51%
Ottoman Turkish 6.77%
Persian 5.41%
Portuguese 7.53%
Russian 7.99%
Shorthand German 4.22%
Slovak 19.59%
Spanish 6.07%
Swedish 6.10%
Syriac 5.13%
Ukrainian 8.21%
Urdu 3.91%
Yiddish 1.79%
Aggregate (micro-average) 10.16%

Citation

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for small-models-for-glam/kraken-party-base

Finetuned
(1)
this model

Collection including small-models-for-glam/kraken-party-base