arXiv(opens in a new tab)cs.CVAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2608.25140

RefLAM: A Reference-Grounded Line Annotation Pipeline for Historical Arabic Manuscripts

Mohamed Guechaoui, Mohamed Diaa Zellagui, Souleyman Chaib, Sahraoui Dhelim

Abstract

Existing approaches to building line-level Arabic handwritten-text-recognition (HTR) training data either rely on fully manual annotation, which does not scale, or on automatic OCR-to-reference alignment methods that have not been extended to multi-script, two-zone (main-plus-margin) historical manuscript layouts with a provable correctness guarantee. We present RefLAM (Reference-grounded Line Annotation for Manuscripts), a pipeline that converts manuscript page images and pre-existing clean transcriptions into validated, line-level ground truth without sacrificing human oversight. RefLAM couples a deep-learning page-segmentation model with a multimodal large language model (MLLM) for structured OCR and a diacritic-agnostic fuzzy alignment engine that grounds each OCR line in a contiguous span of the reference text, assigning a character-level confidence score in [0, 100]. RefLAM's efficiency rests on a simple guarantee: under our alignment metric, a perfect score is provably equivalent to character-for-character identity of the normalised strings (the Confidence-100 rule), and a manual audit of every perfect-scoring line in the released corpus found no counterexample. Because a reviewer can trust a perfect score, most lines are confirmed at a glance rather than retyped, and annotation turns from a uniformly slow process into a triaged one in which human attention concentrates where the alignment is uncertain. Across 7 fully page-validated books we measured a 75×75\times throughput gain over manual annotation (3,000 vs. 40 lines/hr); applying the same guarantee to a further 7 books, we retained 16,533 confidence-100 main-text lines for release within one week, while sub-100 lines from those books were excluded from this release rather than manually corrected (section 6). Using RefLAM, we construct and release AraMS-28k, comprising 14 historical Arabic manuscript books, 3,043 pages, and 27,971 main-text and 629 margin-line annotations with bounding boxes, layout labels, and insertion anchors for 191 of the margin entries (30.4%). Finally, we finetune Muharaf-pretrained baselines (including HATFormer) on AraMS-28k and report character error rate (CER) results, confirming the corpus's practical utility for downstream HTR training.

1 Introduction

The Arab-Islamic manuscript tradition spans more than a millennium and covers medicine, astronomy, mathematics, philosophy, and jurisprudence. A large fraction of this corpus has never been rendered machine-readable. Photographic digitisation is largely solved; the unsolved problem is transcription at scale. Handwritten-text recognition (HTR) models are data-hungry, yet line-level labelled corpora for Arabic manuscripts remain scarce. Producing line-level OCR training data conventionally requires three expensive manual stages: page segmentation, transcription, and quality verification. For historical Arabic manuscripts, four well-documented difficulties compound this cost: high script variability (Naskh, Ruq'ah, Thuluth, Maghrebi), degraded scan quality, non-linear two-zone reading order (main body plus margins), and diacritisation inconsistency. We measured the cumulative manual annotation rate directly: a trained annotator completes roughly 40 lines per hour, including line detection, transcription, and bounding-box drawing — a rate at which a single 600-page volume consumes the better part of a year. We address this bottleneck with RefLAM, which exploits two resources that, for many classical Arabic texts, already exist independently of manuscript images: (1) a vision-capable MLLM that produces structured, layout-tagged OCR from a single zero-shot call; and (2) a clean ground-truth transcription—typically a fully diacritised scholarly edition. Neither resource alone solves the problem: MLLM output is fluent but unreliable; the reference text is reliable but not localised to any page image. RefLAM fuses them via diacritic-agnostic fuzzy alignment, attaching a confidence score to every line and triaging human review accordingly. RefLAM is best read as an instance of weak (distant) supervision [1]: a noisy labelling source (MLLM OCR) is reconciled against a reliable but unlocalised one (the reference transcription) until the labels are both accurate and grounded in the page; section 2 places the pipeline in that literature. The alignment stage has one property we lean on throughout: a maximal similarity score is not a heuristic signal but a provable guarantee of character-for-character normalised-string identity (proposition 1). We noticed the pattern before we proved it — during page-level review of the earliest books, no perfect-scoring line was ever found to be wrong — and the proof then explained the observation. This confidence-100 rule is what makes the fast review path safe; it is an enabling property of the alignment stage, not a contribution that competes with the pipeline itself. Although we instantiate and validate RefLAM on Arabic manuscripts, the pipeline places no Arabic-specific requirement beyond the normalisation operator of definition 1; in principle it should transfer to any historical script for which clean digital transcriptions exist.

References (19)