File size: 14,435 Bytes
36ae862 c8c116a 36ae862 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | ---
license: cc-by-4.0
datasets:
- CATMuS/medieval
- magistermilitum/Tridis
metrics:
- cer
- wer
pipeline_tag: image-to-text
tags:
- htr
- handwritten-text-recognition
- manuscripts
- medieval
- vision-language-model
- catmus
- qwen
---
# MEDUSA 0.2 — Medieval European Documents Unified System for Automated text recognition
MEDUSA is a family of Vision Language Models (VLMs) fine-tuned for **multilingual medieval handwritten text recognition (HTR)** at the **line level**.
These models were developed at the [École nationale des chartes – PSL](https://www.chartes.psl.eu/).
> **Note on versioning.** The `0.1` variants correspond to the models submitted to the ICDAR 2026 competition, trained exclusively on Gold and Platinum image–text pairs.
> The `0.2` variants add a prior Silver stage using 500,000 synthetic lines, improving coverage of under-resourced languages.
---
## System report
For full details on data, training procedure, and results, see the [accompanying system report](https://enc.hal.science/hal-05600991).
---
## Languages and scripts
MEDUSA was trained on a corpus of over **640k lines + 500k generated lines** spanning more than twenty repositories, covering the following language families and scripts:
- **Romance / Latin**: Old French (`fro`), Occitan (`pro`), Old Italian (`ita`), Old Spanish (`osp`), Catalan (`cat`), Old Portuguese (`opor`), Navarrese (`nav`), Latin (`lat`), Venetian (`vec`), Galician (`glg`)
- **Germanic**: Middle High German (`gmh`), Middle Low German (`gml`), Old Icelandic (`ice`), Middle English (`enm`), Middle Dutch (`dum`), Old English (`ang`), Old Norwegian (`non`), Swedish (`swe`)
- **Celtic**: Welsh (`wlm`), Old Irish (`gle`)
- **Slavic**: Old Czech (`cze`), Old Polish (`pol`)
Manuscripts dated roughly from the 9th to the 15th century.
---
## Training data and curriculum
MEDUSA 0.2 is trained in three successive stages:
### Stage 1 — Silver (synthetic)
The Silver stage uses **text-only historical corpora** to generate **500,000 synthetic line images**, providing lexical and script coverage for languages that are absent or scarce in the image–text tiers. Text is sampled from over 20 million words across medieval languages, rendered onto real manuscript background patches with stochastic ink, scan, and document degradation effects.
The synthetic lines are available as a separate dataset: [ENC-PSL/MEDUSA-synthetic-lines](https://huggingface.co/datasets/ENC-PSL/MEDUSA-synthetic-lines).
The underlying text-only corpora are listed below.
| Dataset | Language | Reference |
|---|---|---|
| Helsinki Corpus | Old English / Middle English | [[1]](#ref-helsinki) |
| Floris and Blancheflour | Old English | [[2]](#ref-floris) |
| Diakorp | Old Czech | [[3]](#ref-diakorp) |
| Hadewijch | Middle Dutch | [[4]](#ref-hadewijch) |
| CELT | Old Irish / Middle Irish | [[5]](#ref-celt) |
| Referenzkorpus Altdeutsch | Old High German | [[6]](#ref-altdeutsch) |
| Referenzkorpus Mittelhochdeutsch | Middle High German | [[7]](#ref-mhd) |
| Referenzkorpus Mittelniederdeutsch | Middle Low German | [[8]](#ref-mnd) |
| CTA | Old / Middle Portuguese | [[9]](#ref-cta) |
| CIPM | Old / Middle Portuguese | [[10]](#ref-cipm) |
| CODEA | Old Castilian | [[11]](#ref-codea) |
| OSTA | Old Castilian | [[12]](#ref-osta) |
| Biblia Medieval | Old Castilian | [[13]](#ref-biblia) |
| Milione | Venetian | [[14]](#ref-milione) |
| BFM | Old / Middle French | [[15]](#ref-bfm) |
| Chrétien de Troyes | Old / Middle French | [[16]](#ref-chretien) |
| Geste | Old / Middle French | [[17]](#ref-geste) |
| Otinel | Old / Middle French | [[18]](#ref-otinel) |
| Menota | Old Norse / Icelandic | [[19]](#ref-menota) |
| EAE | Old Norse / Icelandic | [[20]](#ref-eae) |
| Flores och Blanzeflor | Old Swedish | [[21]](#ref-flores) |
| Italian Paleography | Old Italian | [[22]](#ref-italpal) |
| CLTK Latin Library | Latin | [[23]](#ref-cltk) |
| Medieval Latin | Latin | [[24]](#ref-medlat) |
| Kochanowski | Old Polish | [[25]](#ref-kochanowski) |
### Stage 2 — Gold
MEDUSA was trained on a corpus of over 640,000 lines spanning more than twenty repositories, covering the following language families and scripts:
Romance / Latin: Old French (fro), Occitan (pro), Old Italian (ita), Old Spanish (osp), Catalan (cat), Old Portuguese (opor), Navarrese (nav), Latin (lat), Venetian (vec), Galician (glg)
Germanic: Middle High German (gmh), Middle Low German (gml), Old Icelandic (ice), Middle English (enm), Middle Dutch (dum), Old English (ang), Old Norwegian (non), Swedish (swe)
Celtic: Welsh (wlm), Old Irish (gle)
Slavic: Old Czech (cze), Old Polish (pol)
Mnuscripts dated roughly from the 9th to the 15th century.
Paired image–text data following heterogeneous transcription conventions, used for visual adaptation across manuscript styles and editorial traditions (~423,000 lines). See the [MEDUSA 0.1 model card](https://huggingface.co/ENC-PSL/Medusa0.1Line-9B) for the full dataset table.
### Stage 3 — Platinum
Image–text pairs aligned with the [CATMuS](https://catmus-guidelines.github.io/) diplomatic transcription guidelines, used for final specialization toward the target task (~222,000 lines). See the [MEDUSA 0.1 model card](https://huggingface.co/ENC-PSL/Medusa0.1Line-9B) for the full dataset table.
---
### Silver-stage references
<a id="ref-helsinki"></a>[1] *Helsinki Corpus TEI XML Edition* (2011). Designed by Alpo Honkapohja et al. Based on The Helsinki Corpus of English Texts (1991).
<a id="ref-floris"></a>[2] Draschner, M., Edlich-Muth, M. *Raw text edition of the Middle English 'Floris and Blancheflour' in Edinburgh, National Library of Scotland, MS Advocates 19.2.1* (Jan 2026). https://doi.org/10.5281/zenodo.18244892
<a id="ref-diakorp"></a>[3] Kučera, K., Řehořková, A., Stluka, M. *Diakorp v6: Diachronic Corpus of Czech*. LINDAT/CLARIAH-CZ (2015). http://hdl.handle.net/11234/1-5413
<a id="ref-hadewijch"></a>[4] Haverals, W., Kestemont, M. *From exemplar to copy: the scribal appropriation of a Hadewijch manuscript computationally explored*. JDMDH 23. https://doi.org/10.46298/jdmdh.10206
<a id="ref-celt"></a>[5] Ó Corráin, D. et al. *CELT: Corpus of Electronic Texts* (1997). http://www.ucc.ie/celt
<a id="ref-altdeutsch"></a>[6] Donhauser, K. et al. *Referenzkorpus Altdeutsch (750–1050)* (2022), version 1.2. https://www.deutschdiachrondigital.de/rea/
<a id="ref-mhd"></a>[7] Roussel, A. et al. *Referenzkorpus Mittelhochdeutsch (1050–1350)* (2024), version 2.1. https://www.linguistics.ruhr-uni-bochum.de/rem/
<a id="ref-mnd"></a>[8] ReN-Team. *Reference Corpus Middle Low German/Low Rhenish (1200–1650)* (2021), version 1.1. https://doi.org/10.25592/uhhfdm.9195
<a id="ref-cta"></a>[9] Sobral, C., Cardeira, E. *Corpus de Textos Antigos (CTA)*. http://teitok.clul.ul.pt/teitok/cta/
<a id="ref-cipm"></a>[10] Xavier, M.F. *O CIPM — Corpus Informatizado do Português Medieval*. In: Kabatek, J. (ed.), De Gruyter (2016). https://doi.org/10.1515/9783110462357-007
<a id="ref-codea"></a>[11] GITHE. *CODEA+ 2022. Corpus de documentos españoles anteriores a 1900* (2022). https://doi.org/10.37536/CODEA.2015
<a id="ref-osta"></a>[12] *Old Spanish Textual Archive (OSTA)* (2026). https://github.com/hispanicseminary/OSTA
<a id="ref-biblia"></a>[13] Enrique-Arias, A., Pueyo Mena, F.J. *Biblia Medieval* (2008). https://bibliamedieval.es
<a id="ref-milione"></a>[14] Burgio, E. et al. *Dei Viaggi di Messer Marco Polo [...]: Edizione digitale* (2015). https://risorse-esterne.edizionicafoscari.it/
<a id="ref-bfm"></a>[15] Guillot, C., Heiden, S., Lavrentiev, A. *Base de français médiéval*. Diachroniques 7, 168–184 (2018). https://shs.hal.science/halshs-01809581
<a id="ref-chretien"></a>[16] Kunstmann, P., Martineau, F. *Chrétien de Troyes sur le web* (2000). https://doi.org/10.16995/dscn.176
<a id="ref-geste"></a>[17] Camps, J.-B. et al. *Geste: un corpus de chansons de geste, 2016–...* (Apr 2019). https://doi.org/10.5281/zenodo.2630574
<a id="ref-otinel"></a>[18] Camps, J.-B. *La Chanson d'Otinel: édition complète du corpus manuscrit* (Dec 2017). https://doi.org/10.5281/zenodo.1116736
<a id="ref-menota"></a>[19] *Medieval Nordic Text Archive (Menota)*. https://clarino.uib.no/menota/home. Founded 2001, part of CLARIN since 2016.
<a id="ref-eae"></a>[20] The Arnamagnæan Institute, Copenhagen. *Editiones Arnamagnæanæ Electronicæ (EAE)*. https://eae.ku.dk/
<a id="ref-flores"></a>[21] Worrall, E., Edlich-Muth, M. *Raw text edition of the Old Swedish "Flores och Blanzeflor"* (Sep 2025). https://doi.org/10.5281/zenodo.17093371
<a id="ref-italpal"></a>[22] Magni, I., Markey, L., Signorini, M. *Italian Paleography* (2019). https://italian.newberry.t-pen.org/
<a id="ref-cltk"></a>[23] *Classical Language Toolkit (CLTK): lat_text_latin_library*. https://github.com/cltk/lat_text_latin_library. Texts in the public domain.
<a id="ref-medlat"></a>[24] Corbara, S. et al. *Two datasets for the computational authorship analysis of medieval Latin texts* (Jun 2020). https://doi.org/10.5281/zenodo.4298503
<a id="ref-kochanowski"></a>[25] Kochanowski, J. *Works of Jan Kochanowski*. Wikiźródła (Polish Wikisource). https://pl.wikisource.org/wiki/Autor:Jan_Kochanowski
---
## Intended use
These models are designed for **line-level HTR** on pre-segmented medieval manuscript images.
They are **not** page-level OCR systems: they expect a cropped image of a single text line as input and return the transcription of that line.
The models target **CATMuS transcription guidelines**, which govern abbreviation expansion, allograph normalisation, and the character set used.
---
## Usage with DocWorkflow
The recommended way to use MEDUSA is via **[DocWorkflow](https://github.com/Enceintes-Chartes/docworkflow)**,
the document analysis framework developed at the École nationale des chartes.
### Installation
```bash
git clone https://github.com/TheoMoins/DocWorkflow
cd docworkflow
pip install -e .
```
### Configuration file
```yaml
run_name: "Medusa0.2Line-9B"
output_dir: "results"
device: "cuda"
save_image: true
data:
test: "path/to/your/alto/data"
tasks:
htr:
type: VLMLineHTR
config:
use_metadata: true
model_name: 'outputs/Medusa0.2Line-9B'
device_map: "auto"
max_new_tokens: 128
line_batch_size: 8
max_pixels: 401408
prompt: >
Transcribe the handwritten text in this line image.
Keep abbreviations as written, do not expand them.
Modernize word segmentation (split or join words following modern usage).
Use only u and i, never v and j, regardless of the original or modern usage.
Do not record allographic variants, use standard letter forms.
Output ONLY the transcription.
```
### Running inference
```bash
docworkflow -c Medusa0.1Line-9B.yml predict -t htr -d test
```
## Direct usage with `transformers`
The models can also be used directly outside of DocWorkflow, though the CATMuS post-processing step will need to be applied manually if desired.
```python
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
model_id = "ENC-PSL/Medusa0.1Line-9B"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(model_id, device_map="auto")
image = Image.open("path/to/line_image.jpg").convert("RGB")
prompt = "Transcribe the handwritten text in this line image.\nOutput ONLY the transcription."
messages = [
{
"role": "user",
"content": [
{"type": "text", "text": prompt},
{"type": "image", "image": image},
],
}
]
inputs = processor.apply_chat_template(
[messages],
tokenize=True,
add_generation_prompt=True,
return_dict=True,
enable_thinking=False,
return_tensors="pt",
).to(model.device)
with torch.no_grad():
generated_ids = model.generate(**inputs, max_new_tokens=128, do_sample=False)
trimmed = generated_ids[0][inputs["input_ids"].shape[1]:]
transcription = processor.decode(trimmed, skip_special_tokens=True).strip()
print(transcription)
```
> **Important.** The model is optimised for the prompt given above. Results may degrade if the prompt is modified.
> The model outputs raw text; to enforce CATMuS compliance (character whitelist, allograph normalisation),
> apply the post-processing step provided in DocWorkflow (`src/tasks/htr/postprocessing.py`).
---
## CATMuS conventions
Transcriptions follow the [CATMuS guidelines](https://catmus-guidelines.github.io/).
---
## Citation
If you use MEDUSA in your research, please cite:
```bibtex
@unpublished{moins:hal-05600991,
TITLE = {{MEDUSA 0.1: Medieval European Documents Unified System for Automated text recognition System Report for the ICDAR 2026 Competition on Multilingual Medieval Handwritten Text Recognition}},
AUTHOR = {Moins, Th{\'e}o and Cafiero, Florian and Camps, Jean-Baptiste and Conte, Lilla and Guidi, Emilie and Hensley, Brenna and Kapitan, Katarzyna and Macedo, Carolina and Peratello, Paola and Vermaas, Cecile and Vidal-Gor{\`e}ne, Chahan},
URL = {https://enc.hal.science/hal-05600991},
NOTE = {working paper or preprint},
YEAR = {2026},
MONTH = Apr,
PDF = {https://enc.hal.science/hal-05600991v1/file/MEDUSA__MEDieval_Universal_Script_Analysis-6.pdf},
HAL_ID = {hal-05600991},
HAL_VERSION = {v3},
}
```
---
## Funding
Funded by the European Union (ERC, LostMA, 101117408). Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the
European Research Council. Neither the European Union nor the granting authority can be held responsible for them.
This work has received support under the Major Research Program of PSL Research University ``CultureLab'' launched by PSL Research University and implemented by ANR with the references ANR-10-IDEX-0001.
Ce travail a bénéficié d'une aide de l’État gérée par l'Agence Nationale de la Recherche au titre de France 2030 portant la référence « ANR-23-IACL-0008»).
Biblissima+ bénéficie d’une aide de l'Etat gérée par l'ANR au titre du Programme d’investissements d’avenir intégré à France 2030, portant la référence ANR-21-ESRE-0005.
This work was granted access to the HPC resources of IDRIS
under the allocation 2026-AD011015914R1 made by GENCI. |