Skip to content
← Blog

Inside ATHAAR: Why Medieval Arabic Science Challenges Vision Models

Based on: ATHAAR: A Medieval Scientific Arabic Manuscript Dataset for Handwritten Text Recognition — Ismail El Jamiy, Khadija Msalek, Guillaume Loizelet, Farah Benamara, Nabil Hathout

During a test run on an Arabic scientific manuscript, an extended scribal stroke in a line of 11 characters led Gemini 3 Flash to generate 4,037 characters.

The input was an isolated line crop, and the model was asked to transcribe the text. That single runaway output raised the system’s character error rate in the cross-chapter evaluation from 18.9% to 74.3%.

The stroke was tatweel: a horizontal elongation used in Arabic writing. The paper does not establish exactly why the model’s generation ran away, but the example shows how one feature of a manuscript can have an outsized effect on an evaluation.

That failure captures a central challenge of historical document recognition. Medieval scientific manuscripts combine cursive ligatures, variable diacritization and numerical notation with a shortage of training data. A research team from the Université de Toulouse (IRIT, IMT, and CLLE) set out to study these challenges systematically. Their paper introduces ATHAAR, a manually annotated, multi-witness dataset for handwritten text recognition (HTR) of medieval Arabic scientific manuscripts.

The findings are sobering for anyone assuming that current vision-language models have solved this kind of document recognition.

medieval arabic scientific manuscript

The Three Million Volume Black Box

Arabic manuscript collections are estimated to contain more than three million volumes. They represent an extensive written tradition spanning subjects including science, philosophy and literature. Digitization can produce images of these manuscripts, but their textual content often remains inaccessible to indexing and computational analysis.

Handwritten text recognition has progressed in languages including Latin, Old French and Classical Chinese. Arabic HTR has lagged in part because of a lack of training data. The researchers identify several kinds of existing resources:

  1. Modern handwriting collections such as KHATT, produced by volunteers.
  2. Historical corpora drawn from literature, religious texts and other sources, including Muharaf, Agapet and Historical Arabic HTR.

Scientific manuscripts add requirements that existing resources do not always document:

  • Numerical content: Astronomical and mathematical texts contain numerical strings alongside prose. Manuscript pages can also include tables and diagrams.
  • Overlined entities: Numerical values and labels for geometric objects can carry horizontal overlines, requiring explicit transcription rules.
  • Paleographic distance: The manuscripts contain complex ligatures, elongated strokes and varied numeral forms that differ from modern printed Arabic.
  • Undocumented ground truth: The datasets surveyed rarely document annotation conventions, and none reports inter-annotator agreement, according to the authors.

When ground truth lacks documented standards, machine error scores become harder to interpret and compare. A disagreement between a model and a reference transcription may involve an ambiguous letterform or a damaged passage as well as a recognition error. Inter-annotator measurements provide one reference point for understanding those uncertainties.

Borrowing Textual Criticism to Structure a Dataset

The Toulouse team built ATHAAR around the methodology of textual criticism. In historical text editing, textual criticism compares surviving sources, or witnesses, of a text to study differences in wording, spelling and form.

Manuscript copies can diverge because scribes introduced errors, omissions or deliberate changes. In ATHAAR, a witness means a copy of one chapter in one manuscript, so a single manuscript can provide more than one witness.

The researchers anchored their dataset on a work of Islamic Golden Age astronomy: al-Qanun al-Mas'udi, composed around 1035 CE by al-Biruni. Specifically, they centered their core data on Chapter X.6, which concerns celestial distances and volumes and draws on Greek, Sanskrit and Arabic sources. Guillaume Loizelet’s 2021 critical edition supplied a reference reading against which transcribed lines were aligned. The resulting dataset comprises 24 manuscripts, 32 witnesses, 169 pages, 3,893 transcribed lines and 250,480 non-space characters.

To reduce the risk of training-data contamination, the team prioritized manuscript witnesses that were not publicly accessible online. Four of the Qanun manuscripts were available online; the remaining copies were acquired from holding libraries during preparation of a critical edition. The paper does not establish whether the models encountered any of these materials during training.

The corpus is organized into three tiers designed to test transfer:

  • Tier 1 (Same Chapter, Different Scribes): 13 witnesses of Chapter X.6 from 13 manuscripts copied between the 11th and 19th centuries. The witnesses contain nearly the same text, with variants, but the handwriting spans Naskh and Nasta'liq. This tier contains 87 pages and 2,165 lines.
  • Tier 2 (Same Treatise, Different Chapters): 10 witnesses covering other chapters of the Qanun, drawn from 10 manuscripts, eight of which also appear in Tier 1. For those eight, the experiments can hold the manuscript fixed while changing the chapter. This tier adds 32 pages and 804 lines.
  • Tier 3 (Different Treatises): 9 witnesses of other scientific treatises held by the BnF and accessed through Gallica. They include works associated with Ibn Sina, al-Farghani, Ibn al-Haytham, al-Tusi, al-Jaghmini, Abu al-Wafa, al-Biruni and al-Sijzi. One manuscript is written in Maghrebi, a script prevalent in North Africa and al-Andalus. This tier accounts for 50 pages and 924 lines.

This tiered setup creates an evaluation matrix. The researchers test across scripts using witnesses of the same chapter, across chapters using the same manuscript, and across treatises using examples from the Qanun. These comparisons probe different kinds of transfer, though individual hands, manuscript condition and textual variation can still affect the results.

Diplomatic Transcription and Human Agreement

Building reliable training data from historical manuscripts requires clear transcription protocols. The researchers adopted diplomatic transcription: annotators reproduce what the scribe wrote without modernizing the spelling, correcting the text or interpreting its content.

Using Calfa Vision, a web platform for assisted transcription, two native Arabic-speaking authors with expertise in medieval Arabic manuscripts transcribed the material under the supervision of an Arabic philology expert. They corrected automatically detected text regions and line baselines, checked the resulting polygons, and exported the transcriptions in PAGE-XML. Their rulebook set standards for non-prose elements:

  • Margin splits: When a word begun in the main text continued into the margin, annotators extended the line polygon to include the fragment and joined the pieces into one word.
  • Vocalization (Tashkil): Diacritics and vowel signs were transcribed only where the scribe wrote them. Diacritic marks represent 4.19% of non-space characters in ATHAAR. Four manuscripts contain 83% of the marks, while 13 witnesses have rates below 0.3%.
  • Overlined labels: Overlined elements denoting geometric objects received the tag [geometrical_object].
  • Numerals: The texts contain 688 numeral strings and 2,618 transcribed digits. Legible digits were transcribed directly. Numbers that could not be read were given system tags such as [indian_numbers], [abjad_numbers] or [unknown_numbers].
  • Damage tags: Illegible segments were tagged as [unreadable] or [unreadable_line]. In the Qanun portion, 30 of 2,969 lines carried an [unreadable] tag. The authors note that tag counts provide only a lower bound on damage, because legible text was transcribed even when its page was damaged.

To assess agreement, both annotators independently transcribed 127 lines from four witnesses. Their pooled results were:

  • Character Error Rate (CER): 2.6%
  • Word Error Rate (WER): 11.7%

These figures measure disagreement between the two transcriptions on the selected pages. They are a reference point for the corpus, not a universal human error floor or a direct measure of model parity.

The agreement numbers also show that a shared script label does not guarantee similar reading difficulty. On Ms01, written in Naskh, annotator CER was 1.6%. On Ms13, also written in Naskh, it was 4.5%, with a 20.5% WER. Ms02, written in Nasta'liq, had a 2.4% CER. Individual scribal habits and page condition matter alongside the broad calligraphic category.

historical calligraphy reed pen vellum

The Benchmark Showdown: Generalists vs Specialists

The authors report results for three vision-language models across three transfer tasks:

  1. Gemini 3 Flash: A general-purpose multimodal model from Google DeepMind.
  2. CHURRO-3B: An open-weights vision-language model based on Qwen2.5-VL-3B-Instruct and fine-tuned for historical document transcription in 46 languages. Its Arabic training data includes 2,367 pages from existing datasets.
  3. Qari-OCR-2B: A model fine-tuned from Qwen-2-VL-2B for Arabic text recognition using a synthetic pipeline that renders modern news and classical Islamic texts in twelve Arabic fonts.

Models received line crops extracted using PAGE-XML polygon coordinates. They were prompted in English and tested in both zero-shot ($k=0$) and few-shot ($k=3$) conditions. A preliminary Gemini ablation tested between one and ten examples; no setting outperformed the others by more than the trial-to-trial standard deviation, so the researchers selected $k=3$. Lines were split into support and query portions, and support and query lines came from different witnesses.

The results showed a large performance gap among the three evaluated models:

Experiment Setting Gemini 3 Flash CER Gemini 3 Flash WER CHURRO-3B CER CHURRO-3B WER Qari-OCR-2B CER Qari-OCR-2B WER
Cross-Script (Naskh queries) Zero-shot ($k=0$) 17.2% 62.1% 76.5% 124.5% 88.6% 135.5%
Few-shot ($k=3$) 16.3% 62.3% 70.0% 115.6% 154.5% 198.9%
Cross-Script (Nasta'liq queries) Zero-shot ($k=0$) 20.0% 55.4% 87.3% 143.4% 93.9% 157.6%
Few-shot ($k=3$) 18.5% 53.8% 79.9% 134.9% 158.6% 219.5%
Cross-Chapter (Same Manuscript) Zero-shot ($k=0$) 18.9% 61.8% 75.3% 127.5% 78.7% 127.7%
Few-shot ($k=3$) 18.9% 63.2% 59.3% 109.2% 163.1% 194.0%
Cross-Treatise (Other Works) Zero-shot ($k=0$) 21.7% 64.3% 120.3% 153.8% 100.7% 164.9%
Few-shot ($k=3$) 20.4% 61.1% 63.9% 112.5% 252.9% 260.8%

(Note: Levenshtein-based error rates can exceed 100% when insertions add enough errors relative to the length of the reference.)

Gemini 3 Flash had the lowest error rates in every reported setting, with CER between 16.3% and 21.7%. Its cross-treatise CER was higher than its cross-script CER, but the gap was modest: roughly 2 to 4 percentage points. Its word error rates remained above 50% in every reported setting.

CHURRO-3B’s CER ranged from 59.3% to 120.3%. Three examples improved its CER in each reported transfer setting, but its WER remained above 100% throughout. The results show substantial difficulty producing accurate transcriptions on this corpus despite the model’s historical-document specialization.

Qari-OCR-2B displayed a different pattern. At $k=0$, its CER ranged from 78.7% to 100.7%. With three examples, it worsened to between 154.5% and 252.9%, reaching the latter figure on cross-treatise queries. The authors suggest that the few-shot setup destabilized generation; the reported aggregate scores do not by themselves establish exactly how each output failed.

The benchmark also highlighted a paleographic asymmetry. In cross-script tests, Gemini’s CER was lower on Naskh queries (16.3% to 17.2%) than on Nasta'liq queries (18.5% to 20.0%). Word error rates went the other way: 53.8% to 55.4% on Nasta'liq compared with 62.1% to 62.3% on Naskh. Because the two metrics point in opposite directions, the results do not establish either script as uniformly harder.

Why it matters for document engineering

For teams evaluating OCR on complex records, ATHAAR offers several practical lessons:

1. Test synthetic training against real manuscripts

Qari-OCR was fine-tuned using synthetic text rendered in twelve fonts, yet struggled on the real manuscripts in ATHAAR. The experiment does not isolate synthetic training as the cause, but it shows why performance on rendered text alone cannot establish performance on historical handwriting.

2. Inspect outputs as well as aggregate scores

Error rates above 100% deserve a closer look at insertions and output length. The authors describe runaway generation as a problem in their experiments and interpret the specialized models’ high scores as failures to produce bounded transcriptions. Examining individual outputs can reveal problems that an aggregate score alone cannot explain.

3. State the normalization protocol

The paper’s tatweel example is a warning for evaluation. The researchers removed elongation as part of their evaluation preprocessing and report that one runaway output could raise cross-chapter CER from 18.9% to 74.3%. Normalization choices and outlier handling need to be stated when results are compared.

4. Test general-purpose and specialized models on the target material

Gemini 3 Flash outperformed the two specialized models in every setting reported here, but its error rates were still substantial. The comparison covers these three models and this corpus; it does not establish that general-purpose models always outperform specialized systems or explain which architectural or training differences caused the gap.

Honest Limitations and The Road Forward

ATHAAR’s scope has boundaries. The authors note several constraints, and the experimental setup adds context for interpreting the results:

  • Limited coverage: The corpus covers a limited set of authors and scientific treatises. The manuscripts span the 11th to 19th centuries, but broader claims about other authors, disciplines and manuscript traditions require further sampling.
  • No fine-tuning experiments: The authors evaluated zero-shot and few-shot in-context transfer. They did not fine-tune models on ATHAAR, leaving open how well open-weights models might perform after training on the corpus.
  • Cropped line inputs: Evaluations used line crops extracted from human-checked PAGE-XML polygons. The results therefore do not measure an end-to-end system’s ability to find and segment text on complex pages.
  • Limited prompting study: The researchers tested several numbers of examples for Gemini, but leave a deeper study of prompting strategies, including heuristic exemplar selection, for future work.

ATHAAR provides a structured foundation for studying a difficult part of the historical Arabic record. By aligning witnesses of the same text and reporting human agreement alongside model results, the dataset gives researchers a way to investigate where transcription systems struggle and how those struggles vary across manuscripts.

For developers working on complex document extraction, the takeaway is clear: test models on the material they are expected to read, inspect unusual outputs, and document the transcription and scoring rules behind every reported error rate.