Post-OCR Correction Using Large Language Models with Constrained Decoding

preprint OA: closed CC-BY-4.0
📄 Open PDF Full text JSON View at publisher
Full text 10,906 characters · extracted from preprint-html · click to expand
Post-OCR Correction Using Large Language Models with Constrained Decoding | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Post-OCR Correction Using Large Language Models with Constrained Decoding Ignacio Sastre, Lorena Etcheverry, Guillermo Rey, Guillermo Moncecchi, and 1 more This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-6823036/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract This article addresses the problem of correcting noisy Optical Character Recognition (OCR) outputs from digitized historical documents, specifically those from the Berrutti Archive related to Uruguay’s civic-military dictatorship. These documents—produced with typewriters, diverse layouts, and overlaid annotations—pose significant challenges for standard optical character recognition (OCR) tools, resulting in highly error-prone text. We present a novel post-OCR correction method that leverages fine-tuned open-source Large Language Models (LLMs) combined with a constrained decoding strategy. This strategy incorporates character-level similarity between the OCR input and the generated output at decoding time, steering the model toward corrections that closely preserve the original text structure. We evaluate our method on a gold-standard dataset of over 2000 annotated lines and show that it outperforms prompting and standard fine-tuning approaches, reducing both character error rate (CER) and word error rate (WER). The corrected outputs provide more accurate input for downstream tasks, such as named entity recognition, relation and event extraction, and knowledge graph construction, thereby supporting the broader goal of extracting knowledge from historically significant and sensitive archives. Post-OCR Correction Large Language Models Fine-Tuning Constrained Decoding Beam Search Full Text Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-6823036","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":470001295,"identity":"f90cb461-8be7-4bc4-932b-854374a897f8","order_by":0,"name":"Ignacio Sastre","email":"","orcid":"","institution":"Facultad de Ingeniería - Universidad de la República","correspondingAuthor":false,"prefix":"","firstName":"Ignacio","middleName":"","lastName":"Sastre","suffix":""},{"id":470001296,"identity":"c66e9715-7501-4720-82b9-b4cfc23d5f88","order_by":1,"name":"Lorena Etcheverry","email":"","orcid":"","institution":"Facultad de Ingeniería - Universidad de la República","correspondingAuthor":false,"prefix":"","firstName":"Lorena","middleName":"","lastName":"Etcheverry","suffix":""},{"id":470001297,"identity":"cd2f1e25-fbf3-478c-ad57-ed790029fc56","order_by":2,"name":"Guillermo Rey","email":"","orcid":"","institution":"Facultad de Ingeniería - Universidad de la República","correspondingAuthor":false,"prefix":"","firstName":"Guillermo","middleName":"","lastName":"Rey","suffix":""},{"id":470001298,"identity":"f3e4e73d-d6ef-43a3-9434-41887aa5b7d6","order_by":3,"name":"Guillermo Moncecchi","email":"","orcid":"","institution":"Facultad de Ingeniería - Universidad de la República","correspondingAuthor":false,"prefix":"","firstName":"Guillermo","middleName":"","lastName":"Moncecchi","suffix":""},{"id":470001299,"identity":"4d7014c2-739a-45cb-84a2-31199e7e5522","order_by":4,"name":"Aiala Rosá","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA00lEQVRIie3OMQuCQBTA8SfCuVzaeJLUV7C56LMIQS4NTY3RZIsfwK/R3vDkBhfRxsBFl6aGxoKCVBqa7I1B9+c4eHA/3gGoVL+YDhoCTC3WToxGoCYLO6ATaIm0t2Ri7fQS74dcmIPdEa5rCe7J6yZCMjcOz4VgTrrSooxAoH6DHIsNE0tP7wUEMpLGNX5gJlrypBBX8vog1sRHXaOQseQr6eC82QJxmPncTstuMsyTfXXBmRhFflXe1pOhmXzZ8hF3sbmhTyfG+0MWkolKpVL9Ry9BGke7FR/ZpQAAAABJRU5ErkJggg==","orcid":"","institution":"Facultad de Ingeniería - Universidad de la República","correspondingAuthor":true,"prefix":"","firstName":"Aiala","middleName":"","lastName":"Rosá","suffix":""}],"badges":[],"createdAt":"2025-06-04 18:38:22","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-6823036/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-6823036/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":93358892,"identity":"c8813dee-262a-4c99-b8a3-8e7556adf3d7","added_by":"auto","created_at":"2025-10-13 02:24:08","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":548764,"visible":true,"origin":"","legend":"","description":"","filename":"SastreEtAltOCRcorrectionconstrainedbeamsearch.pdf","url":"https://assets-eu.researchsquare.com/files/rs-6823036/v1_covered_283851a6-03a7-4958-a7eb-ba3aa3b5c10f.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Post-OCR Correction Using Large Language Models with Constrained Decoding","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":true,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Post-OCR Correction, Large Language Models, Fine-Tuning, Constrained Decoding, Beam Search","lastPublishedDoi":"10.21203/rs.3.rs-6823036/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-6823036/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"This article addresses the problem of correcting noisy Optical Character Recognition (OCR) outputs from digitized historical documents, specifically those from the Berrutti Archive related to Uruguay’s civic-military dictatorship. These documents—produced with typewriters, diverse layouts, and overlaid annotations—pose significant challenges for standard optical character recognition (OCR) tools, resulting in highly error-prone text. We present a novel post-OCR correction method that leverages fine-tuned open-source Large Language Models (LLMs) combined with a constrained decoding strategy. This strategy incorporates character-level similarity between the OCR input and the generated output at decoding time, steering the model toward corrections that closely preserve the original text structure. We evaluate our method on a gold-standard dataset of over 2000 annotated lines and show that it outperforms prompting and standard fine-tuning approaches, reducing both character error rate (CER) and word error rate (WER). The corrected outputs provide more accurate input for downstream tasks, such as named entity recognition, relation and event extraction, and knowledge graph construction, thereby supporting the broader goal of extracting knowledge from historically significant and sensitive archives.","manuscriptTitle":"Post-OCR Correction Using Large Language Models with Constrained Decoding","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-07-15 11:56:49","doi":"10.21203/rs.3.rs-6823036/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"08278bab-9d1f-48f9-b792-bb958ed55ff0","owner":[],"postedDate":"July 15th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2025-10-13T02:23:22+00:00","versionOfRecord":[],"versionCreatedAt":"2025-07-15 11:56:49","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-6823036","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-6823036","identity":"rs-6823036","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2025) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00
unpaywall
last seen: 2026-05-23T02:00:01.238055+00:00
License: CC-BY-4.0