HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
Dicklesworthstone
llm_aided_ocr
Python2024–2025
Dicklesworthstone / llm_aided_ocr

llm_aided_ocr

Enhances Tesseract OCR output using LLMs (local or API) for error correction, smart chunking, and markdown formatting of scanned PDFs

3Distinct people
5Mentions
0Explicit recommenders
3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Enhances Tesseract OCR output using LLMs (local or API) for error correction, smart chunking, and markdown formatting of scanned PDFs

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by week5 dated mentions

Observed mentions: 2024-08-09 16:28:39 UTC to 2025-02-14 14:46:48 UTC. Weeks start Monday, UTC.

01232024-08-05 00:00:00 UTC to 2024-08-12 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 commentsAug 52024-08-12 00:00:00 UTC to 2024-08-19 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-08-19 00:00:00 UTC to 2024-08-26 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-08-26 00:00:00 UTC to 2024-09-02 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-09-02 00:00:00 UTC to 2024-09-09 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-09-09 00:00:00 UTC to 2024-09-16 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-09-16 00:00:00 UTC to 2024-09-23 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-09-23 00:00:00 UTC to 2024-09-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-09-30 00:00:00 UTC to 2024-10-07 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-10-07 00:00:00 UTC to 2024-10-14 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-10-14 00:00:00 UTC to 2024-10-21 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-10-21 00:00:00 UTC to 2024-10-28 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-10-28 00:00:00 UTC to 2024-11-04 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-11-04 00:00:00 UTC to 2024-11-11 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsNov 42024-11-11 00:00:00 UTC to 2024-11-18 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-11-18 00:00:00 UTC to 2024-11-25 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-11-25 00:00:00 UTC to 2024-12-02 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-12-02 00:00:00 UTC to 2024-12-09 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-12-09 00:00:00 UTC to 2024-12-16 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-12-16 00:00:00 UTC to 2024-12-23 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-12-23 00:00:00 UTC to 2024-12-30 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-12-30 00:00:00 UTC to 2025-01-06 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-06 00:00:00 UTC to 2025-01-13 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-13 00:00:00 UTC to 2025-01-20 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-20 00:00:00 UTC to 2025-01-27 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-27 00:00:00 UTC to 2025-02-03 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-02-03 00:00:00 UTC to 2025-02-10 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-02-10 00:00:00 UTC to 2025-02-17 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 commentsFeb 10

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Aug 52024-08-05 00:00:00 UTC2024-08-12 00:00:00 UTC312
Aug 122024-08-12 00:00:00 UTC2024-08-19 00:00:00 UTC000
Aug 192024-08-19 00:00:00 UTC2024-08-26 00:00:00 UTC000
Aug 262024-08-26 00:00:00 UTC2024-09-02 00:00:00 UTC000
Sep 22024-09-02 00:00:00 UTC2024-09-09 00:00:00 UTC000
Sep 92024-09-09 00:00:00 UTC2024-09-16 00:00:00 UTC000
Sep 162024-09-16 00:00:00 UTC2024-09-23 00:00:00 UTC000
Sep 232024-09-23 00:00:00 UTC2024-09-30 00:00:00 UTC000
Sep 302024-09-30 00:00:00 UTC2024-10-07 00:00:00 UTC000
Oct 72024-10-07 00:00:00 UTC2024-10-14 00:00:00 UTC000
Oct 142024-10-14 00:00:00 UTC2024-10-21 00:00:00 UTC000
Oct 212024-10-21 00:00:00 UTC2024-10-28 00:00:00 UTC000
Oct 282024-10-28 00:00:00 UTC2024-11-04 00:00:00 UTC000
Nov 42024-11-04 00:00:00 UTC2024-11-11 00:00:00 UTC000
Nov 112024-11-11 00:00:00 UTC2024-11-18 00:00:00 UTC000
Nov 182024-11-18 00:00:00 UTC2024-11-25 00:00:00 UTC000
Nov 252024-11-25 00:00:00 UTC2024-12-02 00:00:00 UTC000
Dec 22024-12-02 00:00:00 UTC2024-12-09 00:00:00 UTC000
Dec 92024-12-09 00:00:00 UTC2024-12-16 00:00:00 UTC000
Dec 162024-12-16 00:00:00 UTC2024-12-23 00:00:00 UTC000
Dec 232024-12-23 00:00:00 UTC2024-12-30 00:00:00 UTC000
Dec 302024-12-30 00:00:00 UTC2025-01-06 00:00:00 UTC000
Jan 62025-01-06 00:00:00 UTC2025-01-13 00:00:00 UTC000
Jan 132025-01-13 00:00:00 UTC2025-01-20 00:00:00 UTC000
Jan 202025-01-20 00:00:00 UTC2025-01-27 00:00:00 UTC000
Jan 272025-01-27 00:00:00 UTC2025-02-03 00:00:00 UTC000
Feb 32025-02-03 00:00:00 UTC2025-02-10 00:00:00 UTC000
Feb 102025-02-10 00:00:00 UTC2025-02-17 00:00:00 UTC202

What Hacker News says

5 sources
I think the current sweet-spot for speed/efficiency/accuracy is to use Tesseract in combination with an LLM to fix any errors and to improve formatting, as in my open source project which has been shared before as a Show HN: https://github.com/Dicklesworthstone/llm_aided_ocr This process also makes it extremely easy to tweak/customize simply by editing the English language prompt texts to prioritize aspects specific to your set of input documents.
In OCR4all
Hey, author of Zerox here! Happy to hear you saw good results. Given both libraries are primarily using GPT-4o-mini, I'd expect pretty similar performance. The author here seems to have some better prompts than we do: https://github.com/Dicklesworthstone/llm_aided_ocr/blob/main... In our approach, we're just zero shot asking for markdown from the image. Vs this approach of passing in the Tesseract result + image context and asking for correction. I'm curious if there is a meaningful accuracy difference. My first thought it that the tesseract result may decrease accuracy, especially with tables or multi column pdfs. The tesseract model has a tendency to take everything from a table and throw it into one text blob. So while it's added context to the model, it's often not helpful.
In Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs
This package seems to use llama_cpp for local inference [1] so you can probably use anything supported by that [2]. However, I think it's just passing OCR output for correction - the language model doesn't actually see the original image. That said, there are some large language models you can run locally which accept image input. Phi-3-Vision [3], LLaVA [4], MiniCPM-V [5], etc. [1] - https://github.com/Dicklesworthstone/llm_aided_ocr/blob/main... [2] - https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#de... [3] - https://huggingface.co/microsoft/Phi-3-vision-128k-instruct [4] - https://github.com/haotian-liu/LLaVA [5] - https://github.com/OpenBMB/MiniCPM-V
In Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs
eigenvalue·Aug 9, 2024Submission

Show HN: LLM-aided OCR – Correcting Tesseract OCR errors with LLMs

Almost exactly 1 year ago, I submitted something to HN about using Llama2 (which had just come out) to improve the output of Tesseract OCR by correcting obvious OCR errors [0]. That was exciting at the time because OpenAI's API calls were still quite expensive for GPT4, and the cost of running it on a book-length PDF would just be prohibitive. In contrast, you could run Llama2 locally on a machine with just a CPU, and it would be extremely slow, but "free" if you had a spare machine lying around. Well, it's amazing how things have changed since then. Not only have models gotten a lot better, but the latest "low tier" offerings from OpenAI (GPT4o-mini) and Anthropic (Claude3-Haiku) are incredibly cheap and incredibly fast. So cheap and fast, in fact, that you can now break the document up into little chunks and submit them to the API concu
Read the rest
rrently (where each chunk can go through a multi-stage process, in which the output of the first stage is passed into another prompt for the next stage) and assemble it all in a shockingly short amount of time, and for basically a rounding error in terms of cost. My original project had all sorts of complex stuff for detecting hallucinations and incorrect, spurious additions to the text (like "Here is the corrected text" preambles). But the newer models are already good enough to eliminate most of that stuff. And you can get very impressive results with the multi-stage approach. In this case, the first pass asks it to correct OCR errors and to remove line breaks in the middle of a word and things like that. The next stage takes that as the input and asks the model to do things like reformat the text using markdown, to suppress page numbers and repeated page headers, etc. Anyway, I think the samples (which take less than 1-2 minutes to generate) show the power of the approach: Original PDF: https://github.com/Dicklesworthstone/llm_aided_ocr/blob/main... Raw OCR Output: https://github.com/Dicklesworthstone/llm_aided_ocr/blob/main... LLM-Corrected Markdown Output: https://github.com/Dicklesworthstone/llm_aided_ocr/blob/main... One interesting thing I found was that almost all my attempts to fix/improve things using "classical" methods like regex and other rule based things made everything worse and more brittle, and the real improvements came from adjusting the prompts to make things clearer for the model, and not asking the model to do too much in a single pass (like fixing OCR mistakes AND converting to markdown format). Anyway, this project is very handy if you have some old scanned books you want to read from Archive.org or Google Books on a Kindle or other ereader device and want things to be re-flowable and clear. It's still not perfect, but I bet within the next year the models will improve even more that it will get closer to 100%. Hope you like it! [0] https://news.ycombinator.com/item?id=36976333
479 points · Open discussion

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.