Manuscript Offprint

arXiv:2608.28170

Text Restoration of Ancient Documents with Language Models

Shibingfeng Zhang, Edoardo Caraffa, Annafelicia Zuffrano, Maddalena Modesti, Giovanni Colavizza

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Purpose - This study investigates the feasibility of restoring missing text caused by physical lacunae in damaged ancient manuscripts using language models.

Methodology - The study proposes different scenarios to replicate real-world conditions. Language models of different architectures are applied according to their suitability to each scenario. We also propose several decoding strategies that further enhance performance and address the discrepancy between lacuna boundaries and the models' tokenization schemes.

Findings - The results reveal that text restoration of these documents cannot be fully automated, but it can serve as a useful tool to assist paleographers in their work. Model performance varies greatly depending on which structural part of the document needs to be restored and whether the character length of missing text is available.

Originality - This is the first study and to analyze model performance on formulaic and non-formulaic content and the impact of lacuna length awareness in manuscript restoration. Both are recurring challenges in paleographers' manual restoration work. Through systematic comparison and both qualitative and quantitative analysis of different models' performance under varying settings, this study offers a guideline for developing assistive tools to support paleographers.

Keywords: Text restoration; Latin manuscripts; Palaeography; Diplomatics; Large Language Models; Natural Language Processing; Digital Humanities

1 Introduction

Ancient written texts constitute a fundamental part of our cultural heritage, providing essential evidence for the reconstruction of past societies, institutions, and intellectual traditions. Preserved across a wide range of documentary and textual traditions, including manuscripts, archival records, inscriptions, and epigraphic sources, these materials are often incomplete or damaged due to the long-time conservation. Missing text is therefore a pervasive problem in the study of historical written sources, arising from physical deterioration, lacunae, illegible passages, or the loss of portions of the original document. The reconstruction of such missing passages is consequently a central challenge for scholars working with historical texts, requiring them to combine linguistic, textual, material, and contextual evidence. Recent advances in computational methods and artificial intelligence have opened new possibilities for addressing this challenge (Assael et al., 2019; Lazar et al., 2021; T. Shen et al., 2020), with many applications focusing on text restoration of epigraphy. Automated approaches to text restoration can potentially assist scholars in reconstructing lacunae across large and heterogeneous corpora, overcoming some of the limitations imposed by the traditionally time-consuming and highly specialized nature of this task. Yet the variety of historical languages, textual genres, documentary forms, and writing practices makes it difficult to develop universally applicable restoration methods (Sommerschild et al., 2023). Effective approaches must therefore account not only for linguistic and textual regularities, but also for the specific characteristics of the sources to which they are applied. This calls for robust restoration pipelines that keep the scholars in the loop, using automated methods to propose and rank candidate reconstructions that domain experts can then evaluate, refine, or reject. This positions computational text restoration not as a standalone technology, but as a tool developed in close collaboration with the disciplines, such as diplomatics and palaeography, that have long specialized in exactly this kind of reconstructive work.

In this respect, the rapid development of natural language processing in recent years is especially relevant. Several studies have attempted to create language models capable of handling text in historical languages such as Latin (Bamman and Burns, 2020), ancient Greek (Riemenschneider and Frank, 2023), Old Italian (Aprosio et al., 2022), and ancient Chinese (D. Wang et al., 2023). This growing research landscape allows us to investigate the feasibility of employing language models to reconstruct textual gaps in the context of historical manuscript, to facilitate the work of paleographers. Such methods aim to enhance its effectiveness by helping to formulate restoration hypotheses for incomplete sections.

For this purpose, we use a dataset consisting of around 1,200 notarial documents produced during the Late Middle Ages in Bologna (Modesti, 2012). As these documents have never been publicly available, they are guaranteed to be unseen by any existing language model, ensuring a fair comparison. The Bolognese notarial tradition represents a privileged point of observation for analyzing the development of documentary practices and the relationship between documentary form, legal function, and social context (Fasoli, 1977; Tamba, 1998a). Their structure also enables a systematic comparison between restoration performance on formulaic versus non-formulaic content, which is a distinction applicable to many other ancient text traditions, making this work highly transferable. For instance, the same methodological distinction is used in fields such as epigraphy, where densely packed, highly standardized abbreviations coexist with unique context-specific nouns and functions (Assael et al., 2019; Soffiantini, 2024). Similarly, within medieval manuscript studies, liturgical texts rely heavily on fixed, highly formulaic structures designed for oral repetition and memorization, contrasting sharply with their unique narrative or marginal annotations (Deshusses and Darragon, 1982).

Various language models, ranging from smaller-scale encoder-based models to large-scale general-purpose LLMs, are investigated under different settings according to their suitability as determined by model architecture.

The objectives of this study are:

  1. To investigate the feasibility of using language models to reconstruct missing or illegible content in ancient texts, and to determine the extent to which reliable restoration can be achieved.

  2. To compare and evaluate the performance of different language model architectures and sizes across multiple experimental settings, in order to identify best practices for text restoration of different scenarios.

The contributions of this work are as follows:

  1. We propose and compare several strategies for reconciling character-level lacuna lengths with the token-level units used by language models, including scenarios where the expected output length is unknown.

  2. Systematic experiments and analysis are conducted across models and text categories, offering insights that can inform future work on text restoration in similarly under-resourced or historically specialized domains.

  3. A set of practical fine-tuned language models is provided to support paleographers and diplomats in their text restoration work.

References (40)