# DocEng Short Paper

Cost-Aware Human-LLM Collaboration for Post-OCR Corrections in Swiss Historical Newspapers

# Overview & Executive Summary

<div class="callout info" id="bkmrk-paper%3A-doceng-short-">**Paper:** DocEng Short Paper - Cost-Aware Human-LLM Collaboration for Post-OCR Corrections  
**Authors:** Stergios Konstantinidis, Hayman Lotfy, Michalis Vlachos (University of Lausanne)  
**Venue:** ACM Symposium on Document Engineering (DocEng) - Short Paper  
**GitHub:** https://github.com/Stergios-Konstantinidis/Cost-Aware-Human-LLM-Collaboration-for-post-OCR-Corrections  
**Overleaf:** https://git.overleaf.com/6a2cb93de1bec86186ee8613 </div>---

## 1. Research Motivation &amp; Core Problem

Historical document archives, such as digitized centuries-old Swiss newspapers, suffer from substantial OCR degradation caused by aged paper, bleed-through, complex multi-column typography, and antique fonts.

While modern Large Language Models (LLMs) excel at OCR correction, naive **all-to-LLM pipelines** suffer from three severe pitfalls:

1. **Financial Cost:** Processing millions of archive pages with commercial LLM APIs is economically non-viable.
2. **Degradation of Clean Text:** LLMs frequently "hallucinate" or modernize archaic French spellings on segments that were already correctly transcribed by the OCR engine.
3. **Severe OCR Failures:** On heavily damaged regions, LLMs fabricate plausible-sounding text instead of preserving historical fidelity.

This paper formulates OCR post-correction as an **optimal budget allocation and routing problem** uniting human domain experts and LLMs.

---

## 2. Key Contributions

- **Three-Tier Human-LLM Collaboration:** Explicit routing of each segment to either \*(1) No Correction\*, \*(2) Automated LLM Correction\*, or \*(3) Human Review\*.
- **Regression-Guided Prioritization:** Learned Lasso/Ridge router predicting expected Character Error Rate (CER) reduction *\\hat{Δ}\_i* before sending tokens to an LLM.
- **Post-LLM Safeguard Layer:** Classification mechanism detecting when LLM correction introduced regression or hallucination, diverting compromised outputs to human reviewers.
- **Superior Budget Efficiency:** Achieves **14% relative CER reduction** over the All-LLM baseline with **&lt;5% human review budget**.

# Methodology & Architecture

## 1. System Architecture: Three-Tier Collaborative Routing

 Preserving digitized historical archives requires mitigating transcription degradation without incurring unsustainable computational inference costs or inducing catastrophic hallucination. Naive application of Large Language Models (LLMs) across entire archival collections results in prohibitive expenses, vocabulary modernization, and frequent regression of correctly transcribed rare historical entities.

 Our architecture introduces a **three-tier routing paradigm** that dynamically allocates each text segment to one of three optimal treatment paths based on learned degradation profiles and empirical confidence safeguards:

<div id="bkmrk-figure-1%3A-collaborat" style="text-align:center;"> [ ![Collaborative Human-LLM Post-OCR Correction Architecture](https://wiki.stergios.ch/uploads/images/gallery/2026-09/scaled-1680-/doceng-methodology-overview.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-methodology-overview.png "Click to view full-resolution architecture diagram") **Figure 1:** Collaborative Human-LLM Post-OCR Correction Architecture with Dynamic Confidence Routing and Post-Correction Safeguard Loop.

</div><div id="bkmrk-class-0%3A-bypass-rout"><div>#### Class 0: Bypass Route (Direct to Archive)

 Segments identified as already clean or high-confidence bypass LLM correction completely. Saves 100% token cost and eliminates any risk of stylistic hallucination or diacritic corruption.

 </div><div>#### Class 1: Automated LLM Correction

 Moderately degraded segments are dispatched to historical prompting pipelines (Gemini / GPT / Llama) with few-shot archival examples and strict orthographic grounding constraints.

 </div><div>#### Class 2: Priority Human Verification (&lt;5%)

 Severe segmentation failures, empty OCR blocks, or segments intercepted by the post-correction safeguard are routed to professional archivists under a strict &lt;5% human time budget.

 </div></div>---

## 2. Mathematical Formulation &amp; Quality Metrics

 Let *D* = {*d*<sub>1</sub>, …, *d*<sub>*n*</sub>} denote a digitized archival corpus. Each document segment *d*<sub>*i*</sub> possesses an original raw OCR transcription *d*<sub>*i*</sub><sup>raw</sup>, a candidate machine correction *d*<sub>*i*</sub><sup>corr</sup>, and a ground-truth transcription *d*<sub>*i*</sub><sup>human</sup>.

 We quantify correction quality via the **Character Error Rate (CER) reduction benefit** Δ<sub>*i*</sub>:

<div id="bkmrk-%CE%94i-%3D-cer%28diraw%2C-dihu" style="text-align:center;"> **Δ<sub>*i*</sub> = CER(*d*<sub>*i*</sub><sup>raw</sup>, *d*<sub>*i*</sub><sup>human</sup>) − CER(*d*<sub>*i*</sub><sup>corr</sup>, *d*<sub>*i*</sub><sup>human</sup>)**</div>- **Positive Benefit (Δ<sub>*i*</sub> &gt; 0):** The machine correction successfully lowered transcription noise and improved readability.
- **Negative Regression (Δ<sub>*i*</sub> &lt; 0):** The LLM degraded accuracy, hallucinated false cognates, or altered archaic syntax. The post-correction safeguard is designed to catch these regressions.

---

## 3. Feature Extraction &amp; LASSO Degradation Modeling

 Prior to invoking expensive generative models, the router extracts **54 lightweight features** capturing multi-faceted document degradation without requiring ground truth annotations:

<table id="bkmrk-feature-family-extra"> <thead> <tr> <th style="text-align:left;">Feature Family</th> <th style="text-align:left;">Extracted Indicators</th> <th style="text-align:left;">Routing Rationale</th> </tr> </thead> <tbody> <tr> <td>Confidence Metrics</td> <td>Mean token confidence, lowest quartile confidence, token variance</td> <td>Low confidence triggers LLM or human verification</td> </tr> <tr> <td>Lexical &amp; Orthographic</td> <td>Out-of-vocabulary ratio against 18th/19th c. Swiss French lexicons, symbol density</td> <td>Distinguishes historical spelling from OCR garbage characters</td> </tr> <tr> <td>Perplexity &amp; Language Model</td> <td>CamemBERT cross-entropy loss, token log-likelihoods</td> <td>Captures ungrammatical syntax disruptions caused by broken line breaks</td> </tr> <tr> <td>Typographic &amp; Layout</td> <td>Bounding box aspect ratio, average word length, uppercase-to-lowercase transitions</td> <td>Identifies broken column cuts and hyphenation splits</td> </tr> </tbody></table>

<div id="bkmrk-figure-2%3A-lasso-feat" style="text-align:center;"> [ ![LASSO Feature Selection Coefficients](https://wiki.stergios.ch/uploads/images/gallery/2026-09/scaled-1680-/doceng-lasso-feature-impact.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-lasso-feature-impact.png "Click to view full-resolution LASSO feature plot") **Figure 2:** LASSO Feature Selection Coefficients identifying the strongest predictive drivers of post-OCR correction benefit (Δ<sub>*i*</sub>).

</div>---

## 4. Safeguard Routing Curves &amp; Verification Budget

 A critical vulnerability in all-LLM correction pipelines is the *silent corruption* of historical names and rare dates. To eliminate this risk, our framework deploys a lightweight **Post-Correction Safeguard** classifier evaluated on the pair (*d*<sub>*i*</sub><sup>raw</sup>, *d*<sub>*i*</sub><sup>corr</sup>):

- Computes normalized Levenshtein distance, word count divergence, and proper noun preservation.
- If the safeguard predicts that the candidate correction introduced regressions (*CER*(*d*<sub>*i*</sub><sup>corr</sup>) &gt; *CER*(*d*<sub>*i*</sub><sup>raw</sup>)), the text is intercepted prior to writing to the database and escalated directly to human review.

<div id="bkmrk-figure-3%3A-empirical-" style="text-align:center;"> [ ![Empirical Safeguard Routing Curves](https://wiki.stergios.ch/uploads/images/gallery/2026-09/scaled-1680-/doceng-safeguard-routing.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-safeguard-routing.png "Click to view full-resolution safeguard routing plot") **Figure 3:** Empirical Safeguard Routing Boundaries balancing Character Error Rate reduction against the strict human verification budget (&lt;5%).

</div><div class="callout success" id="bkmrk-key-architectural-ta">#### Key Architectural Takeaways

- **Cost Reduction:** Bypassing 60%+ of clean segments cuts API inference expenditure by more than half.
- **Guaranteed Quality:** The dual-gate architecture (Router + Safeguard) prevents hallucinated modernizations from ever corrupting the archival repository.
- **Human Efficiency:** Prioritizing human review exclusively on high-uncertainty and safeguard-flagged segments maximizes archival accuracy per reviewer hour.
 
</div>

# Dataset & Benchmark Results

---

# Experimental Benchmark &amp; Evaluation

## 1. Archival Corpus

Evaluated across **609 text segments** spanning **45 digitized pages** from 9 Swiss French-language historical periodicals (Canton of Vaud, 1733–1945):

<table id="bkmrk-periodical-era-issue"> <thead> <tr> <th style="text-align:left;">Periodical</th> <th style="text-align:left;">Era</th> <th style="text-align:left;">Issues</th> <th style="text-align:left;">Pages</th> <th style="text-align:left;">Segments</th> <th style="text-align:left;">Characteristics</th> </tr> </thead> <tbody> <tr> <td>**La Revue**</td> <td>1875–1945</td> <td>4</td> <td>5</td> <td>139</td> <td>19th/20th century serif, multi-column</td> </tr> <tr> <td>**Feuille d'Avis**</td> <td>1762–1841</td> <td>4</td> <td>6</td> <td>118</td> <td>Antique typography, long 's' ligatures</td> </tr> <tr> <td>**Mercure Suisse**</td> <td>1733–1748</td> <td>3</td> <td>5</td> <td>92</td> <td>18th-century early modern French</td> </tr> <tr> <td>**Gazette de Lausanne**</td> <td>1804–1920</td> <td>5</td> <td>8</td> <td>145</td> <td>High density, complex layout</td> </tr> <tr> <td>**Others (Tribune, etc.)**</td> <td>1880–1930</td> <td>5</td> <td>21</td> <td>115</td> <td>Mixed commercial &amp; political press</td> </tr> </tbody></table>

---

## 2. Key Benchmark Results

### Error Rate Comparison (Tesseract OCR Base):

- **Raw OCR Baseline:** *CER = 6.30\\%*, *WER = 14.20\\%*
- **All-LLM Baseline (GPT-4o / Gemini 1.5 Flash):** *CER = 2.92\\%* (Cost: 100% token budget)
- **Selective Pre-Routing (Ours):** *CER = 3.12\\%* (Bypasses **40%** of all segments!)
- **Collaborative Safeguard (&lt;5% Human Budget):** ***CER = 2.49\\%*** (**14% relative reduction** over All-LLM)

### Comparison with Routing Baselines:

1. **Random Routing:** Weakest; frequently sends clean text and degrades it.
2. **OCR Confidence (Thresholding):** Underperforms because Tesseract confidence scores poorly correlate with semantic error in archaic fonts.
3. **ConfBERT:** Good detection but computationally heavy.
4. **Our Regression Router + Safeguard:** Consistently establishes the Pareto frontier across all budget limits.

---

## Experimental Evaluation &amp; Visual Benchmark Plots

### Historical Newspaper Segmentation Sample

<div id="bkmrk-figure%3A-doceng_segme" style="text-align:center;"><div style="text-align:center;">[![](https://wiki.stergios.ch/uploads/images/gallery/2026-09/scaled-1680-/doceng-segment-example.png)](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-segment-example.png "Click to view full-resolution image")</div>*Figure 1: Representative historical archival newspaper segment illustrating layout artifacts and OCR degradation.*

</div>### CER Reduction Across Correction Strategies

<div id="bkmrk-figure%3A-correction_s" style="text-align:center;"><div style="text-align:center;">[![](https://wiki.stergios.ch/uploads/images/gallery/2026-09/scaled-1680-/correction-strategies-comparison.png)](https://wiki.stergios.ch/uploads/images/gallery/2026-09/correction-strategies-comparison.png "Click to view full-resolution image")</div>*Figure 2: Character Error Rate (CER) reduction across baseline OCR, All-LLM, ConfBERT, and Collaborative Routing.*

</div>### OCR Engine Improvement Comparison

<div id="bkmrk-figure%3A-engine_impro" style="text-align:center;"><div style="text-align:center;">[![](https://wiki.stergios.ch/uploads/images/gallery/2026-09/scaled-1680-/engine-improvement-chart.png)](https://wiki.stergios.ch/uploads/images/gallery/2026-09/engine-improvement-chart.png "Click to view full-resolution image")</div>*Figure 3: Relative error reduction across historical OCR engines (Tesseract, Abbyy, and modern HTR).*

</div>### Strategy Performance Heatmap

<div id="bkmrk-figure%3A-engine_strat" style="text-align:center;"><div style="text-align:center;">[![](https://wiki.stergios.ch/uploads/images/gallery/2026-09/scaled-1680-/engine-strategy-heatmap.png)](https://wiki.stergios.ch/uploads/images/gallery/2026-09/engine-strategy-heatmap.png "Click to view full-resolution image")</div>*Figure 4: Comprehensive performance heatmap comparing LLM prompt strategies across historical periodicals.*

</div>

# Codebase & Reproduction Guide

---

# Codebase Structure &amp; Execution

## 1. Directory Overview

- `paper/`: LaTeX source files, TikZ diagrams (`overview_tikz.tex`), figures, and presentation slides.
- `code/plotting/`: Scripts generating progressive performance curves and slide assets (`generate_ppt_assets.py`).
- `code/evaluation/`: Metric computation (CER, WER, edit distance, cost modeling).
- `ppt assets/`: Rendered publication assets (PDF/PNG curves for baseline, random, ConfBERT, ours, safeguard, oracle).
- `DocEng presentation.pptx`: Official presentation slide deck.

## 2. Key Commands

```
# Clone the repository
git clone https://github.com/Stergios-Konstantinidis/Cost-Aware-Human-LLM-Collaboration-for-post-OCR-Corrections.git
cd Cost-Aware-Human-LLM-Collaboration-for-post-OCR-Corrections

# Generate publication and presentation assets
python3 code/plotting/generate_ppt_assets.py

# Overleaf synchronization (pull before modify, push after)
git pull origin main
git push origin main
```

# Presentation slides

<div id="bkmrk-%F0%9F%93%8A-doceng-2026-confer"><div>### 📊 DocEng 2026 Conference Presentation Deck

Official 10-slide presentation delivered at ACM DocEng 2026 (28.08.2026).

 </div><div> [ 📥 Download PDF ](https://wiki.stergios.ch/attachments/22) [ 📥 Download PPTX ](https://wiki.stergios.ch/attachments/23) </div></div>## Slide Deck &amp; Presentation Breakdown

<div id="bkmrk-slide-1%3A-title-%26-aut"><div>### Slide 1: Title &amp; Authors

 <span>Slide 01 / 10</span> </div><div style="text-align:center;"> [ ![Slide 1: Title & Authors](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-01.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-01.png "Click to inspect slide 1 in high resolution") </div> **Speaker Note:** Cost-Aware Human-LLM Collaboration for Post-OCR Corrections in Swiss Historical Newspapers (DocEng 2026, 28.08.2026). Presented by Stergios Konstantinidis, Hayman Lotfy, Prof. Michalis Vlachos.

</div><div id="bkmrk-slide-2%3A-motivation-"><div>### Slide 2: Motivation &amp; Archival Scale

 <span>Slide 02 / 10</span> </div><div style="text-align:center;"> [ ![Slide 2: Motivation & Archival Scale](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-02.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-02.png "Click to inspect slide 2 in high resolution") </div> **Speaker Note:** Building RAG systems for historical archives across 300+ years of newspapers, millions of pages, and 12 TB of raw high-resolution scan imagery.

</div><div id="bkmrk-slide-3%3A-why-documen"><div>### Slide 3: Why Document Cleaning is Not Straightforward

 <span>Slide 03 / 10</span> </div><div style="text-align:center;"> [ ![Slide 3: Why Document Cleaning is Not Straightforward](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-03.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-03.png "Click to inspect slide 3 in high resolution") </div> **Speaker Note:** Post-OCR correction is essential for downstream retrieval, but traditional tools neglect historical linguistic shifts and archaic orthography.

</div><div id="bkmrk-slide-4%3A-heterogeneo"><div>### Slide 4: Heterogeneous Segment Utility

 <span>Slide 04 / 10</span> </div><div style="text-align:center;"> [ ![Slide 4: Heterogeneous Segment Utility](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-04.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-04.png "Click to inspect slide 4 in high resolution") </div> **Speaker Note:** Different segments benefit very differently: Segment D gains +2.0% CER improvement with zero overcorrections, while Segment B suffers -3.0% CER degradation due to 10 overcorrections!

</div><div id="bkmrk-slide-5%3A-optimal-cor"><div>### Slide 5: Optimal Correction Prioritization

 <span>Slide 05 / 10</span> </div><div style="text-align:center;"> [ ![Slide 5: Optimal Correction Prioritization](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-05.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-05.png "Click to inspect slide 5 in high resolution") </div> **Speaker Note:** Theoretical premise: What if we knew in advance which archival documents would benefit most from LLM correction?

</div><div id="bkmrk-slide-6%3A-the-real-wo"><div>### Slide 6: The Real-World Dilemma

 <span>Slide 06 / 10</span> </div><div style="text-align:center;"> [ ![Slide 6: The Real-World Dilemma](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-06.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-06.png "Click to inspect slide 6 in high resolution") </div> **Speaker Note:** In reality, ground truth is unavailable. Naively correcting all documents produces unpredictable degradation and wastes massive token budgets.

</div><div id="bkmrk-slide-7%3A-our-contrib"><div>### Slide 7: Our Contribution - Intelligent Routing Architecture

 <span>Slide 07 / 10</span> </div><div style="text-align:center;"> [ ![Slide 7: Our Contribution - Intelligent Routing Architecture](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-07.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-07.png "Click to inspect slide 7 in high resolution") </div> **Speaker Note:** A machine-learned Router evaluating expected CER benefit: If LLM is sufficient -&gt; route to LLM; if degradation is too severe -&gt; route to human review (&lt;5%); otherwise leave the segment untouched.

</div><div id="bkmrk-slide-8%3A-experimenta"><div>### Slide 8: Experimental Evaluation &amp; Benchmark Curves

 <span>Slide 08 / 10</span> </div><div style="text-align:center;"> [ ![Slide 8: Experimental Evaluation & Benchmark Curves](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-08.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-08.png "Click to inspect slide 8 in high resolution") </div> **Speaker Note:** Empirical results comparing baseline OCR, All-LLM, ConfBERT, and our Cost-Aware Routing framework across historical Swiss periodicals.

</div><div id="bkmrk-slide-9%3A-key-takeawa"><div>### Slide 9: Key Takeaways &amp; Research Streams

 <span>Slide 09 / 10</span> </div><div style="text-align:center;"> [ ![Slide 9: Key Takeaways & Research Streams](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-09.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-09.png "Click to inspect slide 9 in high resolution") </div> **Speaker Note:** Key contributions: 40% reduction in correction effort, negligible setup cost, and an effective human guardrail identifying segments requiring expert archivist attention.

</div><div id="bkmrk-slide-10%3A-conclusion"><div>### Slide 10: Conclusion &amp; Contact

 <span>Slide 10 / 10</span> </div><div style="text-align:center;"> [ ![Slide 10: Conclusion & Contact](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-10.png) ](https://wiki.stergios.ch/uploads/images/gallery/2026-09/doceng-slide-10.png "Click to inspect slide 10 in high resolution") </div> **Speaker Note:** Wrap-up, open questions, and research collaboration contact information at UNIL-DESI.

</div>