Is my model actually better?
All six chapters, both protocol results, complete predictions and worked transfer answer. This edition loads zero scripts.
01
Better at what?
A score becomes evidence only after you say what the model will face.
Write the sentence before the number
You replace an OCR system and the reported character error rate falls. Before celebrating, ask one question: what was new to the model when it produced those predictions? A fresh page from a familiar document and a fresh document from an unfamiliar archive are different tests.
For this guide, our question is concrete: which decoder makes fewer character errors on documents whose other pages were unavailable during training? Later we will add uncertainty and ask whether the errors matter. We will use six invented documents so that every prediction can be inspected.
A useful evaluation sentence names the population, the information available at prediction time, the independent unit, the score and the intended decision. For Arabic document extraction, you might specify new documents from a defined collection, scanned pages only, grouping by originating document or writer, a declared transcription policy, and a decision about whether to replace the current system. Those choices need evidence from your actual collection; this guide supplies no such evidence.
The evaluation sentence is our synthesis of the paper’s claim and information-boundary principles. Kapoor & Narayanan · CL-001
Make the comparison repeatable
Start with the system someone could use today: the current OCR pipeline, a simple decoder, or a published method you can rerun. Record its checkpoint, inputs, preprocessing, output conversion and failure policy. Compare both systems on the same eligible items, with the same references and scorer. Report different tuning budgets or extra training data when they are part of the comparison.
A number copied from another paper may provide context. It becomes a matched baseline only when the data version, split, scorer and relevant conditions align. An OCR timeout must not quietly disappear from one model’s denominator; define how missing outputs enter scoring before running the comparison.
“Candidate minus baseline” is incomplete. Add: on which items, under which information boundary, scored in which way?
Matched comparison checklist: an application of controlling sources of benchmark variation. Bouthillier et al. · CL-007
A short refresher: learning and measuring
A training loss supplies the numerical objective used to fit a model. An evaluation metric measures a chosen property of its predictions. They can coincide, but optimizing one does not automatically improve the other—or performance on new examples.
Use training data for fitting and development data for model choices, including thresholds, normalization choices and early stopping. Keep a final test set protected until the comparison procedure is settled. If you use its errors to choose the next model, those examples have entered development; a revised claim needs fresh protected evaluation.
Our tiny experiment is a teaching bench, not an untouched final test. We inspect it freely because we make no real model-selection claim from it. First, we need to agree on how its mistakes are counted.
Preprocessing and leakage · CL-006
02
What the score counts
The denominator and the text policy are part of the result.
Count edits, then divide
Take target page A2. Its reference is 110-2; the baseline produces 11O-2. One substitution changes the letter O into the digit 0. The five-character reference therefore gives an error rate of one fifth, or 20%.
Let be a reference string, a predicted string, and the reference character count. Let count substitutions, deletions and insertions in a minimum-edit alignment. With unit cost per edit:
The denominator counts the reference, not the prediction. Insertions can make CER exceed 100%: reference a and prediction aaaa need three insertions, giving 300%. Our scorer rejects an empty reference because this simple ratio would divide by zero; a production scorer needs an explicit policy for such cases.
Definition is source-backed; examples are invented arithmetic. JiWER character scoring · CL-008
What is a “character” here?
Our lab counts Unicode code points, preserves punctuation and whitespace, and performs no normalization. The page suffix counts too. A visible mark can contain several code points, so this is a declared scoring convention, not a universal definition of a human-perceived character.
For Arabic OCR, decide whether diacritics, punctuation, spacing and letter distinctions must be preserved for the task. Unicode canonical normalization can make equivalent encodings comparable; deleting diacritics is a separate task policy. Silently changing either policy can change the score without changing a prediction.
Keep the raw outputs and apply the same frozen transformation to both systems and references. A predetermined normalization rule is different from learning a vocabulary, imputer or scaler from held-out data.
Unicode normalization · CL-009
Characters or documents?
Our six target pages contain 49 reference characters. In the disjoint-document protocol, the baseline makes 17 edits and the candidate makes 20. Adding edits first produces 34.69% versus 40.82% corpus CER. These are deterministic outputs of the invented fixture, not OCR benchmark results.
Let be total edits and reference characters for document . With documents:
Corpus CER gives a longer document more influence. The document mean gives each document one vote after combining its pages. In this fixture the document means are 31.11% versus 41.39%. Neither weighting is automatically fairer: choose whether your decision is about a typical reference character or a typical document, and state how the sample represents that population.
Here each document contributes one target page. In a real collection with many pages per document, ten pages can improve measurement of one document without creating ten independent documents.
The weighting relationship follows directly from the definitions. Numbers come from LAB-001. We use document means for the paired uncertainty example.
03
Who crossed the split?
Look for shared information, not just separate row numbers.
A new page can carry an old answer
Every invented document has two pages with the same body and a different page suffix. A1 is 110-1; A2 is 110-2. They are different strings. Yet seeing the labeled first page can disclose almost the entire answer to the second.
110-1110-21110-11110-21100-11100-2Same document body crosses the boundary.
Different page IDs do not make a new document.
Three of six sibling pairs shown. A2–F2 stay fixed in the lab; disjoint training replaces A1–F1 with G1–L1.
If deployment means unseen documents, hold all members of an evaluation document out of training. If deployment means unseen writers, organizations or templates, document grouping alone may still share information that your claim requires to be new. The right unit follows the question and the collection’s provenance.
Previous pages may be legitimate inputs in a product that explicitly supplies them at prediction time. Then evaluate that product under that information policy. Our lab labels sibling exposure inappropriate because its question requires new documents.
Grouped cross-validation · CL-003
Check identity, similarity and origin
An exact file hash can catch identical bytes across partitions. It will miss a re-encoded image, a different crop, or a new scan of the same page. Text equality can catch some repeated content; near-match retrieval can surface more candidates. Review those candidates alongside document IDs, source records and collection dates.
For OCR, inspect whether a “different” PDF is a second copy of the same report or whether a preprocessed crop came from a held-out original. Define duplicate policy before final evaluation and keep related records together when the deployment question requires it. Record what the search could not detect.
Near-duplicate research on image benchmarks motivates this audit, but it does not validate a universal OCR detector. No matches found is not proof of independence.
Barz & Denzler · CL-004
The boundary also surrounds preprocessing
A clean file split can still leak. Suppose feature selection uses all labels before the split, or an imputer estimates its values from all records. Held-out information has already shaped the transformation, even if the final estimator sees only training rows.
- Choose the split units and assign partitions.
- Fit learned transformations and the model using only the training part of that fold.
- Apply those fitted transformations to development examples; choose settings there.
- Freeze the procedure, then evaluate on the protected test set.
When cross-validating, repeat fitting inside each training fold. A pipeline helps preserve that order, but it cannot choose valid group IDs or notice that a feature was unavailable at deployment time. Those are design decisions.
Preprocessing and leakage · CL-005
Kapoor and Narayanan’s leakage taxonomy is broader than duplicate files: it includes broken separation, illegitimate features, and test data that do not support the claimed distribution. We will now isolate one transparent shortcut.
Kapoor & Narayanan · CL-002
04
The comparison lab
Same six targets. Same scorer. Change what training reveals.
Two decoders you can inspect
This is a synthetic symbolic OCR analogue. It does not read pixels. We corrupt body digits 1 → l and 0 → O, leaving the page suffix unchanged. The baseline repairs every lowercase l to 1. The candidate repairs O to 0, and can also remember a labeled document body from training.
The candidate uses the document ID as a lookup key. If it has a template, it copies that body and appends the observed page suffix. Otherwise it uses its generic substitution rule. A template is learned only from admitted training labels; target references are used only for scoring.
Both protocols admit six training pages with matched reference lengths. Disjoint training uses G1–L1. Sibling-exposed training uses A1–F1. The targets remain A2–F2 throughout. The actual training content changes; the contrast is a deliberately constructed mechanism, not a measured causal effect for a real learned model.
LAB-001 · Every string and rule is invented and shipped in the canonical model.
Predict, switch, inspect
Before switching, predict: will the candidate’s template shortcut still work when training contains no document A–F? Compare the candidate string for A2 in both states. Then look at E2: is the overall loser worse on every document?
What crosses the split?
Synthetic strings, symbolic decoders. These scores do not describe a real OCR model.
Disjoint documents: 0 shared document IDs. Baseline 34.69%; candidate 40.82% corpus CER.
TrainingG1 · H1 · I1 · J1 · K1 · L1
Fixed targetsA2 · B2 · C2 · D2 · E2 · F2
Equal-document mean: baseline 31.11%; candidate 41.39%. Difference +10.28 pp.
A2 · trace the shortcut
- Observed
llO-2- Reference
110-2- Baseline
11O-2· 1 edit- Candidate
ll0-2· 2 edits
No A template exists. The candidate repairs O→0 and leaves both lowercase l characters.
| Training | Baseline corpus CER | Candidate corpus CER |
|---|---|---|
| Disjoint documents | 34.69% | 40.82% |
| Sibling pages | 34.69% | 0.00% |
New-document question; same targets, references and raw-codepoint scorer. Corpus bars use a shared 0–100% axis for this fixture only; CER can exceed 100% in general. Resampling cannot fix sibling exposure.
With siblings admitted, the candidate reproduces all target bodies. With disjoint documents, it falls back to its generic rule. The baseline never uses training templates, so its predictions and score do not move. The scorer has faithfully measured two different information conditions.
The lesson is not that group splitting always lowers scores, or that all template use is wrong. It is that the test’s information condition must match the intended deployment question.
Open the full record
These records expose the observed string, reference, both predictions, edit counts and reference lengths. In the sibling-exposed protocol the candidate prediction is exactly the reference for every target; the baseline is unchanged. Nothing is inferred from a hidden model call.
A2 · 5 reference characters
- Observed
llO-2- Reference
110-2- Baseline · both protocols
11O-21 edits · 20.00%- Candidate · disjoint
ll0-22 edits · 40.00%- Candidate · sibling
110-20 edits · 0.00%
B2 · 6 reference characters
- Observed
lllO-2- Reference
1110-2- Baseline · both protocols
111O-21 edits · 16.67%- Candidate · disjoint
lll0-23 edits · 50.00%- Candidate · sibling
1110-20 edits · 0.00%
C2 · 6 reference characters
- Observed
llOO-2- Reference
1100-2- Baseline · both protocols
11OO-22 edits · 33.33%- Candidate · disjoint
ll00-22 edits · 33.33%- Candidate · sibling
1100-20 edits · 0.00%
D2 · 8 reference characters
- Observed
llllOO-2- Reference
111100-2- Baseline · both protocols
1111OO-22 edits · 25.00%- Candidate · disjoint
llll00-24 edits · 50.00%- Candidate · sibling
111100-20 edits · 0.00%
E2 · 12 reference characters
- Observed
lOOOOOOOOO-2- Reference
1000000000-2- Baseline · both protocols
1OOOOOOOOO-29 edits · 75.00%- Candidate · disjoint
l000000000-21 edits · 8.33%- Candidate · sibling
1000000000-20 edits · 0.00%
F2 · 12 reference characters
- Observed
llllllllOO-2- Reference
1111111100-2- Baseline · both protocols
11111111OO-22 edits · 16.67%- Candidate · disjoint
llllllll00-28 edits · 66.67%- Candidate · sibling
1111111100-20 edits · 0.00%
To reproduce both protocols, run node lab/run.mjs from the project folder. The canonical model (local copy) is shared by the browser and the runnable lab. Its edit-distance routine and resampling checks are included. Now we can ask a different question: how much of a comparison depends on which documents happened to be sampled?
05
How uncertain is the comparison?
More decimal places do not create more independent evidence.
Keep the pair together
Use the disjoint-document output. For document , let be the candidate’s CER and the baseline’s. Define the paired difference:
A negative difference favors the candidate because fewer errors are better. Multiply by 100 to express percentage points, not relative percent improvement. Pairing means each comparison uses the same document and reference, rather than comparing one model’s easy examples with another’s hard ones.
Candidate minus baseline CER, percentage points. Left of zero favors the candidate; right favors the baseline.
Equal-document mean: +10.28 pp.
Illustrative 95% percentile bootstrap interval: -22.50 pp to +35.28 pp. Six invented documents; population coverage is uncalibrated.
The mean is +10.28 percentage points: the candidate is worse on this synthetic document mean. E2 strongly favors the candidate, C2 ties, and the remaining four favor the baseline. A single average conceals that structure.
Paired differences and their mean are algebraic derivations from LAB-001. This is descriptive evidence about the fixture only.
Resample the evidence you actually have
Imagine sampling document IDs with replacement. A draw such as A, A, C, D, E, F repeats A’s entire candidate–baseline pair twice and omits B. Recompute the mean difference. Repeating this process shows how the empirical comparison changes when the observed documents receive different sampling weights.
Our tiny lab enumerates every ordered six-draw sample: . It takes the 2.5th and 97.5th percentiles of their means, using a declared linear-interpolation convention. The resulting illustrative 95% percentile bootstrap interval is −22.50 to +35.28 percentage points.
This interval has no calibrated coverage claim for real OCR: the documents were invented, there are only six, and the resampling model assumes independent, representative document contributions. Exact enumeration removes Monte Carlo noise. It does not make population coverage exact, create new documents or repair contamination.
In a real multi-page sample, retain the document’s pages and both models’ predictions together when the document is the independent unit. If documents share writers or sites, a broader or hierarchical design may be needed. A bootstrap that treats correlated pages as independent asks a different sampling question.
The paired construction is source-backed. The tiny exhaustive enumerator and quantile convention are declared local choices. SciPy bootstrap documentation · CL-012 CL-013
Two ways a result can move
Sample uncertainty: the same fitted models could receive a different set of deployment documents. Our fixed-prediction resampling illustrates that question.
Training variability: a training procedure could produce different fitted models because of initialization, data order, augmentation or other randomness. Rerunning seeds on the same split investigates those choices conditional on that data. It does not supply new test documents.
A real evaluation may need both. Preserve the run-by-document record and describe the analysis rather than pooling every seed–page result as an independent observation. This lab has no stochastic training, so it measures no seed variability.
Bouthillier et al. · CL-014
Inconclusive does not mean equal
An interval spanning zero can be consistent with both improvement and harm under its assumptions. The toy interval is especially limited; we do not turn it into a significance test. More generally, failing to detect a difference is not evidence that two systems are equivalent.
Equivalence asks whether differences are small enough to ignore for a declared purpose. That requires a justified margin set before inspecting the result and an appropriate analysis. We do not implement an equivalence test here.
Lakens on equivalence · CL-016
Statistical significance also says little by itself about practical value. A tiny consistent change may not justify deployment cost; an uncertain estimate may still include consequential harm. Report the effect, uncertainty, error types and decision context together.
ASA statement · CL-015
06
From score to decision
Inspect what failed, preserve what was tested, and narrow the claim.
The average points you toward questions
Return to E2. Its body contains many zeros. The candidate repairs those O-shaped corruptions, while the baseline leaves them. F2 contains many ones and reverses that advantage. The error pattern follows the decoders’ rules; the overall winner depends partly on the document mix.
For real Arabic OCR, inspect substitutions, missing lines, reading order, diacritics, tables and critical numeric fields. Predefine useful slices where possible and report each slice’s size. A low overall CER does not establish that account numbers, units or totals are reliable. An error in one important field can matter differently from an error in prose; that importance needs a stated task policy.
Use development errors to revise the model. If final-test errors reveal a new direction, treat that as a new development cycle and preserve the original final result as historical evidence. Repeatedly looking at the same test is not a fresh confirmation.
The OCR error checklist is a practical application; it is not a claim about observed user-model failures. Preprocessing and leakage · CL-006
Write a claim someone can challenge
A defensible record names the deployment question; collection and split provenance; group and duplicate policy; baseline and candidate versions; fitted preprocessing boundary; fixed scorer and denominators; full predictions; aggregate and paired effects; uncertainty method; and important failures.
In our fixture the claim is narrow: with six disjoint training documents and the declared symbolic rules, the baseline has lower corpus and document-mean CER on A2–F2. Allowing sibling templates changes the candidate’s predictions and reverses that ranking. This proves the stated arithmetic and mechanism. It does not select an OCR system for anyone.
For a real project, finish with the decision the evidence supports—and the evidence still needed. “No detected difference,” “better on this sample,” “equivalent within a margin” and “useful enough to deploy” are distinct conclusions.
Transfer: windows from a disturbance
A power-system fault classifier sees overlapping waveform windows. One disturbance appears at several feeders. A proposed benchmark randomly splits windows, fits a scaler on the full dataset, balances the test set to 50% faults, and reports five training seeds. Deployment will see future disturbances on feeders absent from training.
Choose the evaluation design. Which records must stay together? Which time and feeder boundaries matter? When is the scaler fitted? Which baseline and metrics would make the comparison useful? What uncertainty do five seeds leave unresolved?
Work through the changed case
Trace each window back to its disturbance and feeder. Windows from the same disturbance must not leak across training and evaluation when the claim is about new disturbances. An unseen-feeder split alone may still share the same event through another feeder. Future deployment also requires a time boundary; a group label does not enforce chronology.
Construct partitions that honor the joint event, time and feeder claim, and report if the available data cannot support it. Fit the scaler within training only. Check that every feature exists at the actual prediction time. Choose an existing detector or a simple stated rule as a baseline and give both models the same eligible event record.
Report missed faults and false alarms with denominators and a threshold fixed on development data. If the evaluation is artificially balanced, its predictive-value interpretation may not match deployment prevalence. Keep event-level outcomes visible so overlapping windows do not dominate the apparent sample size. The exact metric and acceptable tradeoff need a domain decision; no threshold is prescribed here.
Five seeds describe some training variability on the chosen dataset. They leave uncertainty about new events, feeders and deployment conditions. Group-aware uncertainty can only reuse the evidence present; it cannot manufacture missing disturbance types or repair a contaminated split.
This is a design exercise inferred from grouping, temporal validation and information-availability principles. It is not a tested power-system result or operating recommendation.
Time-aware validation · CL-018
The next useful question is precise: what new, independent evidence could change this decision? That question keeps the model comparison open to correction.
Glossary
- Independent unit
- The entity whose new occurrence the evaluation treats as new evidence; document, writer, site or event may be appropriate under different claims.
- CER
- Minimum character edit count divided by nonempty reference length. Our characters are raw Unicode code points.
- Percentage point
- An absolute difference on a percentage scale: 40% minus 30% is +10 percentage points.
- Paired difference
- Candidate CER minus baseline CER for the same document. Negative favors the candidate.
- Empirical bootstrap
- Resample the observed units with replacement. Its assumptions and the chosen statistic determine the question it approximates.
- Development versus test
- Development guides choices. A protected test evaluates the frozen procedure. Inspecting a test to revise the model consumes that boundary.
- Unresolved here
- Any actual OCR performance, power-system usefulness, real-population uncertainty, or measured learning effectiveness.
Read the evidence and reproduce the lab
Primary publications and official documentation were inspected on 4 September 2026. Links near the prose identify supporting claims. The source notes distinguish published indexed text from readable author preprints where direct publication pages were blocked. No source provides the toy’s numeric outcomes.
From the full project folder, run node lab/run.mjs to print both results; run node lab/check.mjs to verify the recorded output. The website’s downloadable CLI copy uses the same model. No data download, random source, learned neural weights or external inference call is used.
The bootstrap enumerates six-to-the-six ordered resamples. It computes the equal-document paired mean, using linear interpolation at index (M−1)p for sorted bootstrap means. Values shown as percentages are rounded to two decimals. The model supports none or NFC normalization explicitly; all fixture scores use none.