Writings

When your extractor's own score lies

· 2 min read

Likhit turns Nepali government PDFs into clean text. In an earlier post I explained why we fix the font's character map instead of using OCR or an LLM. This one is about the harder question: how do you know a transcript is right, across hundreds of thousands of pages nobody will ever read by hand?

a benchmark of real documents

The public benchmark is 25 documents: 18 real government documents and 7 synthetic ones, mostly PDFs plus a few Word files. They're chosen to cover each way extraction goes wrong, from older keyboard fonts to cut-down fonts to scans hiding behind a fake text layer.

Each document runs three ways: with no OCR, with a hosted vision model for OCR, and with a local one (qwen2.5vl:7b). Every run is recorded, so a change shows up as a difference against the last snapshot. The headline today: 13 of the 16 published documents convert correctly without a single OCR call.

the score that preferred garbage

Likhit picks between extraction attempts using a quality score: points for Devanagari characters and real words, penalties for signs of damage. It worked well, until a comparison showed it rating a garbled transcript higher than the correct one.

The garbled version had slightly more Devanagari characters, 4,206 against 4,188, so it scored better. But it also had 172 vowel signs stranded with no letter to attach to, against 3 in the correct one. More Devanagari isn't better Devanagari.

So the benchmark no longer trusts the score alone. A change only passes if it doesn't increase malformed Devanagari, a count that's hard to fake and easy to check.

worst damage, not average damage

Transcripts are also audited on eight separate kinds of damage, like leftover keyboard-font text, lost marks, broken numbers and odd spacing. The first version averaged them, and thousands of documents scored as clean while real damage hid inside them. One was 97.7% correct Devanagari, with a first line that was still keyboard-font garbage.

Now the verdict is the worst of the eight. A transcript is only as clean as its most damaged part.

Not every check gets a vote. One check for damaged vowel signs was right 98.6% of the time, but 96.6% of what it found was already caught by another check. It stays as advice rather than counting toward the verdict, so the same problem isn't punished twice.

models that refuse politely

OCR has its own failure mode. Vision models sometimes reply "this appears to be a blank page" instead of transcribing it, and that reply looks like text. Likhit checks every OCR response for this and rejects it, rather than storing an apology as the contents of a court document.

what I took from it

  • A metric can be gamed by the thing it measures. Check it against something independent before trusting it.
  • Averages hide the failures you care about. For text that people will quote, the worst part decides.
  • Record every run. A benchmark you can diff turns "it seems better" into a number.
book a chat