From c68b9ef6cd3b9f409ba87a062cb5ef88c364662b Mon Sep 17 00:00:00 2001 From: Stephen Masters Date: Fri, 16 Oct 2026 23:58:32 +0100 Subject: [PATCH] feat(claude): add claude-haiku, the smaller model, as its own backend Scored beside claude through the harness so brief 002's question, whether the smaller model is good enough for batch escalation, is a measurement. It is not: on the posters local engines cannot read it drops small print and substitutes plausible wording. The site and deck no longer count any API backend as best local. Refs #30 Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 5 ++- README.md | 6 ++- docs/guide/backends.md | 6 ++- docs/guide/command-line.md | 1 + docs/installation.md | 3 +- evaluation/ocr/benchmark.csv | 38 ++++++++--------- evaluation/ocr/benchmark.md | 42 +++++++++---------- evaluation/ocr/benchmark_claude_haiku.csv | 19 +++++++++ evaluation/ocr/benchmark_claude_haiku.md | 24 +++++++++++ ...2026-10-16_234922_c40183e_claude_haiku.csv | 19 +++++++++ .../2026-10-16_234922_c40183e_claude_haiku.md | 27 ++++++++++++ ...0-16_234922_c40183e_merge-claude-haiku.csv | 19 +++++++++ ...10-16_234922_c40183e_merge-claude-haiku.md | 29 +++++++++++++ site/content/reference/engines.md | 17 ++++++++ site/data/walkthrough.toml | 13 ++++++ site/layouts/partials/benchmark.html | 11 ++++- site/layouts/partials/walkthrough-scores.html | 4 +- src/tetrak_ocr/backends/claude.py | 13 +++++- src/tetrak_ocr/registry.py | 10 +++++ tests/ocr/test_registry.py | 28 +++++++++++++ tools/generate_presentation.py | 10 +++-- 21 files changed, 290 insertions(+), 54 deletions(-) create mode 100644 evaluation/ocr/benchmark_claude_haiku.csv create mode 100644 evaluation/ocr/benchmark_claude_haiku.md create mode 100644 evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.csv create mode 100644 evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.md create mode 100644 evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.csv create mode 100644 evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.md diff --git a/AGENTS.md b/AGENTS.md index e40f224..2a59b58 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -99,7 +99,7 @@ python tools/generate_corpus_thumbnails.py # → site/assets/images/corpus/ ``` Backend names: `tesseract`, `tesseract-auto`, `easyocr`, `easyocr-hy`, `paddle`, -`paddle-vl`, `claude`, `marker`, `vision`, `auto-local`. `easyocr-hy` is stock EasyOCR with +`paddle-vl`, `claude`, `claude-haiku`, `marker`, `vision`, `auto-local`. `easyocr-hy` is stock EasyOCR with the project's own Armenian recogniser swapped in — its own name, like `tesseract-auto`, so the harness scores the difference rather than asserting it. `vision` is macOS-only — Apple's Vision framework via `ocrmac`, declared with a `sys_platform` marker so `[all]` still @@ -116,7 +116,8 @@ needs the `qa` extra, checked up front rather than on the first file. **The backend interface is fixed.** Every backend exposes `SUPPORTED_EXTENSIONS: set[str]` and `ocr_image(path: Path, ...) -> str`. -Tesseract adds optional `contrast`, `psm`, `auto` and `lang`. Nothing else varies. That +Tesseract adds optional `contrast`, `psm`, `auto` and `lang`, and Claude an +optional `model`, which is how `claude-haiku` differs from `claude`. Nothing else varies. That uniformity is what lets `registry.py`, the batch pipeline and the harness treat backends interchangeably; a backend that needs a different signature needs an adapter, not a special case in the callers. diff --git a/README.md b/README.md index 0a0e99c..cf70345 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,7 @@ top of them. | `paddle-vl` | `[paddle-vl]` | ✓ | Document vision-language model. Reads PDFs and multi-page TIFFs; strongest local engine measured, but minutes per page. Join it to auto-local with `--with-paddle-vl` | | `marker` | `[marker]` | ✓ | Layout-aware document conversion — the only local backend that models reading order | | `claude` | `[claude]` | ✓ | The Anthropic vision API. Reads material no local tool can | +| `claude-haiku` | `[claude]` | ✓ | The same API with Anthropic's smallest current model. Cheaper, and measurably worse on the material `claude` is for | | `auto-local` | `[qa]` | ✓ | **The recommended default.** Runs the viable local engines, scores each, keeps the best | A few things worth knowing before you pick one: @@ -231,6 +232,9 @@ A few things worth knowing before you pick one: - **`marker` is slow and GPU-gated inside `auto-local`.** It is the only local engine that gets multi-column newsprint into the right reading order, and it takes roughly 18 minutes of a 70-minute benchmark run to do it. +- **`claude-haiku` is not a cheaper `claude`.** On the posters local engines + cannot read, it leaves out imprints and small lines and sometimes puts + plausible wording in their place. Use `claude` for escalation. - **`claude` sends your images to an API** and needs `ANTHROPIC_API_KEY`, which rules it out for confidential material. It also does not reproduce between runs — it recovers the same words and orders them differently. It is the @@ -340,7 +344,7 @@ tetrak-ocr batch --backend tesseract-auto --quality-gate ### Supported files JPEG, PNG and TIFF everywhere; PDF on `tesseract`, `tesseract-auto`, `marker`, -`claude` and `auto-local`. Multi-page TIFF is read in full — Pillow opens such +`claude`, `claude-haiku` and `auto-local`. Multi-page TIFF is read in full — Pillow opens such a file at frame 0 and says nothing about the rest, so backends that cannot page through one refuse it by name rather than returning the cover as though it were the whole document. diff --git a/docs/guide/backends.md b/docs/guide/backends.md index a44f808..3953434 100644 --- a/docs/guide/backends.md +++ b/docs/guide/backends.md @@ -15,6 +15,7 @@ strategy built on top of them. | `paddle-vl` | `[paddle-vl]` | ✓ | Document vision-language model. Reads PDFs and multi-page TIFFs; strongest local engine measured, but minutes per page | | `marker` | `[marker]` | ✓ | Layout-aware document conversion, the only local backend that models reading order | | `claude` | `[claude]` | ✓ | The Anthropic vision API. Reads material no local tool can | +| `claude-haiku` | `[claude]` | ✓ | The same API with Anthropic's smallest current model. Cheaper, and measurably worse on the material `claude` is for | | `auto-local` | `[qa]` | ✓ | **The recommended default.** Runs the viable local engines, scores each, keeps the best | The measurements behind every claim on this page are on @@ -44,6 +45,9 @@ deliberately not repeated here, where nothing would keep them current. between runs: it recovers the same words and orders them differently. It is the thing to reach for on decorative and hand-lettered type, where local engines collapse. +- **`claude-haiku` is not a cheaper `claude`.** On the posters local + engines cannot read, it leaves out imprints and small lines and sometimes + puts plausible wording in their place. Use `claude` for escalation. - **The deep-learning backends download weights on first run** and hold them in memory afterwards, so the first call is slow and later ones are not. That is fine for batch work and poor for one-shot interactive use. @@ -91,7 +95,7 @@ instead. ## Supported files JPEG, PNG and TIFF everywhere; PDF on `tesseract`, `tesseract-auto`, -`paddle-vl`, `marker`, `claude` and `auto-local`. The batch pipeline filters +`paddle-vl`, `marker`, `claude`, `claude-haiku` and `auto-local`. The batch pipeline filters `workspace/scans/` by the chosen backend's supported extensions, so a PDF is silently skipped under `easyocr`, `easyocr-hy`, `paddle` or `vision`; `--dry-run` makes that visible. diff --git a/docs/guide/command-line.md b/docs/guide/command-line.md index a213710..694bf8d 100644 --- a/docs/guide/command-line.md +++ b/docs/guide/command-line.md @@ -25,6 +25,7 @@ $ tetrak-ocr backends ✓ tesseract ✓ tesseract-auto · claude (extra not installed) + · claude-haiku (extra not installed) ✓ auto-local ``` diff --git a/docs/installation.md b/docs/installation.md index 7622af4..4de6c8d 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -62,7 +62,7 @@ well over a gigabyte before any model downloads at first run. | `paddle-vl` | `paddle-vl` | PaddleOCR-VL, the document vision-language model in the same package | | `marker` | `marker` | marker-pdf 1.x | | `vision` | `vision` | `ocrmac`, a wrapper over Apple's Vision framework. macOS only | -| `claude` | `claude` | the Anthropic SDK | +| `claude` | `claude`, `claude-haiku` | the Anthropic SDK | | `ocr` | everything above except `armenian` | | | `all` | the same as `ocr` | | @@ -116,6 +116,7 @@ $ tetrak-ocr backends ✓ tesseract ✓ tesseract-auto · claude (extra not installed) + · claude-haiku (extra not installed) · easyocr (extra not installed) ✓ easyocr-hy · paddle (extra not installed) diff --git a/evaluation/ocr/benchmark.csv b/evaluation/ocr/benchmark.csv index 9d420ac..e2a55ea 100644 --- a/evaluation/ocr/benchmark.csv +++ b/evaluation/ocr/benchmark.csv @@ -1,19 +1,19 @@ -fixture,tesseract_chr,tesseract_wrd,tesseract_sec,tesseract-auto_chr,tesseract-auto_wrd,tesseract-auto_sec,claude_chr,claude_wrd,claude_sec,easyocr_chr,easyocr_wrd,easyocr_sec,easyocr-hy_chr,easyocr-hy_wrd,easyocr-hy_sec,paddle_chr,paddle_wrd,paddle_sec,paddle-vl_chr,paddle-vl_wrd,paddle-vl_sec,marker_chr,marker_wrd,marker_sec,vision_chr,vision_wrd,vision_sec,auto-local_chr,auto-local_wrd,auto-local_sec -bancroft-magician-poster.jpg,0.0723,0.0000,0.46,0.2846,0.0000,0.34,0.7165,0.7727,3.92,0.3970,0.1364,3.00,0.1750,0.0000,3.95,0.5467,0.3182,10.86,0.3084,0.1364,23.14,0.1658,0.0000,8.94,0.5692,0.4091,0.95,0.5692,0.4091,15.13 -carthay-circle-postcard-back.png,0.5950,0.5000,0.43,0.9256,0.7917,0.48,0.9766,0.9167,6.21,0.7860,0.6250,0.41,0.4874,0.0833,0.42,0.2844,0.6250,7.23,0.6780,0.7917,21.24,0.6640,0.6250,5.65,0.6535,0.8333,0.55,0.9256,0.7917,16.79 -carthay-circle-premiere.jpg,0.0000,0.0000,0.20,0.5141,0.8571,0.47,0.8939,0.9286,2.39,0.8701,0.7143,0.35,0.7444,0.2857,0.27,0.0885,0.0000,6.79,0.8827,0.8571,18.12,0.7562,0.8571,5.60,0.8939,0.9286,0.47,0.5141,0.8571,15.29 -chinese-theatre-triptych-postcard.jpg,0.4444,0.4000,0.30,0.4444,0.4000,0.32,1.0000,1.0000,2.19,0.5044,0.6667,0.29,0.4622,0.0000,0.35,0.7850,0.7333,6.03,0.8290,0.8667,13.71,0.4472,0.4667,4.38,0.6578,0.9333,0.50,0.4472,0.4667,13.16 -graumans-chinese-theatre.jpg,0.6587,0.4375,0.27,0.7933,0.4375,0.28,0.8750,0.5625,2.41,0.7168,0.5000,0.31,0.6092,0.0625,0.31,0.7386,0.1875,6.30,0.7179,0.3125,16.61,0.0960,0.0000,5.39,0.7342,0.3750,0.46,0.7342,0.3750,13.52 -greek-theatre-night.jpg,0.9048,0.7500,0.27,0.9048,0.7500,0.29,1.0000,1.0000,2.37,0.9486,0.7500,0.30,0.7907,0.0000,0.28,0.9114,0.5000,4.32,0.9882,0.9167,15.11,0.7387,1.0000,5.39,0.9829,1.0000,0.46,0.7387,1.0000,12.34 -hollywood-boulevard-east.jpg,0.6311,0.3333,0.30,0.6184,0.3333,0.31,0.9286,0.8333,2.76,0.7240,0.4444,0.28,0.6484,0.1667,0.28,0.6352,0.4444,7.42,0.6537,0.3889,10.97,0.1111,0.0000,5.56,0.6825,0.3889,0.54,0.6825,0.3889,15.46 -hollywood-boulevard-west.jpg,0.4161,0.2667,0.28,0.4161,0.2667,0.29,0.9577,0.8333,3.55,0.5660,0.3000,0.30,0.4177,0.1667,0.35,0.5759,0.4333,6.40,0.4949,0.2667,17.93,0.0806,0.0000,6.81,0.5333,0.4333,0.50,0.4161,0.2667,14.76 -hollywood-music-box-playbill-1926.tif,0.5181,0.4569,1.04,0.5699,0.5310,1.11,0.9914,0.9603,28.12,0.5032,0.3948,5.70,0.3408,0.2569,7.85,0.7777,0.9086,42.61,0.8751,0.9000,170.32,0.4715,0.7362,274.70,0.6890,0.8103,1.20,0.4715,0.7362,325.30 -inside-facts-1930-cover.jpg,0.6824,0.8489,2.21,0.8966,0.9064,2.16,0.9970,0.9932,27.20,0.4130,0.7080,7.82,0.6490,0.5039,9.72,0.5009,0.9414,57.51,0.9798,0.9335,221.11,0.7511,0.8997,286.81,0.6320,0.8771,2.25,0.7511,0.8997,349.55 -inside-facts-1930-page-six.jpg,0.9409,0.9060,4.86,0.9409,0.9060,4.88,0.9941,0.9517,63.99,0.3013,0.7778,17.70,0.6093,0.6038,21.47,0.2953,0.9693,132.41,0.9620,0.9462,612.47,0.7382,0.9301,308.03,0.5942,0.8914,4.17,0.7382,0.9301,461.41 -kar-mi-troupe-poster.jpg,0.0143,0.0048,0.30,0.0890,0.0145,0.39,0.9872,0.9758,11.16,0.1239,0.3913,0.71,0.0967,0.0000,1.04,0.2741,0.3816,9.22,0.2874,0.4396,27.04,0.0264,0.0000,2.91,0.2857,0.4638,0.82,0.2857,0.4638,16.80 -kinema-theater-ad-1920.tif,0.4506,0.3983,0.77,0.4506,0.3983,0.81,0.7537,0.9788,17.32,0.4175,0.6653,2.73,0.4324,0.3263,3.80,0.4907,0.9280,26.28,0.7429,0.9195,126.50,0.9319,0.8686,23.24,0.8837,0.9068,1.14,0.9319,0.8686,58.29 -king-of-kings-souvenir-1927.pdf,0.9120,0.9443,35.50,0.9120,0.9443,35.24,0.9309,0.9664,150.72,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0.8921,0.9007,1128.65,0.8703,0.9239,423.31,N/A,N/A,N/A,0.8703,0.9239,431.60 -over-the-fence-poster.jpg,0.1863,0.1364,0.33,0.3959,0.1818,0.31,0.7737,0.8182,2.97,0.4896,0.2273,0.26,0.2737,0.1364,0.33,0.6355,0.4545,6.48,0.3877,0.3636,14.65,0.1868,0.0000,3.17,0.5373,0.4545,0.62,0.6355,0.4545,12.89 -parlor-match-poster.jpg,0.0000,0.0000,0.36,0.1415,0.0312,0.30,1.0000,1.0000,3.45,0.6687,0.4375,0.40,0.2405,0.0000,0.58,0.6806,0.3125,7.88,0.8827,0.7188,25.74,0.7560,0.7500,7.04,0.7872,0.6562,0.80,0.7872,0.6562,19.29 -thurston-magician-poster.jpg,0.0833,0.0370,0.29,0.2555,0.2593,0.34,0.9884,0.9630,3.20,0.7353,0.5185,0.26,0.1250,0.0000,0.38,0.7372,0.4444,6.30,0.7310,0.6296,18.05,0.7159,0.5185,6.37,0.6237,0.5185,0.63,0.7159,0.5185,19.40 -Average,0.4418,0.3777,48.17,0.5620,0.4711,48.32,0.9273,0.9091,333.93,0.5728,0.5161,40.82,0.4439,0.1620,51.36,0.5599,0.5364,344.02,0.7231,0.6640,2481.36,0.5005,0.5045,1383.30,0.6712,0.6800,16.05,0.6597,0.6475,1811.01 +fixture,tesseract_chr,tesseract_wrd,tesseract_sec,tesseract-auto_chr,tesseract-auto_wrd,tesseract-auto_sec,claude_chr,claude_wrd,claude_sec,claude-haiku_chr,claude-haiku_wrd,claude-haiku_sec,easyocr_chr,easyocr_wrd,easyocr_sec,easyocr-hy_chr,easyocr-hy_wrd,easyocr-hy_sec,paddle_chr,paddle_wrd,paddle_sec,paddle-vl_chr,paddle-vl_wrd,paddle-vl_sec,marker_chr,marker_wrd,marker_sec,vision_chr,vision_wrd,vision_sec,auto-local_chr,auto-local_wrd,auto-local_sec +bancroft-magician-poster.jpg,0.0723,0.0000,0.46,0.2846,0.0000,0.34,0.7165,0.7727,3.92,0.5759,0.6364,2.29,0.3970,0.1364,3.00,0.1750,0.0000,3.95,0.5467,0.3182,10.86,0.3084,0.1364,23.14,0.1658,0.0000,8.94,0.5692,0.4091,0.95,0.5692,0.4091,15.13 +carthay-circle-postcard-back.png,0.5950,0.5000,0.43,0.9256,0.7917,0.48,0.9766,0.9167,6.21,0.9728,0.9167,3.05,0.7860,0.6250,0.41,0.4874,0.0833,0.42,0.2844,0.6250,7.23,0.6780,0.7917,21.24,0.6640,0.6250,5.65,0.6535,0.8333,0.55,0.9256,0.7917,16.79 +carthay-circle-premiere.jpg,0.0000,0.0000,0.20,0.5141,0.8571,0.47,0.8939,0.9286,2.39,0.8939,0.9286,1.67,0.8701,0.7143,0.35,0.7444,0.2857,0.27,0.0885,0.0000,6.79,0.8827,0.8571,18.12,0.7562,0.8571,5.60,0.8939,0.9286,0.47,0.5141,0.8571,15.29 +chinese-theatre-triptych-postcard.jpg,0.4444,0.4000,0.30,0.4444,0.4000,0.32,1.0000,1.0000,2.19,0.9469,1.0000,1.56,0.5044,0.6667,0.29,0.4622,0.0000,0.35,0.7850,0.7333,6.03,0.8290,0.8667,13.71,0.4472,0.4667,4.38,0.6578,0.9333,0.50,0.4472,0.4667,13.16 +graumans-chinese-theatre.jpg,0.6587,0.4375,0.27,0.7933,0.4375,0.28,0.8750,0.5625,2.41,0.8333,0.6250,3.02,0.7168,0.5000,0.31,0.6092,0.0625,0.31,0.7386,0.1875,6.30,0.7179,0.3125,16.61,0.0960,0.0000,5.39,0.7342,0.3750,0.46,0.7342,0.3750,13.52 +greek-theatre-night.jpg,0.9048,0.7500,0.27,0.9048,0.7500,0.29,1.0000,1.0000,2.37,1.0000,1.0000,1.85,0.9486,0.7500,0.30,0.7907,0.0000,0.28,0.9114,0.5000,4.32,0.9882,0.9167,15.11,0.7387,1.0000,5.39,0.9829,1.0000,0.46,0.7387,1.0000,12.34 +hollywood-boulevard-east.jpg,0.6311,0.3333,0.30,0.6184,0.3333,0.31,0.9286,0.8333,2.76,0.7328,0.6111,2.19,0.7240,0.4444,0.28,0.6484,0.1667,0.28,0.6352,0.4444,7.42,0.6537,0.3889,10.97,0.1111,0.0000,5.56,0.6825,0.3889,0.54,0.6825,0.3889,15.46 +hollywood-boulevard-west.jpg,0.4161,0.2667,0.28,0.4161,0.2667,0.29,0.9577,0.8333,3.55,0.7989,0.6333,4.43,0.5660,0.3000,0.30,0.4177,0.1667,0.35,0.5759,0.4333,6.40,0.4949,0.2667,17.93,0.0806,0.0000,6.81,0.5333,0.4333,0.50,0.4161,0.2667,14.76 +hollywood-music-box-playbill-1926.tif,0.5181,0.4569,1.04,0.5699,0.5310,1.11,0.9914,0.9603,28.12,0.9763,0.9431,8.68,0.5032,0.3948,5.70,0.3408,0.2569,7.85,0.7777,0.9086,42.61,0.8751,0.9000,170.32,0.4715,0.7362,274.70,0.6890,0.8103,1.20,0.4715,0.7362,325.30 +inside-facts-1930-cover.jpg,0.6824,0.8489,2.21,0.8966,0.9064,2.16,0.9970,0.9932,27.20,0.9736,0.9402,6.61,0.4130,0.7080,7.82,0.6490,0.5039,9.72,0.5009,0.9414,57.51,0.9798,0.9335,221.11,0.7511,0.8997,286.81,0.6320,0.8771,2.25,0.7511,0.8997,349.55 +inside-facts-1930-page-six.jpg,0.9409,0.9060,4.86,0.9409,0.9060,4.88,0.9941,0.9517,63.99,0.5926,0.9452,17.32,0.3013,0.7778,17.70,0.6093,0.6038,21.47,0.2953,0.9693,132.41,0.9620,0.9462,612.47,0.7382,0.9301,308.03,0.5942,0.8914,4.17,0.7382,0.9301,461.41 +kar-mi-troupe-poster.jpg,0.0143,0.0048,0.30,0.0890,0.0145,0.39,0.9872,0.9758,11.16,0.8287,0.8792,4.28,0.1239,0.3913,0.71,0.0967,0.0000,1.04,0.2741,0.3816,9.22,0.2874,0.4396,27.04,0.0264,0.0000,2.91,0.2857,0.4638,0.82,0.2857,0.4638,16.80 +kinema-theater-ad-1920.tif,0.4506,0.3983,0.77,0.4506,0.3983,0.81,0.7537,0.9788,17.32,0.9847,0.9661,9.75,0.4175,0.6653,2.73,0.4324,0.3263,3.80,0.4907,0.9280,26.28,0.7429,0.9195,126.50,0.9319,0.8686,23.24,0.8837,0.9068,1.14,0.9319,0.8686,58.29 +king-of-kings-souvenir-1927.pdf,0.9120,0.9443,35.50,0.9120,0.9443,35.24,0.9309,0.9664,150.72,0.8858,0.9411,46.95,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0.8921,0.9007,1128.65,0.8703,0.9239,423.31,N/A,N/A,N/A,0.8703,0.9239,431.60 +over-the-fence-poster.jpg,0.1863,0.1364,0.33,0.3959,0.1818,0.31,0.7737,0.8182,2.97,0.9517,0.8182,3.37,0.4896,0.2273,0.26,0.2737,0.1364,0.33,0.6355,0.4545,6.48,0.3877,0.3636,14.65,0.1868,0.0000,3.17,0.5373,0.4545,0.62,0.6355,0.4545,12.89 +parlor-match-poster.jpg,0.0000,0.0000,0.36,0.1415,0.0312,0.30,1.0000,1.0000,3.45,0.9796,0.8750,1.95,0.6687,0.4375,0.40,0.2405,0.0000,0.58,0.6806,0.3125,7.88,0.8827,0.7188,25.74,0.7560,0.7500,7.04,0.7872,0.6562,0.80,0.7872,0.6562,19.29 +thurston-magician-poster.jpg,0.0833,0.0370,0.29,0.2555,0.2593,0.34,0.9884,0.9630,3.20,0.7626,0.6296,3.26,0.7353,0.5185,0.26,0.1250,0.0000,0.38,0.7372,0.4444,6.30,0.7310,0.6296,18.05,0.7159,0.5185,6.37,0.6237,0.5185,0.63,0.7159,0.5185,19.40 +Average,0.4418,0.3777,48.17,0.5620,0.4711,48.32,0.9273,0.9091,333.93,0.8641,0.8405,122.25,0.5728,0.5161,40.82,0.4439,0.1620,51.36,0.5599,0.5364,344.02,0.7231,0.6640,2481.36,0.5005,0.5045,1383.30,0.6712,0.6800,16.05,0.6597,0.6475,1811.01 diff --git a/evaluation/ocr/benchmark.md b/evaluation/ocr/benchmark.md index 10de5f0..730a077 100644 --- a/evaluation/ocr/benchmark.md +++ b/evaluation/ocr/benchmark.md @@ -2,24 +2,24 @@ Scores: character similarity / word recall against Claude-generated ground truth (`claude-opus-4-8`). -| Fixture | tesseract | tesseract-auto | claude | easyocr | easyocr-hy | paddle | paddle-vl | marker | vision | auto-local | -|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:| -| bancroft-magician-poster.jpg | 0.07/0.00 | 0.28/0.00 | 0.72/0.77 | 0.40/0.14 | 0.17/0.00 | 0.55/0.32 | 0.31/0.14 | 0.17/0.00 | 0.57/0.41 | 0.57/0.41 | -| carthay-circle-postcard-back.png | 0.60/0.50 | 0.93/0.79 | 0.98/0.92 | 0.79/0.62 | 0.49/0.08 | 0.28/0.62 | 0.68/0.79 | 0.66/0.62 | 0.65/0.83 | 0.93/0.79 | -| carthay-circle-premiere.jpg | 0.00/0.00 | 0.51/0.86 | 0.89/0.93 | 0.87/0.71 | 0.74/0.29 | 0.09/0.00 | 0.88/0.86 | 0.76/0.86 | 0.89/0.93 | 0.51/0.86 | -| chinese-theatre-triptych-postcard.jpg | 0.44/0.40 | 0.44/0.40 | 1.00/1.00 | 0.50/0.67 | 0.46/0.00 | 0.79/0.73 | 0.83/0.87 | 0.45/0.47 | 0.66/0.93 | 0.45/0.47 | -| graumans-chinese-theatre.jpg | 0.66/0.44 | 0.79/0.44 | 0.88/0.56 | 0.72/0.50 | 0.61/0.06 | 0.74/0.19 | 0.72/0.31 | 0.10/0.00 | 0.73/0.38 | 0.73/0.38 | -| greek-theatre-night.jpg | 0.90/0.75 | 0.90/0.75 | 1.00/1.00 | 0.95/0.75 | 0.79/0.00 | 0.91/0.50 | 0.99/0.92 | 0.74/1.00 | 0.98/1.00 | 0.74/1.00 | -| hollywood-boulevard-east.jpg | 0.63/0.33 | 0.62/0.33 | 0.93/0.83 | 0.72/0.44 | 0.65/0.17 | 0.64/0.44 | 0.65/0.39 | 0.11/0.00 | 0.68/0.39 | 0.68/0.39 | -| hollywood-boulevard-west.jpg | 0.42/0.27 | 0.42/0.27 | 0.96/0.83 | 0.57/0.30 | 0.42/0.17 | 0.58/0.43 | 0.49/0.27 | 0.08/0.00 | 0.53/0.43 | 0.42/0.27 | -| hollywood-music-box-playbill-1926.tif | 0.52/0.46 | 0.57/0.53 | 0.99/0.96 | 0.50/0.39 | 0.34/0.26 | 0.78/0.91 | 0.88/0.90 | 0.47/0.74 | 0.69/0.81 | 0.47/0.74 | -| inside-facts-1930-cover.jpg | 0.68/0.85 | 0.90/0.91 | 1.00/0.99 | 0.41/0.71 | 0.65/0.50 | 0.50/0.94 | 0.98/0.93 | 0.75/0.90 | 0.63/0.88 | 0.75/0.90 | -| inside-facts-1930-page-six.jpg | 0.94/0.91 | 0.94/0.91 | 0.99/0.95 | 0.30/0.78 | 0.61/0.60 | 0.30/0.97 | 0.96/0.95 | 0.74/0.93 | 0.59/0.89 | 0.74/0.93 | -| kar-mi-troupe-poster.jpg | 0.01/0.00 | 0.09/0.01 | 0.99/0.98 | 0.12/0.39 | 0.10/0.00 | 0.27/0.38 | 0.29/0.44 | 0.03/0.00 | 0.29/0.46 | 0.29/0.46 | -| kinema-theater-ad-1920.tif | 0.45/0.40 | 0.45/0.40 | 0.75/0.98 | 0.42/0.67 | 0.43/0.33 | 0.49/0.93 | 0.74/0.92 | 0.93/0.87 | 0.88/0.91 | 0.93/0.87 | -| king-of-kings-souvenir-1927.pdf | 0.91/0.94 | 0.91/0.94 | 0.93/0.97 | N/A | N/A | N/A | 0.89/0.90 | 0.87/0.92 | N/A | 0.87/0.92 | -| over-the-fence-poster.jpg | 0.19/0.14 | 0.40/0.18 | 0.77/0.82 | 0.49/0.23 | 0.27/0.14 | 0.64/0.45 | 0.39/0.36 | 0.19/0.00 | 0.54/0.45 | 0.64/0.45 | -| parlor-match-poster.jpg | 0.00/0.00 | 0.14/0.03 | 1.00/1.00 | 0.67/0.44 | 0.24/0.00 | 0.68/0.31 | 0.88/0.72 | 0.76/0.75 | 0.79/0.66 | 0.79/0.66 | -| thurston-magician-poster.jpg | 0.08/0.04 | 0.26/0.26 | 0.99/0.96 | 0.74/0.52 | 0.12/0.00 | 0.74/0.44 | 0.73/0.63 | 0.72/0.52 | 0.62/0.52 | 0.72/0.52 | -| **Average** | **0.44/0.38** | **0.56/0.47** | **0.93/0.91** | **0.57/0.52** | **0.44/0.16** | **0.56/0.54** | **0.72/0.66** | **0.50/0.50** | **0.67/0.68** | **0.66/0.65** | -| **Total seconds** | **48.2** | **48.3** | **333.9** | **40.8** | **51.4** | **344.0** | **2481.4** | **1383.3** | **16.0** | **1811.0** | +| Fixture | tesseract | tesseract-auto | claude | claude-haiku | easyocr | easyocr-hy | paddle | paddle-vl | marker | vision | auto-local | +|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:| +| bancroft-magician-poster.jpg | 0.07/0.00 | 0.28/0.00 | 0.72/0.77 | 0.58/0.64 | 0.40/0.14 | 0.17/0.00 | 0.55/0.32 | 0.31/0.14 | 0.17/0.00 | 0.57/0.41 | 0.57/0.41 | +| carthay-circle-postcard-back.png | 0.59/0.50 | 0.93/0.79 | 0.98/0.92 | 0.97/0.92 | 0.79/0.62 | 0.49/0.08 | 0.28/0.62 | 0.68/0.79 | 0.66/0.62 | 0.65/0.83 | 0.93/0.79 | +| carthay-circle-premiere.jpg | 0.00/0.00 | 0.51/0.86 | 0.89/0.93 | 0.89/0.93 | 0.87/0.71 | 0.74/0.29 | 0.09/0.00 | 0.88/0.86 | 0.76/0.86 | 0.89/0.93 | 0.51/0.86 | +| chinese-theatre-triptych-postcard.jpg | 0.44/0.40 | 0.44/0.40 | 1.00/1.00 | 0.95/1.00 | 0.50/0.67 | 0.46/0.00 | 0.79/0.73 | 0.83/0.87 | 0.45/0.47 | 0.66/0.93 | 0.45/0.47 | +| graumans-chinese-theatre.jpg | 0.66/0.44 | 0.79/0.44 | 0.88/0.56 | 0.83/0.62 | 0.72/0.50 | 0.61/0.06 | 0.74/0.19 | 0.72/0.31 | 0.10/0.00 | 0.73/0.38 | 0.73/0.38 | +| greek-theatre-night.jpg | 0.90/0.75 | 0.90/0.75 | 1.00/1.00 | 1.00/1.00 | 0.95/0.75 | 0.79/0.00 | 0.91/0.50 | 0.99/0.92 | 0.74/1.00 | 0.98/1.00 | 0.74/1.00 | +| hollywood-boulevard-east.jpg | 0.63/0.33 | 0.62/0.33 | 0.93/0.83 | 0.73/0.61 | 0.72/0.44 | 0.65/0.17 | 0.64/0.44 | 0.65/0.39 | 0.11/0.00 | 0.68/0.39 | 0.68/0.39 | +| hollywood-boulevard-west.jpg | 0.42/0.27 | 0.42/0.27 | 0.96/0.83 | 0.80/0.63 | 0.57/0.30 | 0.42/0.17 | 0.58/0.43 | 0.49/0.27 | 0.08/0.00 | 0.53/0.43 | 0.42/0.27 | +| hollywood-music-box-playbill-1926.tif | 0.52/0.46 | 0.57/0.53 | 0.99/0.96 | 0.98/0.94 | 0.50/0.39 | 0.34/0.26 | 0.78/0.91 | 0.88/0.90 | 0.47/0.74 | 0.69/0.81 | 0.47/0.74 | +| inside-facts-1930-cover.jpg | 0.68/0.85 | 0.90/0.91 | 1.00/0.99 | 0.97/0.94 | 0.41/0.71 | 0.65/0.50 | 0.50/0.94 | 0.98/0.93 | 0.75/0.90 | 0.63/0.88 | 0.75/0.90 | +| inside-facts-1930-page-six.jpg | 0.94/0.91 | 0.94/0.91 | 0.99/0.95 | 0.59/0.95 | 0.30/0.78 | 0.61/0.60 | 0.30/0.97 | 0.96/0.95 | 0.74/0.93 | 0.59/0.89 | 0.74/0.93 | +| kar-mi-troupe-poster.jpg | 0.01/0.00 | 0.09/0.01 | 0.99/0.98 | 0.83/0.88 | 0.12/0.39 | 0.10/0.00 | 0.27/0.38 | 0.29/0.44 | 0.03/0.00 | 0.29/0.46 | 0.29/0.46 | +| kinema-theater-ad-1920.tif | 0.45/0.40 | 0.45/0.40 | 0.75/0.98 | 0.98/0.97 | 0.42/0.67 | 0.43/0.33 | 0.49/0.93 | 0.74/0.92 | 0.93/0.87 | 0.88/0.91 | 0.93/0.87 | +| king-of-kings-souvenir-1927.pdf | 0.91/0.94 | 0.91/0.94 | 0.93/0.97 | 0.89/0.94 | N/A | N/A | N/A | 0.89/0.90 | 0.87/0.92 | N/A | 0.87/0.92 | +| over-the-fence-poster.jpg | 0.19/0.14 | 0.40/0.18 | 0.77/0.82 | 0.95/0.82 | 0.49/0.23 | 0.27/0.14 | 0.64/0.45 | 0.39/0.36 | 0.19/0.00 | 0.54/0.45 | 0.64/0.45 | +| parlor-match-poster.jpg | 0.00/0.00 | 0.14/0.03 | 1.00/1.00 | 0.98/0.88 | 0.67/0.44 | 0.24/0.00 | 0.68/0.31 | 0.88/0.72 | 0.76/0.75 | 0.79/0.66 | 0.79/0.66 | +| thurston-magician-poster.jpg | 0.08/0.04 | 0.26/0.26 | 0.99/0.96 | 0.76/0.63 | 0.74/0.52 | 0.12/0.00 | 0.74/0.44 | 0.73/0.63 | 0.72/0.52 | 0.62/0.52 | 0.72/0.52 | +| **Average** | **0.44/0.38** | **0.56/0.47** | **0.93/0.91** | **0.86/0.84** | **0.57/0.52** | **0.44/0.16** | **0.56/0.54** | **0.72/0.66** | **0.50/0.50** | **0.67/0.68** | **0.66/0.65** | +| **Total seconds** | **48.2** | **48.3** | **333.9** | **122.3** | **40.8** | **51.4** | **344.0** | **2481.4** | **1383.3** | **16.1** | **1811.0** | diff --git a/evaluation/ocr/benchmark_claude_haiku.csv b/evaluation/ocr/benchmark_claude_haiku.csv new file mode 100644 index 0000000..626fad9 --- /dev/null +++ b/evaluation/ocr/benchmark_claude_haiku.csv @@ -0,0 +1,19 @@ +fixture,char_sim,word_recall,seconds +bancroft-magician-poster.jpg,0.5759,0.6364,2.29 +carthay-circle-postcard-back.png,0.9728,0.9167,3.05 +carthay-circle-premiere.jpg,0.8939,0.9286,1.67 +chinese-theatre-triptych-postcard.jpg,0.9469,1.0000,1.56 +graumans-chinese-theatre.jpg,0.8333,0.6250,3.02 +greek-theatre-night.jpg,1.0000,1.0000,1.85 +hollywood-boulevard-east.jpg,0.7328,0.6111,2.19 +hollywood-boulevard-west.jpg,0.7989,0.6333,4.43 +hollywood-music-box-playbill-1926.tif,0.9763,0.9431,8.68 +inside-facts-1930-cover.jpg,0.9736,0.9402,6.61 +inside-facts-1930-page-six.jpg,0.5926,0.9452,17.32 +kar-mi-troupe-poster.jpg,0.8287,0.8792,4.28 +kinema-theater-ad-1920.tif,0.9847,0.9661,9.75 +king-of-kings-souvenir-1927.pdf,0.8858,0.9411,46.95 +over-the-fence-poster.jpg,0.9517,0.8182,3.37 +parlor-match-poster.jpg,0.9796,0.8750,1.95 +thurston-magician-poster.jpg,0.7626,0.6296,3.26 +Average,0.8641,0.8405,122.25 diff --git a/evaluation/ocr/benchmark_claude_haiku.md b/evaluation/ocr/benchmark_claude_haiku.md new file mode 100644 index 0000000..2f74123 --- /dev/null +++ b/evaluation/ocr/benchmark_claude_haiku.md @@ -0,0 +1,24 @@ +# OCR Accuracy — claude-haiku + +Scores against Claude-generated ground truth (`claude-opus-4-8`). + +| Fixture | Char Sim | Word Recall | Seconds | +|---|---:|---:|---:| +| bancroft-magician-poster.jpg | 0.576 | 0.636 | 2.29 | +| carthay-circle-postcard-back.png | 0.973 | 0.917 | 3.05 | +| carthay-circle-premiere.jpg | 0.894 | 0.929 | 1.67 | +| chinese-theatre-triptych-postcard.jpg | 0.947 | 1.000 | 1.56 | +| graumans-chinese-theatre.jpg | 0.833 | 0.625 | 3.02 | +| greek-theatre-night.jpg | 1.000 | 1.000 | 1.85 | +| hollywood-boulevard-east.jpg | 0.733 | 0.611 | 2.19 | +| hollywood-boulevard-west.jpg | 0.799 | 0.633 | 4.43 | +| hollywood-music-box-playbill-1926.tif | 0.976 | 0.943 | 8.68 | +| inside-facts-1930-cover.jpg | 0.974 | 0.940 | 6.61 | +| inside-facts-1930-page-six.jpg | 0.593 | 0.945 | 17.32 | +| kar-mi-troupe-poster.jpg | 0.829 | 0.879 | 4.28 | +| kinema-theater-ad-1920.tif | 0.985 | 0.966 | 9.75 | +| king-of-kings-souvenir-1927.pdf | 0.886 | 0.941 | 46.95 | +| over-the-fence-poster.jpg | 0.952 | 0.818 | 3.37 | +| parlor-match-poster.jpg | 0.980 | 0.875 | 1.95 | +| thurston-magician-poster.jpg | 0.763 | 0.630 | 3.26 | +| **Average** | **0.864** | **0.841** | **122.25 total** | diff --git a/evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.csv b/evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.csv new file mode 100644 index 0000000..626fad9 --- /dev/null +++ b/evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.csv @@ -0,0 +1,19 @@ +fixture,char_sim,word_recall,seconds +bancroft-magician-poster.jpg,0.5759,0.6364,2.29 +carthay-circle-postcard-back.png,0.9728,0.9167,3.05 +carthay-circle-premiere.jpg,0.8939,0.9286,1.67 +chinese-theatre-triptych-postcard.jpg,0.9469,1.0000,1.56 +graumans-chinese-theatre.jpg,0.8333,0.6250,3.02 +greek-theatre-night.jpg,1.0000,1.0000,1.85 +hollywood-boulevard-east.jpg,0.7328,0.6111,2.19 +hollywood-boulevard-west.jpg,0.7989,0.6333,4.43 +hollywood-music-box-playbill-1926.tif,0.9763,0.9431,8.68 +inside-facts-1930-cover.jpg,0.9736,0.9402,6.61 +inside-facts-1930-page-six.jpg,0.5926,0.9452,17.32 +kar-mi-troupe-poster.jpg,0.8287,0.8792,4.28 +kinema-theater-ad-1920.tif,0.9847,0.9661,9.75 +king-of-kings-souvenir-1927.pdf,0.8858,0.9411,46.95 +over-the-fence-poster.jpg,0.9517,0.8182,3.37 +parlor-match-poster.jpg,0.9796,0.8750,1.95 +thurston-magician-poster.jpg,0.7626,0.6296,3.26 +Average,0.8641,0.8405,122.25 diff --git a/evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.md b/evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.md new file mode 100644 index 0000000..3f33497 --- /dev/null +++ b/evaluation/ocr/runs/2026-10-16_234922_c40183e_claude_haiku.md @@ -0,0 +1,27 @@ +# OCR Accuracy — claude-haiku + +**Date:** 2026-10-16 +**Git commit:** `c40183e` + +Scores against Claude-generated ground truth (`claude-opus-4-8`). + +| Fixture | Char Sim | Word Recall | Seconds | +|---|---:|---:|---:| +| bancroft-magician-poster.jpg | 0.576 | 0.636 | 2.29 | +| carthay-circle-postcard-back.png | 0.973 | 0.917 | 3.05 | +| carthay-circle-premiere.jpg | 0.894 | 0.929 | 1.67 | +| chinese-theatre-triptych-postcard.jpg | 0.947 | 1.000 | 1.56 | +| graumans-chinese-theatre.jpg | 0.833 | 0.625 | 3.02 | +| greek-theatre-night.jpg | 1.000 | 1.000 | 1.85 | +| hollywood-boulevard-east.jpg | 0.733 | 0.611 | 2.19 | +| hollywood-boulevard-west.jpg | 0.799 | 0.633 | 4.43 | +| hollywood-music-box-playbill-1926.tif | 0.976 | 0.943 | 8.68 | +| inside-facts-1930-cover.jpg | 0.974 | 0.940 | 6.61 | +| inside-facts-1930-page-six.jpg | 0.593 | 0.945 | 17.32 | +| kar-mi-troupe-poster.jpg | 0.829 | 0.879 | 4.28 | +| kinema-theater-ad-1920.tif | 0.985 | 0.966 | 9.75 | +| king-of-kings-souvenir-1927.pdf | 0.886 | 0.941 | 46.95 | +| over-the-fence-poster.jpg | 0.952 | 0.818 | 3.37 | +| parlor-match-poster.jpg | 0.980 | 0.875 | 1.95 | +| thurston-magician-poster.jpg | 0.763 | 0.630 | 3.26 | +| **Average** | **0.864** | **0.841** | **122.25 total** | diff --git a/evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.csv b/evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.csv new file mode 100644 index 0000000..e2a55ea --- /dev/null +++ b/evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.csv @@ -0,0 +1,19 @@ +fixture,tesseract_chr,tesseract_wrd,tesseract_sec,tesseract-auto_chr,tesseract-auto_wrd,tesseract-auto_sec,claude_chr,claude_wrd,claude_sec,claude-haiku_chr,claude-haiku_wrd,claude-haiku_sec,easyocr_chr,easyocr_wrd,easyocr_sec,easyocr-hy_chr,easyocr-hy_wrd,easyocr-hy_sec,paddle_chr,paddle_wrd,paddle_sec,paddle-vl_chr,paddle-vl_wrd,paddle-vl_sec,marker_chr,marker_wrd,marker_sec,vision_chr,vision_wrd,vision_sec,auto-local_chr,auto-local_wrd,auto-local_sec +bancroft-magician-poster.jpg,0.0723,0.0000,0.46,0.2846,0.0000,0.34,0.7165,0.7727,3.92,0.5759,0.6364,2.29,0.3970,0.1364,3.00,0.1750,0.0000,3.95,0.5467,0.3182,10.86,0.3084,0.1364,23.14,0.1658,0.0000,8.94,0.5692,0.4091,0.95,0.5692,0.4091,15.13 +carthay-circle-postcard-back.png,0.5950,0.5000,0.43,0.9256,0.7917,0.48,0.9766,0.9167,6.21,0.9728,0.9167,3.05,0.7860,0.6250,0.41,0.4874,0.0833,0.42,0.2844,0.6250,7.23,0.6780,0.7917,21.24,0.6640,0.6250,5.65,0.6535,0.8333,0.55,0.9256,0.7917,16.79 +carthay-circle-premiere.jpg,0.0000,0.0000,0.20,0.5141,0.8571,0.47,0.8939,0.9286,2.39,0.8939,0.9286,1.67,0.8701,0.7143,0.35,0.7444,0.2857,0.27,0.0885,0.0000,6.79,0.8827,0.8571,18.12,0.7562,0.8571,5.60,0.8939,0.9286,0.47,0.5141,0.8571,15.29 +chinese-theatre-triptych-postcard.jpg,0.4444,0.4000,0.30,0.4444,0.4000,0.32,1.0000,1.0000,2.19,0.9469,1.0000,1.56,0.5044,0.6667,0.29,0.4622,0.0000,0.35,0.7850,0.7333,6.03,0.8290,0.8667,13.71,0.4472,0.4667,4.38,0.6578,0.9333,0.50,0.4472,0.4667,13.16 +graumans-chinese-theatre.jpg,0.6587,0.4375,0.27,0.7933,0.4375,0.28,0.8750,0.5625,2.41,0.8333,0.6250,3.02,0.7168,0.5000,0.31,0.6092,0.0625,0.31,0.7386,0.1875,6.30,0.7179,0.3125,16.61,0.0960,0.0000,5.39,0.7342,0.3750,0.46,0.7342,0.3750,13.52 +greek-theatre-night.jpg,0.9048,0.7500,0.27,0.9048,0.7500,0.29,1.0000,1.0000,2.37,1.0000,1.0000,1.85,0.9486,0.7500,0.30,0.7907,0.0000,0.28,0.9114,0.5000,4.32,0.9882,0.9167,15.11,0.7387,1.0000,5.39,0.9829,1.0000,0.46,0.7387,1.0000,12.34 +hollywood-boulevard-east.jpg,0.6311,0.3333,0.30,0.6184,0.3333,0.31,0.9286,0.8333,2.76,0.7328,0.6111,2.19,0.7240,0.4444,0.28,0.6484,0.1667,0.28,0.6352,0.4444,7.42,0.6537,0.3889,10.97,0.1111,0.0000,5.56,0.6825,0.3889,0.54,0.6825,0.3889,15.46 +hollywood-boulevard-west.jpg,0.4161,0.2667,0.28,0.4161,0.2667,0.29,0.9577,0.8333,3.55,0.7989,0.6333,4.43,0.5660,0.3000,0.30,0.4177,0.1667,0.35,0.5759,0.4333,6.40,0.4949,0.2667,17.93,0.0806,0.0000,6.81,0.5333,0.4333,0.50,0.4161,0.2667,14.76 +hollywood-music-box-playbill-1926.tif,0.5181,0.4569,1.04,0.5699,0.5310,1.11,0.9914,0.9603,28.12,0.9763,0.9431,8.68,0.5032,0.3948,5.70,0.3408,0.2569,7.85,0.7777,0.9086,42.61,0.8751,0.9000,170.32,0.4715,0.7362,274.70,0.6890,0.8103,1.20,0.4715,0.7362,325.30 +inside-facts-1930-cover.jpg,0.6824,0.8489,2.21,0.8966,0.9064,2.16,0.9970,0.9932,27.20,0.9736,0.9402,6.61,0.4130,0.7080,7.82,0.6490,0.5039,9.72,0.5009,0.9414,57.51,0.9798,0.9335,221.11,0.7511,0.8997,286.81,0.6320,0.8771,2.25,0.7511,0.8997,349.55 +inside-facts-1930-page-six.jpg,0.9409,0.9060,4.86,0.9409,0.9060,4.88,0.9941,0.9517,63.99,0.5926,0.9452,17.32,0.3013,0.7778,17.70,0.6093,0.6038,21.47,0.2953,0.9693,132.41,0.9620,0.9462,612.47,0.7382,0.9301,308.03,0.5942,0.8914,4.17,0.7382,0.9301,461.41 +kar-mi-troupe-poster.jpg,0.0143,0.0048,0.30,0.0890,0.0145,0.39,0.9872,0.9758,11.16,0.8287,0.8792,4.28,0.1239,0.3913,0.71,0.0967,0.0000,1.04,0.2741,0.3816,9.22,0.2874,0.4396,27.04,0.0264,0.0000,2.91,0.2857,0.4638,0.82,0.2857,0.4638,16.80 +kinema-theater-ad-1920.tif,0.4506,0.3983,0.77,0.4506,0.3983,0.81,0.7537,0.9788,17.32,0.9847,0.9661,9.75,0.4175,0.6653,2.73,0.4324,0.3263,3.80,0.4907,0.9280,26.28,0.7429,0.9195,126.50,0.9319,0.8686,23.24,0.8837,0.9068,1.14,0.9319,0.8686,58.29 +king-of-kings-souvenir-1927.pdf,0.9120,0.9443,35.50,0.9120,0.9443,35.24,0.9309,0.9664,150.72,0.8858,0.9411,46.95,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,0.8921,0.9007,1128.65,0.8703,0.9239,423.31,N/A,N/A,N/A,0.8703,0.9239,431.60 +over-the-fence-poster.jpg,0.1863,0.1364,0.33,0.3959,0.1818,0.31,0.7737,0.8182,2.97,0.9517,0.8182,3.37,0.4896,0.2273,0.26,0.2737,0.1364,0.33,0.6355,0.4545,6.48,0.3877,0.3636,14.65,0.1868,0.0000,3.17,0.5373,0.4545,0.62,0.6355,0.4545,12.89 +parlor-match-poster.jpg,0.0000,0.0000,0.36,0.1415,0.0312,0.30,1.0000,1.0000,3.45,0.9796,0.8750,1.95,0.6687,0.4375,0.40,0.2405,0.0000,0.58,0.6806,0.3125,7.88,0.8827,0.7188,25.74,0.7560,0.7500,7.04,0.7872,0.6562,0.80,0.7872,0.6562,19.29 +thurston-magician-poster.jpg,0.0833,0.0370,0.29,0.2555,0.2593,0.34,0.9884,0.9630,3.20,0.7626,0.6296,3.26,0.7353,0.5185,0.26,0.1250,0.0000,0.38,0.7372,0.4444,6.30,0.7310,0.6296,18.05,0.7159,0.5185,6.37,0.6237,0.5185,0.63,0.7159,0.5185,19.40 +Average,0.4418,0.3777,48.17,0.5620,0.4711,48.32,0.9273,0.9091,333.93,0.8641,0.8405,122.25,0.5728,0.5161,40.82,0.4439,0.1620,51.36,0.5599,0.5364,344.02,0.7231,0.6640,2481.36,0.5005,0.5045,1383.30,0.6712,0.6800,16.05,0.6597,0.6475,1811.01 diff --git a/evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.md b/evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.md new file mode 100644 index 0000000..fe6cbeb --- /dev/null +++ b/evaluation/ocr/runs/2026-10-16_234922_c40183e_merge-claude-haiku.md @@ -0,0 +1,29 @@ +# OCR Accuracy Benchmark + +**Date:** 2026-10-16 +**Git commit:** `c40183e` +**Merged:** `claude-haiku` measured on its own; every other column carried over from the previous run + +Scores: character similarity / word recall against Claude-generated ground truth (`claude-opus-4-8`). + +| Fixture | tesseract | tesseract-auto | claude | claude-haiku | easyocr | easyocr-hy | paddle | paddle-vl | marker | vision | auto-local | +|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:| +| bancroft-magician-poster.jpg | 0.07/0.00 | 0.28/0.00 | 0.72/0.77 | 0.58/0.64 | 0.40/0.14 | 0.17/0.00 | 0.55/0.32 | 0.31/0.14 | 0.17/0.00 | 0.57/0.41 | 0.57/0.41 | +| carthay-circle-postcard-back.png | 0.59/0.50 | 0.93/0.79 | 0.98/0.92 | 0.97/0.92 | 0.79/0.62 | 0.49/0.08 | 0.28/0.62 | 0.68/0.79 | 0.66/0.62 | 0.65/0.83 | 0.93/0.79 | +| carthay-circle-premiere.jpg | 0.00/0.00 | 0.51/0.86 | 0.89/0.93 | 0.89/0.93 | 0.87/0.71 | 0.74/0.29 | 0.09/0.00 | 0.88/0.86 | 0.76/0.86 | 0.89/0.93 | 0.51/0.86 | +| chinese-theatre-triptych-postcard.jpg | 0.44/0.40 | 0.44/0.40 | 1.00/1.00 | 0.95/1.00 | 0.50/0.67 | 0.46/0.00 | 0.79/0.73 | 0.83/0.87 | 0.45/0.47 | 0.66/0.93 | 0.45/0.47 | +| graumans-chinese-theatre.jpg | 0.66/0.44 | 0.79/0.44 | 0.88/0.56 | 0.83/0.62 | 0.72/0.50 | 0.61/0.06 | 0.74/0.19 | 0.72/0.31 | 0.10/0.00 | 0.73/0.38 | 0.73/0.38 | +| greek-theatre-night.jpg | 0.90/0.75 | 0.90/0.75 | 1.00/1.00 | 1.00/1.00 | 0.95/0.75 | 0.79/0.00 | 0.91/0.50 | 0.99/0.92 | 0.74/1.00 | 0.98/1.00 | 0.74/1.00 | +| hollywood-boulevard-east.jpg | 0.63/0.33 | 0.62/0.33 | 0.93/0.83 | 0.73/0.61 | 0.72/0.44 | 0.65/0.17 | 0.64/0.44 | 0.65/0.39 | 0.11/0.00 | 0.68/0.39 | 0.68/0.39 | +| hollywood-boulevard-west.jpg | 0.42/0.27 | 0.42/0.27 | 0.96/0.83 | 0.80/0.63 | 0.57/0.30 | 0.42/0.17 | 0.58/0.43 | 0.49/0.27 | 0.08/0.00 | 0.53/0.43 | 0.42/0.27 | +| hollywood-music-box-playbill-1926.tif | 0.52/0.46 | 0.57/0.53 | 0.99/0.96 | 0.98/0.94 | 0.50/0.39 | 0.34/0.26 | 0.78/0.91 | 0.88/0.90 | 0.47/0.74 | 0.69/0.81 | 0.47/0.74 | +| inside-facts-1930-cover.jpg | 0.68/0.85 | 0.90/0.91 | 1.00/0.99 | 0.97/0.94 | 0.41/0.71 | 0.65/0.50 | 0.50/0.94 | 0.98/0.93 | 0.75/0.90 | 0.63/0.88 | 0.75/0.90 | +| inside-facts-1930-page-six.jpg | 0.94/0.91 | 0.94/0.91 | 0.99/0.95 | 0.59/0.95 | 0.30/0.78 | 0.61/0.60 | 0.30/0.97 | 0.96/0.95 | 0.74/0.93 | 0.59/0.89 | 0.74/0.93 | +| kar-mi-troupe-poster.jpg | 0.01/0.00 | 0.09/0.01 | 0.99/0.98 | 0.83/0.88 | 0.12/0.39 | 0.10/0.00 | 0.27/0.38 | 0.29/0.44 | 0.03/0.00 | 0.29/0.46 | 0.29/0.46 | +| kinema-theater-ad-1920.tif | 0.45/0.40 | 0.45/0.40 | 0.75/0.98 | 0.98/0.97 | 0.42/0.67 | 0.43/0.33 | 0.49/0.93 | 0.74/0.92 | 0.93/0.87 | 0.88/0.91 | 0.93/0.87 | +| king-of-kings-souvenir-1927.pdf | 0.91/0.94 | 0.91/0.94 | 0.93/0.97 | 0.89/0.94 | N/A | N/A | N/A | 0.89/0.90 | 0.87/0.92 | N/A | 0.87/0.92 | +| over-the-fence-poster.jpg | 0.19/0.14 | 0.40/0.18 | 0.77/0.82 | 0.95/0.82 | 0.49/0.23 | 0.27/0.14 | 0.64/0.45 | 0.39/0.36 | 0.19/0.00 | 0.54/0.45 | 0.64/0.45 | +| parlor-match-poster.jpg | 0.00/0.00 | 0.14/0.03 | 1.00/1.00 | 0.98/0.88 | 0.67/0.44 | 0.24/0.00 | 0.68/0.31 | 0.88/0.72 | 0.76/0.75 | 0.79/0.66 | 0.79/0.66 | +| thurston-magician-poster.jpg | 0.08/0.04 | 0.26/0.26 | 0.99/0.96 | 0.76/0.63 | 0.74/0.52 | 0.12/0.00 | 0.74/0.44 | 0.73/0.63 | 0.72/0.52 | 0.62/0.52 | 0.72/0.52 | +| **Average** | **0.44/0.38** | **0.56/0.47** | **0.93/0.91** | **0.86/0.84** | **0.57/0.52** | **0.44/0.16** | **0.56/0.54** | **0.72/0.66** | **0.50/0.50** | **0.67/0.68** | **0.66/0.65** | +| **Total seconds** | **48.2** | **48.3** | **333.9** | **122.3** | **40.8** | **51.4** | **344.0** | **2481.4** | **1383.3** | **16.1** | **1811.0** | diff --git a/site/content/reference/engines.md b/site/content/reference/engines.md index 8551fb4..0163bba 100644 --- a/site/content/reference/engines.md +++ b/site/content/reference/engines.md @@ -19,6 +19,7 @@ rather than importing it directly. | `paddle-vl` | `[paddle-vl]` | ✓ | Document vision-language model. Best local average, and slow enough to be batch-only | | `marker` | `[marker]` | ✓ | Layout-aware conversion; multi-column and PDFs | | `claude` | `[claude]` | ✓ | Anything the others cannot read | +| `claude-haiku` | `[claude]` | ✓ | Not escalation: the smaller model, measured and found short | | `auto-local` | core | ✓ | Unattended mixed material; runs several and keeps the best | See [choosing a tool](../research/in-depth/#choosing-a-tool-for-your-own-material) for which to use when, with the @@ -285,6 +286,22 @@ held at 0.96–0.98. It recovers the same words and orders them differently, whi is what an order-sensitive metric does to a document with no single reading order. +### The smaller model, `claude-haiku` + +The same backend asking Anthropic's smallest current model, at a fraction of +the price. It is its own name, as `tesseract-auto` is, so the harness scores it +beside `claude` rather than its quality being assumed from the price list. + +It is not good enough for the job `claude` does. On the fixtures where no local +engine gets close, it scores below `claude` on most of them, and the gap held +across three runs of each model, so it is not run-to-run noise. Its errors are +the costly kind for a catalogue. It leaves out the small print, such as a +lithographer's imprint or a copyright line, and sometimes puts plausible +wording in its place: a different lithographer's name, the wrong count of +swords in a sideshow act. On clean print the two models are close. Where +`claude-haiku` appears to beat `claude`, the difference is reading order, not +reading. The [benchmark](../research/in-depth/) has its column. + ## Multi-page TIFF Every backend accepts `.tif`/`.tiff`, and always did. What none of them handled diff --git a/site/data/walkthrough.toml b/site/data/walkthrough.toml index 87d5c5c..d2e1dcd 100644 --- a/site/data/walkthrough.toml +++ b/site/data/walkthrough.toml @@ -80,6 +80,9 @@ body = "Transcribing a collection by hand is not a plan. Whatever runs has to ru ## exists only to tell engines apart in charts and diagrams -- it is never used ## for interface state. tesseract and tesseract-auto share a hue because they ## are one engine, configured two ways. +## +## `ceiling = true` marks the backend that generated the ground truth, and +## `cloud = true` any other API backend. Neither is ever counted as best local. [[engine]] key = "tesseract" @@ -172,6 +175,16 @@ body = "A vision model, and the source of the reference transcripts every other best_for = "Material nothing local reads: ornamental type, multi-column" limits = "Per-page cost, an internet connection, material leaving site" +[[engine]] +key = "claude-haiku" +label = "claude-haiku" +availability = "API · paid · smaller model" +accent = "ink-soft" +cloud = true +body = "The same backend asking Anthropic's smallest current model, at a fraction of the price. Measured to answer whether it is good enough for escalation, and it is not: on the posters local engines cannot read it drops small print and substitutes plausible wording. Not local, so it is never counted as best local." +best_for = "Clean print, where a cheaper read is enough" +limits = "Drops imprints and small lines, and invents in their place" + ## --- The corpus -------------------------------------------------------------- ## `file` matches the `fixture` column in evaluation/ocr/benchmark.csv. ## `image` is the rendition base name under site/assets/images/corpus/; both a diff --git a/site/layouts/partials/benchmark.html b/site/layouts/partials/benchmark.html index 0aeaa98..233dc2f 100644 --- a/site/layouts/partials/benchmark.html +++ b/site/layouts/partials/benchmark.html @@ -64,6 +64,13 @@ "best local", exactly as the mkdocs table did. */ -}} {{- $ceiling := "claude" }} +{{- /* Nor is any other API backend local, so none of them can be "best + local" either. The walkthrough's engine table says which they are. */ -}} +{{- $notLocal := slice $ceiling }} +{{- range hugo.Data.walkthrough.engine }} + {{- if .cloud }}{{ $notLocal = $notLocal | append .key }}{{ end }} +{{- end }} +
@@ -86,7 +93,7 @@ {{- $best := -1.0 }} {{- if and $boldBest (not $isSummary) }} {{- range $backends }} - {{- if ne . $ceiling }} + {{- if not (in $notLocal .) }} {{- $v := index $row (index $col (printf "%s_chr" .)) }} {{- if ne $v "N/A" }} {{- if gt (float $v) $best }}{{ $best = (float $v) }}{{ end }} @@ -108,7 +115,7 @@ {{- $chr := index $row (index $col (printf "%s_chr" $backend)) }} {{- $wrd := index $row (index $col (printf "%s_wrd" $backend)) }} {{- $sec := index $row (index $col (printf "%s_sec" $backend)) }} - {{- $isBest := and $boldBest (not $isSummary) (ne $backend $ceiling) (ne $chr "N/A") (eq (float $chr) $best) }} + {{- $isBest := and $boldBest (not $isSummary) (not (in $notLocal $backend)) (ne $chr "N/A") (eq (float $chr) $best) }}
{{- if eq $metric "sec" -}} diff --git a/site/layouts/partials/walkthrough-scores.html b/site/layouts/partials/walkthrough-scores.html index fc03cb5..1f00845 100644 --- a/site/layouts/partials/walkthrough-scores.html +++ b/site/layouts/partials/walkthrough-scores.html @@ -25,7 +25,7 @@ {{- /* Best local score on this row. */ -}} {{- $best := -1.0 }} {{- range $engines }} - {{- if not .ceiling }} + {{- if not (or .ceiling .cloud) }} {{- $v := index $row (index $col (printf "%s_chr" .key)) }} {{- if ne $v "N/A" }}{{ if gt (float $v) $best }}{{ $best = float $v }}{{ end }}{{ end }} {{- end }} @@ -37,7 +37,7 @@ {{- range $engines }} {{- $chr := index $row (index $col (printf "%s_chr" .key)) }} {{- $wrd := index $row (index $col (printf "%s_wrd" .key)) }} - {{- $isBest := and (not .ceiling) (ne $chr "N/A") (eq (float $chr) $best) }} + {{- $isBest := and (not (or .ceiling .cloud)) (ne $chr "N/A") (eq (float $chr) $best) }}
{{ .label }}{{ if .ceiling }}*{{ end }}
diff --git a/src/tetrak_ocr/backends/claude.py b/src/tetrak_ocr/backends/claude.py index c0c9b80..1a1eed3 100644 --- a/src/tetrak_ocr/backends/claude.py +++ b/src/tetrak_ocr/backends/claude.py @@ -59,6 +59,13 @@ # The Claude model used for transcription. MODEL = "claude-opus-4-8" +# The smallest current model, behind its own backend name, `claude-haiku`. +# It is a separate name rather than a setting for the same reason +# `tesseract-auto` is: the harness then scores it beside `claude`, so whether +# it is good enough for escalation is a measurement (brief 002) rather than an +# assumption from the price list. +SMALL_MODEL = "claude-haiku-5-5" + # Maximum output tokens for one transcription. A 21-page souvenir programme # transcribes to roughly 7,000 tokens, so this leaves substantial headroom. # Anything above ~16,000 must stream — see the call site. @@ -109,11 +116,13 @@ def _to_base64(path: Path) -> tuple[str, str]: raise ValueError(f"Unsupported file type for Claude backend: {suffix}") -def ocr_image(path: Path) -> str: +def ocr_image(path: Path, model: str = MODEL) -> str: """Extract text from an image file using the Claude vision API. Args: path: Path to the image file. + model: The Claude model to ask. ``claude-haiku`` passes + :data:`SMALL_MODEL`; everything else uses :data:`MODEL`. Returns: The transcribed text as a string. @@ -154,7 +163,7 @@ def ocr_image(path: Path) -> str: # Stream: at this max_tokens a non-streaming request risks the SDK's HTTP # timeout on long documents. with client.messages.stream( - model=MODEL, + model=model, max_tokens=MAX_OUTPUT_TOKENS, messages=[ { diff --git a/src/tetrak_ocr/registry.py b/src/tetrak_ocr/registry.py index a1996d9..4d91041 100644 --- a/src/tetrak_ocr/registry.py +++ b/src/tetrak_ocr/registry.py @@ -25,6 +25,8 @@ # # tesseract / tesseract-auto — the same backend with per-image contrast and # page-segmentation detection turned on +# claude / claude-haiku — the same backend asking the smallest current +# model instead of the largest # # They are separate names rather than flags so the evaluation harness scores # them as distinct backends -- which is the only way the difference between @@ -38,6 +40,7 @@ "tesseract": ("tetrak_ocr.backends.tesseract", None, "pytesseract (core)"), "tesseract-auto": ("tetrak_ocr.backends.tesseract", None, "pytesseract (core)"), "claude": ("tetrak_ocr.backends.claude", "claude", "the 'anthropic' package"), + "claude-haiku": ("tetrak_ocr.backends.claude", "claude", "the 'anthropic' package"), "easyocr": ("tetrak_ocr.backends.easyocr", "easyocr", "the 'easyocr' package"), # Stock EasyOCR with the project's own Armenian recogniser swapped in. # Its own name, like tesseract-auto: the harness then scores it against @@ -111,6 +114,13 @@ def _auto(path: Path, **kwargs) -> str: return module.ocr_image(path, **kwargs) return _auto + if name == "claude-haiku": + # Same function, smaller model. + def _haiku(path: Path, **kwargs) -> str: + kwargs.setdefault("model", module.SMALL_MODEL) + return module.ocr_image(path, **kwargs) + + return _haiku return module.ocr_image diff --git a/tests/ocr/test_registry.py b/tests/ocr/test_registry.py index 6c38510..59bd4fb 100644 --- a/tests/ocr/test_registry.py +++ b/tests/ocr/test_registry.py @@ -30,6 +30,7 @@ def test_the_documented_backends_are_all_registered(self) -> None: "tesseract", "tesseract-auto", "claude", + "claude-haiku", "easyocr", "easyocr-hy", "paddle", @@ -106,6 +107,33 @@ def fake_ocr(path, **kwargs): get_backend("tesseract")("image.png") assert seen.get("auto") is not True + def test_claude_haiku_asks_the_small_model(self, monkeypatch: pytest.MonkeyPatch) -> None: + """`claude-haiku` is the Claude backend asking its smaller model. + + The extra is faked as installed, since CI does not install + `anthropic`, and nothing reaches the API. + """ + from tetrak_ocr.backends import claude + + seen: dict[str, object] = {} + + def fake_ocr(path, **kwargs): + seen.update(kwargs) + return "text" + + monkeypatch.setattr(claude, "_IMPORT_OK", True) + monkeypatch.setattr(claude, "ocr_image", fake_ocr) + + get_backend("claude-haiku")("image.png") + assert seen.get("model") == claude.SMALL_MODEL + assert claude.SMALL_MODEL != claude.MODEL + + def test_plain_claude_keeps_its_default_model(self, monkeypatch: pytest.MonkeyPatch) -> None: + from tetrak_ocr.backends import claude + + monkeypatch.setattr(claude, "_IMPORT_OK", True) + assert get_backend("claude") is claude.ocr_image + class TestMissingExtras: """The behaviour this module exists for. diff --git a/tools/generate_presentation.py b/tools/generate_presentation.py index cdf20ff..70a6c8e 100644 --- a/tools/generate_presentation.py +++ b/tools/generate_presentation.py @@ -105,6 +105,10 @@ def rgb(name: str, palette: dict[str, str] | None = None) -> RGBColor: # "best local" comparison, exactly as the site's benchmark table does it. CEILING = "claude" +# Every backend that is not local, the ceiling included. None of them can be +# "best local"; the site reads the same list from walkthrough.toml's `cloud`. +NOT_LOCAL = {CEILING, "claude-haiku"} + # --------------------------------------------------------------------------- # Anthropic API pricing, $ per million tokens. # SOURCE: https://platform.claude.com/docs/en/about-claude/pricing @@ -344,8 +348,8 @@ def score(row, backend) -> tuple[float, float] | None: def best_local_score(row, backends) -> float | None: - """The highest character similarity among the non-ceiling backends.""" - values = [pair[0] for b in backends if b != CEILING for pair in [score(row, b)] if pair] + """The highest character similarity among the local backends.""" + values = [pair[0] for b in backends if b not in NOT_LOCAL for pair in [score(row, b)] if pair] return max(values) if values else None @@ -359,7 +363,7 @@ def is_best_local(row, backend, best) -> bool: them would make routing look like it had lost a race it had just won -- and the site's benchmark table marks every match, so the two would disagree. """ - if backend == CEILING or best is None: + if backend in NOT_LOCAL or best is None: return False pair = score(row, backend) return pair is not None and pair[0] == best