Comparative table of five scripts from Agrippa's Occult Philosophy, 1531

The Confident Hallucinator

What we learned evaluating AI OCR across five scripts and three model tiers

23–24 April 2026 · 18 min read

We built a quality evaluation framework for our OCR and translation pipeline, then ran it across five script families and three Gemini model tiers: Flash, Flash Lite, and Pro. The central finding is that consistency alone is a dangerous quality signal — a model can be perfectly consistent and completely wrong. The follow-up finding is that thinking mode fixes what model size cannot.

Part I

Framework & Flash vs. Lite

1. The Framework

We measure five things, three of which require no ground truth:

Established metrics (from the literature):

  • CER (Character Error Rate) and BLEU-4/ROUGE-L — standard OCR and translation benchmarks. We implement them but can’t use them at scale because we don’t have proofread reference texts for most of our 17,000+ books.

What we’re measuring that’s new:

  • Modal Consistency Rate (MCR): Run the same page through a model N times at temperature=0. MCR = fraction of runs producing the majority output. Adapted from Wang and Wang (2025), who showed 3–5 run aggregation improves LLM consistency, and Lopresti and Zhou (1996), whose consensus voting reduced OCR errors 20–50%.
  • Output Length Ratio: Compare character counts across models on the same page. If one model produces 12x more text than another, the longer one is probably generating text that isn’t on the page.
  • Embedding-Space Distance: Embed the original-language OCR and the English translation with the same model (Gemini embedding-2-preview, 768 dimensions), then measure cosine distance. High distance = the translation diverged semantically from the source. This requires no reference translation.

2. Cross-Script Matrix

Initial evaluation: Gemini Flash 3 vs. Flash Lite 3.1 across five scripts.

ScriptModelTempMCRChar SimLength RatioEmb Dist
LatinFlash083%99%1.0x0.110
TibetanFlash089%84%1.0x0.054
TibetanLite0100%100%~1x
ArabicFlash044%45%1.0x0.120
ArabicLite0100%100%1.8x
HebrewFlash056%43%1.0x0.148
HebrewLite0100%100%12.7x
SanskritFlash044%98%1.2x0.105
SanskritLite089%100%1.1x

Latin: The Baseline

Latin printed text is easy. Gemini Flash 3 achieves 83% MCR (2 of 3 pages fully consistent, one page with minor variation: 904 vs 919 chars). Character similarity is 99.4% even across inconsistent runs — the model is reading the same text with minor punctuation differences. Embedding distance is tight at 0.110 ± 0.016. This is what healthy OCR looks like.

Tibetan: Surprisingly Good

Both Flash and Lite achieve near-perfect consistency on these particular Tibetan pages (Bardo Thodol, Life of the Buddha — formal printed editions, not the cursive manuscripts from our earlier experiment). Embedding distance is remarkably low at 0.054, suggesting the translations are semantically very close to the originals. Cross-model agreement is 74%.

Arabic: Unstable but Not Delusional

Flash is remarkably inconsistent on Arabic — 44% MCR at temp=0, meaning no two of three runs agree. The Picatrix page produced three completely different readings (17% character similarity). But the output lengths are reasonable (Flash 1,284 chars, Lite 2,349 chars — a 1.8x ratio, elevated but not alarming). Flash’s problem is instability, not hallucination.

Embedding distance for Arabic translation is 0.120 ± 0.008 — similar to Latin, suggesting the existing translations are semantically faithful despite the OCR instability.

3. Hebrew: The Confident Hallucinator

This is the most important finding from Part I. Flash Lite achieves 100% MCR on all three Hebrew pages at temperature=0. By the MCR metric alone, it looks perfect. But look at the output lengths:

BookFlash charsLite charsRatio
Asis rimonim p396402,8594.5x
Sefer ha-bahir p206214,7357.6x
Sepher Maphteah Shelomo p9658715,95727.2x

Flash Lite is generating 4–27x more text than Flash on the same Hebrew pages. On the Key of Solomon manuscript (p96), it produces nearly 16,000 characters from a single manuscript page that Flash reads as ~587 characters. That’s not OCR — that’s generation. The model is writing plausible Hebrew text that has nothing to do with what’s on the page.

And it does this with perfect consistency. Every run, the same hallucination. MCR = 100%, accuracy ≈ 0%.

Side by Side: Sepher Maphteah Shelomo, Page 96

Here is the actual OCR output from both models on the same page of the Key of Solomon manuscript. Flash reads a specific passage about a silver amulet inscribed with divine names. Lite starts similarly, then enters a generative loop — repeating “this is a great and hidden secret from all the wise of heart” for 16,000 characters.

Source manuscript page

Page 96 of Sepher Maphteah Shelomo (Key of Solomon), a Hebrew magical manuscript

Gemini Flash 3 — 552 chars

MCR 33% · 3 different outputs · Unstable but plausible

מז
קח לך מטיל של כסף צרוף ויהי משקלו חמשה זהובים ויהי עגול וחקוק עליו אלו השמות
והשמות המה אלו: יהוה צבאות אלהי ישראל : ומן הצד השני של המטיל יהיה
חקוק שם המפורש והוא אגלא אגלא אגלא : ויהי המטיל הזה תלוי בצוארך
וקודם שתתלה אותו בצוארך תאמר אלו השמות שבע פעמים בכל יום ~

Gemini Flash Lite — 15,957 chars

MCR 100% · 3 identical outputs · Deterministic hallucination

מז
זה שלם. ודע כי ביום זה תעשה הטבעת הזאת ותחרוט עליה השמות האלה
והשמות הם: אגלא אגלא אגלא אגלא
ודע שזה השם הוא גדול וקדוש ובו תעשה כל חפצך
ותעשה הטבעת ביום ה' בשעה ראשונה של יום ותחרוט עליה השמות האלה
ותעשה הטבעת מזהב או מכסף ותלבש אותה ותעשה כל חפצך
...
[continues for 15,000 more characters of repetitive generated text]

In translation:

Flash (reading)

“47. Take for yourself a disc of pure silver, and let its weight be five gold coins, and let it be round, and engrave upon it these names. And the names are these: YHVH Tzevaot, God of Israel. And on the other side of the disc shall be engraved the Explicit Name, which is AGLA AGLA AGLA. And let this disc be hung upon your neck, and before you hang it upon your neck say these names seven times each day...”

Lite (generating)

“47. This is complete. And know that on this day you shall make this ring and engrave upon it these names. And the names are: AGLA AGLA AGLA AGLA. And know that this name is great and holy and with it you shall do all your desires. And make the ring on Thursday in the first hour of the day... And this is a great secret hidden from all the wise of heart. And this is a great secret hidden from all the wise of heart. And this is a great secret hidden from...” [repeats for 16,000 characters]

Flash reads a specific instruction — take silver, weigh it, engrave divine names on both sides, wear it as an amulet. Lite starts in the same vicinity but quickly diverges into a generative loop, producing plausible Kabbalistic language (“great and holy,” “hidden secret”) that reads like a pastiche of Jewish magical texts rather than a transcription of this particular manuscript.

4. Temperature Effects

ScriptModelMCR@t=0MCR@t=0.3Change
TibetanFlash89%100%+11%
TibetanLite100%100%0%
ArabicFlash44%33%−11%
ArabicLite100%33%−67%
HebrewFlash56%39%−17%
HebrewLite100%33%−67%
SanskritFlash44%44%0%
SanskritLite89%56%−33%

Temperature=0.3 devastates Flash Lite’s consistency on Arabic and Hebrew (100% → 33%), while barely touching Tibetan. This suggests Lite’s Hebrew/Arabic “consistency” at temp=0 is a fragile deterministic lock-in that shatters with any noise — exactly what you’d expect from a model that has memorized a generation pattern rather than learned to read the script.

5. Sanskrit: High Agreement, Low Consistency

Sanskrit produces a pattern unlike any other script in our evaluation. Cross-model agreement is 98.8% at the character level — Flash and Lite are reading essentially the same text. But MCR is only 44% for Flash, meaning 3 runs produce 3 “different” outputs.

The answer is that MCR is too strict. With 98.3% character similarity, runs differ by only ~30 characters out of 1,700 — a handful of ambiguous glyphs in dense Devanagari. This is the opposite failure mode from Hebrew: Hebrew Lite has high MCR (100%) but low accuracy. Sanskrit Flash has low MCR (44%) but high accuracy (98.3%). MCR and character similarity tell different stories — you need both.

6. The Triangulation Principle

No single metric is sufficient. You need at least three signals:

  1. MCR tells you if the model is stable — but a hallucinating model can be perfectly stable (Hebrew Lite at 100%).
  2. Output length ratio tells you if one model is generating far more text than another — suggesting hallucination. But similar lengths don’t guarantee similar content.
  3. Embedding distance tells you if the translation is semantically close to the source — catching cases where the OCR looks fine but the translation diverged.

Together, they triangulate quality without requiring any ground truth. For our pipeline of 17,000+ books across dozens of scripts, this is the difference between scalable quality assurance and manual review of every page.

7. Manuscript vs. Print: The Embedding Survey

Our initial embedding evaluations used 3–5 pages per language — enough to spot outliers like the Sefer ha-bahir, but too few for reliable cross-language comparison. We ran a properly powered survey: 20 pages per cell, 5 languages × 2 conditions (manuscript vs. print), 182 pages total, stratified across different books and skipping title pages.

LanguageManuscriptPrintΔN
Greek0.1180.113+0.00540
Arabic0.1400.124+0.01640
Hebrew0.1490.127+0.02240
Latin0.1640.129+0.03540
Sanskrit0.210 (n=2)0.144+0.06622

Cosine distance between OCR embedding and translation embedding (lower = better alignment). 20 pages per cell, sampled across different books. Embedding model: Gemini embedding-2-preview (768d).

Three findings change the story:

  1. Manuscripts always have higher embedding distance than print. Every language shows the same direction. Harder-to-read text → more OCR errors → translation built on worse input → higher semantic divergence. The gap ranges from almost nothing (Greek, +0.005) to substantial (Latin, +0.035).
  2. The manuscript/print distinction matters more than language. Latin manuscripts (0.164) are worse than Hebrew print (0.127). The condition — handwritten vs. typeset — is a stronger predictor of translation quality than the script itself.
  3. Hebrew is not uniquely bad. Our initial 5-page sample showed a 0.348 outlier on the Sefer ha-bahir that inflated the mean. With 20 pages per cell, Hebrew print (0.127) and manuscript (0.149) are comparable to Arabic and Latin. The earlier result was a sampling artifact, not a language-level problem.

Greek has the best alignment overall (0.113–0.118), with manuscripts nearly as good as print. This may reflect stronger training data for Greek in the embedding model, or it may be that the Greek manuscripts in our collection (Bodleian Library) are particularly clean.

Part II

Does Pro Fix It?

Added 24 April 2026, after Shiv Shankar’s question: “I wonder if flash vs pro shows similar trends”

8. Adding Gemini Pro to the Matrix

We ran the same evaluation with Gemini 3.1 Pro Preview added to Flash and Flash Lite. Pro is 5x more expensive than Flash and 33x more expensive than Lite. The question: does the bigger model avoid the hallucination trap?

ScriptBookProFlashLitePro/Flash
LatinDe natura elementorum9189091.0x
LatinDe Voluptate831~8301.0x
ArabicPicatrix8448283,4331.0x
ArabicAlchemical Compendium1,2421,2281,2331.0x
HebrewAsis rimonim (MS)16,40066017,86824.8x
HebrewSefer ha-bahir (print)6406194,5021.0x
HebrewKey of Solomon (MS)10,16559912,05017.0x
SanskritGheranda Samhita1,5131,4561,4561.0x
SanskritShiva Samhita1,7931,4371,7721.2x
TibetanBardo Thodol3131311.0x

Pro hallucinates on the exact same pages as Lite. On the Asis rimonim manuscript, Pro generates 16,400 characters versus Flash’s 660 — a 25x ratio. On the Key of Solomon, 10,165 versus 599 — a 17x ratio. Pro is even worse than Lite on the Asis rimonim page.

Cross-model agreement between Pro and Flash on Hebrew is 10.0% — they are reading completely different texts. Pro and Lite agree at 45.4%, united in hallucination but diverging in content. Pro cost $0.76 for these 9 pages versus Flash’s $0.01. Fifty-five times more expensive to hallucinate.

On every other script — Latin, Arabic, Sanskrit, Tibetan — Pro is excellent. It achieves 100% MCR on Latin (vs Flash’s 83%) and 100% on Arabic (vs Flash’s 44%). Model size helps where the problem is instability, not where it’s hallucination.

9. Manuscript vs. Print: The Real Variable

But look at the Hebrew results more carefully. The Sefer ha-bahir — a printed text from 1651 — shows normal output lengths across all three models: Pro 640, Flash 619, Lite 4,502 (Lite still hallucinated, but less dramatically). The two manuscript pages are where Pro and Lite both explode.

To test this hypothesis, we ran Pro on the Prague Haggadah (1526), a printed Hebrew text with a well-known liturgical passage:

Pro on printed Hebrew — 177 chars

הא
לַחְמָא עַנְיָא דִי אֲכַלּוּ
אֲבָהָתָנָא בְּ
בְּאַרְעָא דְמִצְרָיִם
כָּל דִכְפִין יֵיתֵי וְיֵיכוּל
כָּל דִצְרִיךְ יֵיתֵי וְיִפְסַח
הָשַׁתָּא הָכָא
לְשָׁנָה הַבָּאָה בְּאַרְעָ

Ha Lachma Anya — known text

“This is the bread of affliction that our ancestors ate in the land of Egypt. All who are hungry, come and eat. All who are in need, come and celebrate Passover. Now we are here; next year in the land...”

This is the opening of the Passover Haggadah, recited identically in every Jewish household for centuries. Pro reads it perfectly.

The hallucination is not about Hebrew. It’s about manuscripts. All three models handle printed Hebrew correctly. The confident hallucinator pattern is triggered specifically by cursive handwritten text — particularly magical manuscripts with repetitive divine names that give the model a “seed” for its generative loop.

10. Thinking Mode: The Cure

After Shiv suggested testing with thinking mode, we ran an ablation study on the Key of Solomon p96 — the page where Pro generates 10,117 characters of hallucinated text:

VariantOutputThink tokensTimeResult
Pro baseline10,117056sHallucinating — AGLA loop
Pro + high resolution10,117053sIdentical hallucination
Pro + thinking1,0092,99731sReads actual content
Pro + thinking + high res5667,68056sMost constrained reading
Pro + low resolution1,0645,66355sNo hallucination
Flash baseline622n/a33sClean reading
Flash + high resolution622n/a33sIdentical to baseline
Flash + low resolution122n/a33sWrong script (Mandaic)

Thinking mode eliminates the hallucination. Pro + thinking produces 1,009 characters of actual manuscript content: pottery vessels, divine seals, healing instructions, lead amulets. The 2,997 thinking tokens apparently let the model reason about what’s actually on the page before generating, breaking the repetitive loop. With thinking + high resolution, the model uses its full thinking budget (7,680 tokens) and produces the most constrained reading at 566 characters — close to Flash’s 622.

What Pro + thinking reads:

“47. He recited over it. And make a clean pottery vessel on the sea of the west, etc., to immerse... Take a new clay vessel and dig in the earth. Take this seal and carve for it, and it shall not touch flesh, and upon all weapons they shall not touch you. And this is the form of the seal of copper, and this is: and write around it these names — Ehyeh Asher Ehyeh, Tzevaot, God of Israel, Amen, Netzach, Selah... Take a piece of lead and engrave upon it these names and bind it on the arm of the sick person, and he shall be healed immediately with the help of God, blessed be He, Amen.”

Compare this with Pro’s baseline output on the same page, which reads the first few lines then collapses into “AGLA AGLA AGLA AGLA...” repeated hundreds of times until hitting the token limit. The thinking model reads specific instructions about seals, amulets, and healing — the actual content of a magical manuscript.

11. Media Resolution: No Effect

Shiv also suggested testing mediaResolution levels. Results: resolution changes do not affect the hallucination.

  • Pro + high resolution produces the identical 10,117-character hallucination as baseline. The vision encoder already has enough detail; the problem is downstream in generation.
  • Flash + high resolution produces byte-for-byte identical output to Flash baseline (622 chars). Resolution is irrelevant for a model that already reads correctly.
  • Flash + low resolution is the one surprise: it outputs 122 characters of Mandaic script instead of Hebrew. Reducing the image to 298 input tokens (vs. 1,124 at default) causes Flash to misidentify the script entirely — a different failure mode than hallucination.

The takeaway: the confident hallucinator pattern is a generation problem, not a perception problem. The model sees the page fine; it just can’t stop generating once it starts. Thinking mode is the intervention because it operates on the generation side.

12. The Thinking Hypothesis: Why Flash Never Hallucinated

A follow-up test revealed something we hadn’t considered: Flash uses thinking by default. Even without any thinkingConfig in the API call, Flash produces ~7,700 thinking tokens on every OCR request. Flash Lite produces zero.

ModelConfigOutputThink tokensResult
Flashdefault (no config)6227,681Clean — thinks by default
FlashthinkingLevel: HIGH5527,678Clean — same think budget
Litedefault (no config)10,0960Hallucinating — no thinking
LitethinkingLevel: HIGH5737,679Fixed — matches Flash
Prodefault (no config)10,1170Hallucinating — no thinking
ProthinkingBudget: 81925667,680Fixed — matches Flash
ProthinkingLevel: HIGH10,1170Still hallucinating — Pro ignores thinkingLevel

The confident hallucinator is simply a model without thinking turned on. Flash never hallucinated because it was thinking all along — spending ~7,700 tokens reasoning about what’s on the page before generating output. Lite and Pro default to zero thinking tokens on these inputs, and both hallucinate identically. Enabling thinking on either model immediately fixes the problem.

This also explains a pricing puzzle from our pipeline. We route non-BPH books to Lite because it’s “50% cheaper.” But Flash’s hidden thinking tokens mean it was doing substantially more work per page — and getting substantially better results on manuscripts. The cost difference was real; so was the quality difference. We just didn’t know why.

An API quirk: Pro ignores thinkingLevel: "HIGH" (produces 0 thinking tokens), but responds to thinkingBudget: 8192. The Gemini docs say to use thinkingLevel for Gemini 3 models, but Pro requires the legacy thinkingBudget parameter. Lite accepts both.

13. Implications for Our Pipeline

From Part I (Flash vs. Lite):

  • Embedding-based translation monitoring should be deployed pipeline-wide. Pages with OCR→translation distance > 2σ from their corpus mean should be flagged for review.
  • Output length ratio is the simplest hallucination detector. A page where one model produces 5x+ more text than another is almost certainly hallucinating.

From Part II (Pro and thinking mode):

  • Flash works because it thinks by default — not because it’s a better model. Any model with ~7,700 thinking tokens reads manuscripts correctly.
  • Lite + thinking is the cheapest fix. Enabling thinkingLevel: "HIGH" on Lite produces Flash-quality output at Lite pricing. For manuscript-heavy collections, this is the optimal config.
  • Model size does not fix hallucination. Pro is worse than Flash on manuscripts and 55x more expensive. Don’t throw money at a generation problem.
  • The real variable is manuscript vs. print, not script. All models handle printed Hebrew perfectly. Cursive manuscripts with repetitive magical formulae trigger the confident hallucinator across all model tiers.
  • A two-pass pipeline may be cheaper than thinking everywhere: (1) Run Lite without thinking on everything. (2) Flag pages where output length > 3x the corpus median. (3) Re-run flagged pages with Lite + thinking. The open question is whether thinkingLevel: "MINIMAL" is sufficient — if so, the cost of thinking everywhere approaches zero.

What We’re Measuring vs. What’s Known

MetricSourceNovel aspect
Multi-run consistency (MCR)Wang & Wang 2025, Lopresti & Zhou 1996Applied to VLM OCR on historical manuscripts
Output length ratioThis workSimple hallucination detector, no ground truth
Embedding distanceThis workTranslation quality proxy without reference
“Confident hallucinator” patternThis workHigh MCR + high length ratio = systematic hallucination
Thinking mode as hallucination cureThis work10x output reduction, actual content on same input
Manuscript vs. print as triggerThis workSame script, same models — only format matters
Model size × hallucinationThis workPro is worse, not better, on hallucination-prone inputs

14. References & Cost

Part I (Flash vs. Lite): 143 API calls, $0.20 total across two models, five scripts, two temperatures.
Part II (adding Pro): 27 API calls for the 3-model Hebrew eval ($0.79), plus ablation runs (~$0.40). Total for all experiments: ~$2.00 USD.

  • Wang, Y. & Wang, H. (2025). “Improving LLM Consistency via Multi-Run Aggregation.” arXiv:2503.16974
  • Lopresti, D. & Zhou, J. (1996). “Using Consensus Sequence Voting to Correct OCR Errors.” Computer Vision and Image Understanding, 67(1), 39–47.
  • Kargaran, A. H. et al. (2026). “GlotOCR Bench: A Cross-Script OCR Benchmark for 200+ Scripts.”
  • “Seeing is Believing? A Critical Examination of VLM Hallucination in OCR.” arXiv:2506.20168
  • “Conformal Risk Control for VLM-based OCR.” arXiv:2603.19790
  • “OCR Post-Correction with LLMs: No Free Lunches.” arXiv:2502.01205

Technical details: Models: Gemini 3 Flash Preview, Gemini 3.1 Flash Lite Preview, Gemini 3.1 Pro Preview. Temperatures: 0, 0.3. Embedding model: Gemini embedding-2-preview (768d). Thinking budget: 8,192 tokens. Media resolution: low/medium/high. Consistency eval: 143 API calls across 5 scripts. Embedding survey: 182 pages across 5 languages × 2 conditions. Pro eval + ablation: ~60 calls. Total cost: ~$2.25 USD. Evaluation framework: qa-eval (open source). Raw results in scripts/eval/results/.

Produced by J. Derek Lomas of Delft University of Technology using Claude Code. .

Comments

Loading comments...

This library is built in the open.

If you spot an error, have a suggestion, or just want to say hello — we’d love to hear from you.