An agentic GraphRAG that turns a question into a graph query — then survives the noise of handwritten-text recognition by expanding fragile literals through word spotting.
Archives need accountability — a guarantee that a fact is present or absent. LLMs give flexibility but invent. Knowledge graphs give grounding but assume clean text. Historical handwriting gives neither.
A plain RAG retrieves plausible passages and lets a generative model phrase an answer — convenient, but prone to hallucination and blind to anything outside its retrieved window. A knowledge graph is the opposite: every entity and relation is explicit and queryable. The catch is construction: when the graph is built from handwritten documents, recognition errors aren't rare glitches — they are a consistent characteristic of the data, splitting one entity into many misspelled ghosts and producing endless false negatives.
{name: 'girona'} misses gerona · gran · hieronma — the same place, recognised three wrong ways.The paper's answer is a semi-symbolic agent: keep the LLM's generalization for turning questions into queries, but ground execution in a graph — and, at runtime, relax the brittle string literals (names, places) into the set of variants word spotting actually found on the page.
Walk the running example: a natural-language request becomes a Cypher query whose fragile literals are marked, expanded with their word-spotting variants, then executed on the graph. Step through it — the graph on the right responds.
The query is grounded in the graph's ontology, translated to Cypher, validated and repaired in a correction cycle, expanded by word spotting, executed, and only then phrased into an answer. Click any node; press run to watch it flow.
Two ways to model the same Esposalles marriage record. The property graph is compact; the RDF version explodes names, surnames, and occupations into their own nodes — more nodes, but far more expressive for complex, multi-hop queries. Toggle between them.
The results bear this out: RDF wins 7 of 9 word-spotting comparisons. The extra structure isn't a burden — names become first-class, independently queryable nodes, which is exactly what multi-hop and relational questions need.
When the LLM marks a literal for approximate matching, word spotting returns its variants and the query is rewritten as a case-insensitive regex over the disjunction: l ↦ regex(v₁ ∨ … ∨ vₖ). Type a name or place and watch it expand.
girona, sabadell, carpenter, colomer — or any word, and orthographic OCR variants are generated for it.This is the noise filter at query time. Exact matching for girona returns 5 individuals; PHOC expansion to (girona|gerona|gran|hieronma) recovers all 9 — the difference between a confidently wrong count and the right one.
A new evaluation set of 100 hand-curated questions, scored by both a deterministic entity metric (NERO-ANLS) and an LLM judge. RAG hits a ceiling; GraphRAG soars with transcription quality; word spotting helps everywhere — most of all the small models.
Performance vs. HTR accuracy (approx. of Fig. 4b). RAG stays flat — resilient but capped. GraphRAG rises steeply and word-spotting variants (PHOC, MPNet) shift the whole curve up, especially at low legibility.
What the 100 questions ask — designed to stress structured reasoning, not just lookup.
Table 2 — back-end LLM matters, to a point. Bold = best per metric.
| System | Qwen3-VL (32B) | GPT-5.1 | Phi-4 (15B) |
|---|---|---|---|
| NERO-ANLS | |||
| RAG · GT transcription | .435 | .469 | .418 |
| GraphRAG · RDF-GT | .813 | .865 | .638 |
| + PHOC · RDF-GT | .876 | .817 | .646 |
| + MPNet · RDF-HTR1 (noisy) | .690 | .673 | .671 |
Code inference scales from Phi-4 → Qwen3, then plateaus: Qwen3 ≈ GPT-5.1 beyond ~32B. Word spotting's biggest lift is for the smallest model (Phi-4: .53 → .631 on noisy HTR1).
Qualitative — why it matters.
"girona" misses variant spellings.(?i)^(girona|gerona|gran|hieronma)$ captures all mis-transcriptions.A new 100-question Esposalles-DocVQA benchmark, a recall-oriented NERO-ANLS metric, and a runtime expansion operator: agentic graph workflows look like a promising, accountable direction for reading the archive.